Skip to content
Open
Show file tree
Hide file tree
Changes from 4 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
13 changes: 9 additions & 4 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: 17
java-version: 25
distribution: temurin
cache: gradle

Expand All @@ -36,11 +36,16 @@ jobs:
uses: gradle/actions/setup-gradle@v6

- name: Build
run: ./gradlew build
run: ./gradlew reobfShadowJar

- 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 }}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@

### Build

- ``./gradlew build``
- ``./gradlew build`` or
- ``./gradlew reobfShadowJar``

### License

Expand Down
77 changes: 39 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,27 +64,31 @@ jar {
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}

jar.finalizedBy('reobfJar')

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

curseforge {
apiKey = key

project {
id = project.curseforge_project_id
from("changelog.md")
from("LICENSE")
}

changelog = file("changelog.md")
changelogType = "markdown"
reobf {
shadowJar {}
}

releaseType = "release"
tasks.named("build") {
dependsOn("reobfShadowJar")
}

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, reobfShadowJar)
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 @@ -98,14 +99,14 @@ modrinth {
versionNumber = project.version
versionName = "${project.mod_name} ${project.version}"

uploadFile = jar
uploadFile = reobfShadowJar

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.4 - 3.2.5]

* chore: update buildscript
* chore: relocate linkableapi

## [1.20.4 - 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.4

# Forge
forge_version=49.1.0
loader=forge
loader=Forge

# Java
java_version=17
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,15 +3,15 @@
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.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 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 @@ -26,7 +26,7 @@ public InteractionResult use(final BlockState state, final Level world, final Bl
final Player player, final InteractionHand hand, final BlockHitResult hit) {
if (world.isClientSide)
return InteractionResult.PASS;
if (player.getItemInHand(hand).getItem().equals(GIRCInit.RS_LINKER.get()))
if (player.getItemInHand(hand).getItem().equals(TCInit.RS_LINKER.get()))
return InteractionResult.PASS;
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 @@ -32,7 +32,7 @@ public InteractionResult use(final BlockState state, final Level world, final Bl
final Player player, final InteractionHand hand, final BlockHitResult hit) {
if (world.isClientSide)
return InteractionResult.PASS;
if (player.getItemInHand(hand).getItem().equals(GIRCInit.RS_LINKER.get()))
if (player.getItemInHand(hand).getItem().equals(TCInit.RS_LINKER.get()))
return InteractionResult.PASS;
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 All @@ -29,14 +29,14 @@
import net.minecraftforge.registries.ForgeRegistries;
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 @@ -53,11 +53,11 @@ public static boolean acceptAcceptor(final Level level, final BlockPos pos) {
}

public static final RegistryObject<Item> RS_LINKER =
ITEM_REGISTRY.register("linker", () -> new Linkingtool(null, GIRCInit::acceptAcceptor));
ITEM_REGISTRY.register("linker", () -> new Linkingtool(null, TCInit::acceptAcceptor));
public static final RegistryObject<Item> RS_MULTILINKER = ITEM_REGISTRY.register("multilinker",
() -> new MultiLinkingTool(null, GIRCInit::acceptAcceptor));
() -> new MultiLinkingTool(null, TCInit::acceptAcceptor));
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 @@ -76,7 +76,7 @@ private static final RegistryObject<Block> internalRegisterBlock(final String na

public static void init() {
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 Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,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.nbt.CompoundTag;
Expand All @@ -13,7 +13,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 @@ -5,7 +5,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.nbt.CompoundTag;
Expand All @@ -22,7 +22,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