Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Set up Java
uses: actions/setup-java@v5
with:
java-version: 21
java-version: 25
distribution: temurin
cache: gradle

Expand All @@ -38,9 +38,14 @@ jobs:
- name: Build
run: ./gradlew build

- name: Publish
- name: Publishing Curseforge
if: github.event_name == 'push' && github.ref_protected && github.ref_type == 'branch'
run: ./gradlew publishMods
run: ./gradlew publishCurseforge
env:
CURSETOKEN: ${{ secrets.CURSETOKEN }}

- name: Publishing Modrinth
if: github.event_name == 'push' && github.ref_protected && github.ref_type == 'branch'
run: ./gradlew publishModrinth
env:
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
71 changes: 33 additions & 38 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
buildscript {
repositories {
maven { url = 'https://maven.minecraftforge.net/' }
maven { url = 'https://plugins.gradle.org/m2/' }
mavenCentral()
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:6.0.+'
classpath "gradle.plugin.com.matthewprenger:CurseGradle:1.4.0"
classpath "com.modrinth.minotaur:Minotaur:2.+"
}
plugins {
id 'net.minecraftforge.gradle' version '6.0.+'
id 'com.gradleup.shadow' version '9.2.0+'
id 'eclipse'
id 'net.darkhax.curseforgegradle' version '1.3.+'
id "com.modrinth.minotaur" version "2.+"
}

apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
apply plugin: 'com.matthewprenger.cursegradle'
apply plugin: 'com.modrinth.minotaur'

group = project.mod_group
version = project.mod_version

Expand Down Expand Up @@ -56,6 +45,14 @@ dependencies {
}

jar {
enabled = false
}

shadowJar {
archiveClassifier.set('')
configurations = []
relocate 'com.troblecodings.linkableapi', "${project.group}.tcredstone.shadow.linkableapi"

manifest {
attributes([
"Specification-Title": project.mod_name,
Expand All @@ -67,25 +64,23 @@ jar {
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}

def key = System.getenv("CURSETOKEN")
if (key == null)
key = 'dev'

curseforge {
apiKey = key

project {
id = project.curseforge_project_id

changelog = file("changelog.md")
changelogType = "markdown"

releaseType = "release"
from("changelog.md")
from("LICENSE")
}

addGameVersion project.minecraft_version
}
tasks.register("publishCurseforge", net.darkhax.curseforgegradle.TaskPublishCurseForge) {
def key = System.getenv("CURSETOKEN")
if (key == null)
key = 'dev'
apiToken = key
def mainFile = upload(project.curseforge_project_id, shadowJar)
mainFile.changelog = file("changelog.md").text
mainFile.changelogType = 'markdown'
mainFile.releaseType = 'release'
mainFile.addModLoader("${project.loader}")
mainFile.addEnvironment("Client", "Server")
mainFile.addGameVersion("${project.minecraft_version}")
}

modrinth {
Expand All @@ -96,14 +91,14 @@ modrinth {
versionNumber = project.version
versionName = "${project.mod_name} ${project.version}"

uploadFile = jar
uploadFile = shadowJar

gameVersions = [project.minecraft_version]
loaders = [project.loader]

changelog = file("changelog.md").text
}

tasks.register("publishMods") {
dependsOn("curseforge", "modrinth")
}
tasks.register("publishModrinth") {
dependsOn("modrinth")
}
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## [1.20.6 - 3.2.5]

* chore: update buildscript
* chore: relocate linkableapi

## [1.20.6 - 3.2.4]

* fix: correct redstone update
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ org.gradle.daemon=false
# Mod Meta
mod_name=TC-Redstone
mod_group=com.troblecodings
mod_version=3.2.4
mod_version=3.2.5

# Minecraft
minecraft_version=1.20.6

# Forge
forge_version=50.2.0
loader=forge
loader=Forge

# Java
java_version=21
Expand Down
10 changes: 10 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven { url = 'https://maven.minecraftforge.net/' }
}
}

plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.troblecodings.tcredstone.init.GIRCInit;
import com.troblecodings.tcredstone.init.TCInit;

import net.minecraft.core.component.DataComponentType;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraftforge.fml.common.Mod;

@Mod(GIRCRedstoneMain.MODID)
public class GIRCRedstoneMain {
@Mod(TCRedstoneMain.MODID)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [Checkstyle] <com.puppycrawl.tools.checkstyle.checks.design.HideUtilityClassConstructorCheck> reported by reviewdog 🐶
Utility classes should not have a public or default constructor.

public class TCRedstoneMain {

public static final DataComponentType<CompoundTag> COMPOUND_DATA =
DataComponentType.<CompoundTag>builder().persistent(CompoundTag.CODEC)
.networkSynchronized(ByteBufCodecs.COMPOUND_TAG).build();

public GIRCRedstoneMain() {
GIRCInit.init();
public TCRedstoneMain() {
TCInit.init();
}

public static final Logger LOGGER = LogManager.getLogger();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.troblecodings.tcredstone.block;

import com.troblecodings.linkableapi.Message;
import com.troblecodings.tcredstone.init.GIRCInit;
import com.troblecodings.tcredstone.init.TCInit;
import com.troblecodings.tcredstone.tile.TileRedstoneEmitter;

import net.minecraft.core.BlockPos;
Expand All @@ -28,7 +28,7 @@ public ItemInteractionResult useItemOn(final ItemStack stack, final BlockState s
final BlockHitResult hit) {
if (world.isClientSide)
return ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION;
if (player.getItemInHand(hand).getItem().equals(GIRCInit.RS_LINKER.get()))
if (player.getItemInHand(hand).getItem().equals(TCInit.RS_LINKER.get()))
return ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION;
final BlockEntity entity = world.getBlockEntity(pos);
if (entity instanceof TileRedstoneEmitter) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.util.List;

import com.troblecodings.linkableapi.Message;
import com.troblecodings.tcredstone.init.GIRCInit;
import com.troblecodings.tcredstone.init.TCInit;
import com.troblecodings.tcredstone.tile.TileRedstoneMultiEmitter;

import net.minecraft.core.BlockPos;
Expand Down Expand Up @@ -34,7 +34,7 @@ public ItemInteractionResult useItemOn(final ItemStack stack, final BlockState s
final BlockHitResult hit) {
if (world.isClientSide)
return ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION;
if (player.getItemInHand(hand).getItem().equals(GIRCInit.RS_LINKER.get()))
if (player.getItemInHand(hand).getItem().equals(TCInit.RS_LINKER.get()))
return ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION;
final BlockEntity entity = world.getBlockEntity(pos);
if (entity instanceof TileRedstoneMultiEmitter) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import com.troblecodings.linkableapi.Linkingtool;
import com.troblecodings.linkableapi.MultiLinkingTool;
import com.troblecodings.tcredstone.GIRCRedstoneMain;
import com.troblecodings.tcredstone.TCRedstoneMain;
import com.troblecodings.tcredstone.block.BlockRedstoneAcceptor;
import com.troblecodings.tcredstone.block.BlockRedstoneEmitter;
import com.troblecodings.tcredstone.block.BlockRedstoneMultiEmitter;
Expand Down Expand Up @@ -32,14 +32,14 @@
import net.minecraftforge.registries.RegisterEvent;
import net.minecraftforge.registries.RegistryObject;

public class GIRCInit {
public class TCInit {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [Checkstyle] <com.puppycrawl.tools.checkstyle.checks.design.HideUtilityClassConstructorCheck> reported by reviewdog 🐶
Utility classes should not have a public or default constructor.


public static final DeferredRegister<Item> ITEM_REGISTRY =
DeferredRegister.create(ForgeRegistries.ITEMS, GIRCRedstoneMain.MODID);
DeferredRegister.create(ForgeRegistries.ITEMS, TCRedstoneMain.MODID);
public static final DeferredRegister<Block> BLOCK_REGISTRY =
DeferredRegister.create(ForgeRegistries.BLOCKS, GIRCRedstoneMain.MODID);
DeferredRegister.create(ForgeRegistries.BLOCKS, TCRedstoneMain.MODID);
public static final DeferredRegister<BlockEntityType<?>> TILEENTITY_REGISTRY =
DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, GIRCRedstoneMain.MODID);
DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, TCRedstoneMain.MODID);

public static final RegistryObject<Block> RS_ACCEPTOR = internalRegisterBlock("acceptor",
() -> new BlockRedstoneAcceptor(BlockBehaviour.Properties.of() // TODO Material.METAL
Expand All @@ -55,12 +55,13 @@ public static boolean acceptAcceptor(final Level level, final BlockPos pos) {
return level.getBlockState(pos).getBlock() instanceof BlockRedstoneAcceptor;
}

public static final RegistryObject<Item> RS_LINKER =
ITEM_REGISTRY.register("linker", () -> new Linkingtool(null, GIRCInit::acceptAcceptor));
public static final RegistryObject<Item> RS_MULTILINKER = ITEM_REGISTRY.register("multilinker",
() -> new MultiLinkingTool(null, GIRCInit::acceptAcceptor));
public static final RegistryObject<Item> RS_LINKER = ITEM_REGISTRY.register("linker",
() -> new Linkingtool(null, TCInit::acceptAcceptor, TCRedstoneMain.COMPOUND_DATA));
public static final RegistryObject<Item> RS_MULTILINKER =
ITEM_REGISTRY.register("multilinker", () -> new MultiLinkingTool(null,
TCInit::acceptAcceptor, TCRedstoneMain.COMPOUND_DATA));
public static final RegistryObject<Item> REMOTE_ACTIVATOR = ITEM_REGISTRY.register("activator",
() -> new RemoteActivator(null, GIRCInit::acceptAcceptor));
() -> new RemoteActivator(null, TCInit::acceptAcceptor));

public static final RegistryObject<BlockEntityType<?>> EMITER_TILE =
TILEENTITY_REGISTRY.register("emitter", () -> BlockEntityType.Builder
Expand All @@ -80,7 +81,7 @@ private static final RegistryObject<Block> internalRegisterBlock(final String na
public static void init() {
@SuppressWarnings("removal")
final IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
bus.register(GIRCInit.class);
bus.register(TCInit.class);
ITEM_REGISTRY.register(bus);
BLOCK_REGISTRY.register(bus);
TILEENTITY_REGISTRY.register(bus);
Expand All @@ -97,8 +98,8 @@ public static void onCreativeTabs(final BuildCreativeModeTabContentsEvent event)
public static void registerDataComponents(final RegisterEvent event) {
event.register(BuiltInRegistries.DATA_COMPONENT_TYPE.key(), registry -> {
registry.register(
ResourceLocation.fromNamespaceAndPath(GIRCRedstoneMain.MODID, "compound_data"),
GIRCRedstoneMain.COMPOUND_DATA);
ResourceLocation.fromNamespaceAndPath(TCRedstoneMain.MODID, "compound_data"),
TCRedstoneMain.COMPOUND_DATA);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import java.util.function.BiPredicate;

import com.troblecodings.linkableapi.Linkingtool;
import com.troblecodings.tcredstone.GIRCRedstoneMain;
import com.troblecodings.tcredstone.TCRedstoneMain;
import com.troblecodings.tcredstone.tile.TileRedstoneEmitter;

import net.minecraft.core.BlockPos;
Expand All @@ -21,14 +21,14 @@ public class RemoteActivator extends Linkingtool {

public RemoteActivator(final CreativeModeTab tab,
final BiPredicate<Level, BlockPos> predicate) {
super(tab, predicate, _u -> false);
super(tab, predicate, _u -> false, TCRedstoneMain.COMPOUND_DATA);
}

@Override
public InteractionResultHolder<ItemStack> use(final Level level, final Player player,
final InteractionHand hand) {
final ItemStack itemstack = player.getItemInHand(hand);
final CompoundTag tag = itemstack.get(GIRCRedstoneMain.COMPOUND_DATA); // TODO
final CompoundTag tag = itemstack.get(TCRedstoneMain.COMPOUND_DATA);
if (tag != null) {
if (!hand.equals(InteractionHand.MAIN_HAND) || level.isClientSide)
return InteractionResultHolder.pass(itemstack);
Expand All @@ -37,7 +37,6 @@ public InteractionResultHolder<ItemStack> use(final Level level, final Player pl
final Optional<BlockPos> linkpos = NbtUtils.readBlockPos(comp, LINKINGTOOL_TAG);
final boolean state = TileRedstoneEmitter.redstoneUpdate(linkpos, level);
message(player, "ra.state", String.valueOf(state));
return InteractionResultHolder.success(itemstack);
}
}
return InteractionResultHolder.success(itemstack);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import com.troblecodings.linkableapi.ILinkableTile;
import com.troblecodings.tcredstone.block.BlockRedstoneAcceptor;
import com.troblecodings.tcredstone.init.GIRCInit;
import com.troblecodings.tcredstone.init.TCInit;

import net.minecraft.core.BlockPos;
import net.minecraft.core.HolderLookup.Provider;
Expand All @@ -16,7 +16,7 @@
public class TileRedstoneEmitter extends BlockEntity implements ILinkableTile {

public TileRedstoneEmitter(final BlockPos pos, final BlockState state) {
super(GIRCInit.EMITER_TILE.get(), pos, state);
super(TCInit.EMITER_TILE.get(), pos, state);
}

private BlockPos linkedpos = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.troblecodings.linkableapi.ILinkableTile;
import com.troblecodings.linkableapi.MultiLinkingTool;
import com.troblecodings.tcredstone.block.BlockRedstoneAcceptor;
import com.troblecodings.tcredstone.init.GIRCInit;
import com.troblecodings.tcredstone.init.TCInit;

import net.minecraft.core.BlockPos;
import net.minecraft.core.HolderLookup.Provider;
Expand All @@ -27,7 +27,7 @@ public class TileRedstoneMultiEmitter extends BlockEntity implements ILinkableTi
private static final String LINKED_POS_LIST = "linkedPos";

public TileRedstoneMultiEmitter(final BlockPos pos, final BlockState state) {
super(GIRCInit.MULTI_EMITER_TILE.get(), pos, state);
super(TCInit.MULTI_EMITER_TILE.get(), pos, state);
}

public CompoundTag writeBlockPosToNBT(final List<BlockPos> pos, final CompoundTag compound) {
Expand Down
Loading