Skip to content

Commit

Permalink
Merge pull request #297 from MrTroble/feat/1.19.4-multilinkingtool
Browse files Browse the repository at this point in the history
Feat/1.19.4 multilinkingtool
  • Loading branch information
Jeronimo97 authored Aug 6, 2023
2 parents eebbd49 + 4b6b9e5 commit 4520fd5
Show file tree
Hide file tree
Showing 15 changed files with 87 additions and 46 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up JDK 8
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '8'
java-version: '17'
distribution: 'adopt'
- name: Change wrapper permissions
run: chmod +x ./gradlew
Expand All @@ -30,16 +30,16 @@ jobs:
if: endswith(github.ref_name, 'master') && github.ref_protected && github.ref_type == 'branch'
runs-on: ubuntu-latest
env:
APPVEYOR_BUILD_VERSION: '3.1.2'
APPVEYOR_BUILD_VERSION: '3.2.1'
CURSETOKEN: ${{ secrets.CURSETOKEN }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up JDK 8
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '8'
java-version: '17'
distribution: 'adopt'
- name: Change wrapper permissions
run: chmod +x ./gradlew
Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ if(ver == null)
ver = "dev"
version = ver
group = 'com.troblecodings'
archivesBaseName = 'TC-Redstone-1.19.3'
archivesBaseName = 'TC-Redstone-1.19.4'

java.toolchain.languageVersion = JavaLanguageVersion.of(17)

minecraft {
mappings channel: 'official', version: '1.19'
mappings channel: 'official', version: '1.19.4'

runs {
client {
Expand Down Expand Up @@ -83,7 +83,7 @@ repositories {
}

dependencies {
minecraft 'net.minecraftforge:forge:1.19.3-44.1.20'
minecraft 'net.minecraftforge:forge:1.19.4-45.1.0'
}

jar {
Expand Down
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## [1.19.4 - 3.2.1]

* update to 1.19.4
* added multi linking tool

## [Update]

* feat: added multi-emitter block
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,14 @@ public InteractionResult use(final BlockState state, final Level world, final Bl
final TileRedstoneEmitter emitter = (TileRedstoneEmitter) entity;
final BlockPos linkedpos = emitter.getLinkedPos();
if (linkedpos == null) {
player.sendSystemMessage(
MutableComponent.create(new TranslatableContents("em.notlinked")));
player.sendSystemMessage(MutableComponent.create(new TranslatableContents(
"em.notlinked", (String) null, TranslatableContents.NO_ARGS)));
} else {
if (player.isCrouching()) {
emitter.unlink();
player.sendSystemMessage(MutableComponent.create(new TranslatableContents(
"em.unlink", linkedpos.getX(), linkedpos.getY(), linkedpos.getZ())));
message(player, "lt.linkedpos", pos.getX(), pos.getY(), pos.getZ());
} else {
player.sendSystemMessage(MutableComponent.create(new TranslatableContents(
"lt.linkedpos", linkedpos.getX(), linkedpos.getY(), linkedpos.getZ())));
message(player, "lt.linkedpos", pos.getX(), pos.getY(), pos.getZ());
}
}
return InteractionResult.SUCCESS;
Expand All @@ -68,4 +66,12 @@ public BlockEntity newBlockEntity(final BlockPos pos, final BlockState state) {
return new TileRedstoneEmitter(pos, state);
}

public void message(final Player player, final String text, final Object... obj) {
player.sendSystemMessage(getComponent(text, obj));
}

public MutableComponent getComponent(final String text, final Object... obj) {
return MutableComponent.create(new TranslatableContents(text, text, obj));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,16 @@ public InteractionResult use(final BlockState state, final Level world, final Bl
final TileRedstoneMultiEmitter emitter = (TileRedstoneMultiEmitter) entity;
final List<BlockPos> listOfPositions = emitter.getLinkedPos();
if (listOfPositions == null) {
player.sendSystemMessage(
MutableComponent.create(new TranslatableContents("em.notlinked")));
player.sendSystemMessage(MutableComponent.create(new TranslatableContents(
"em.notlinked", (String) null, TranslatableContents.NO_ARGS)));
} else {
if (player.isCrouching()) {
emitter.unlink();
listOfPositions.forEach(blockpos -> player.sendSystemMessage(
MutableComponent.create(new TranslatableContents("em.unlink",
blockpos.getX(), blockpos.getY(), blockpos.getZ()))));
listOfPositions.forEach(blockpos -> message(player, "lt.linkedpos",
blockpos.getX(), blockpos.getY(), blockpos.getZ()));
} else {
listOfPositions.forEach(blockpos -> player.sendSystemMessage(
MutableComponent.create(new TranslatableContents("lt.linkedpos",
blockpos.getX(), blockpos.getY(), blockpos.getZ()))));
listOfPositions.forEach(blockpos -> message(player, "lt.linkedpos",
blockpos.getX(), blockpos.getY(), blockpos.getZ()));
}
}
return InteractionResult.SUCCESS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.function.Supplier;

import com.troblecodings.linkableapi.Linkingtool;
import com.troblecodings.linkableapi.MultiLinkingTool;
import com.troblecodings.tcredstone.GIRCRedstoneMain;
import com.troblecodings.tcredstone.block.BlockRedstoneAcceptor;
import com.troblecodings.tcredstone.block.BlockRedstoneEmitter;
Expand Down Expand Up @@ -54,6 +55,8 @@ 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));
public static final RegistryObject<Item> RS_MULTILINKER = ITEM_REGISTRY.register("multilinker",
() -> new MultiLinkingTool(null, GIRCInit::acceptAcceptor));
public static final RegistryObject<Item> REMOTE_ACTIVATOR = ITEM_REGISTRY.register("activator",
() -> new RemoteActivator());

Expand Down Expand Up @@ -82,7 +85,7 @@ public static void init() {

@SubscribeEvent
public static void onCreativeTabs(final CreativeModeTabEvent.BuildContents event) {
if (event.getTab().equals(CreativeModeTabs.f_257028_)) {
if (event.getTab().equals(CreativeModeTabs.REDSTONE_BLOCKS)) {
ITEM_REGISTRY.getEntries().forEach(event::accept);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
modLoader="javafml"
loaderVersion="[38,)"
loaderVersion="[45,)"
issueTrackerURL="https://github.com/German-Immersive-Railroading-Community/GIRC-Redstone/issues"
license="Apache License Version 2.0"

Expand All @@ -14,13 +14,13 @@ description="Works in unloaded Chunks TM."
[[dependencies.gircredstone]]
modId="forge"
mandatory=true
versionRange="[44.0.30,)"
versionRange="[45,)"
ordering="NONE"
side="BOTH"

[[dependencies.gircredstone]]
modId="minecraft"
mandatory=true
versionRange="[1.19.3, 1.20)"
versionRange="[1.19.4, 1.20)"
ordering="NONE"
side="BOTH"
2 changes: 2 additions & 0 deletions src/main/resources/assets/gircredstone/lang/de_de.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"item.gircredstone.linker": "WLR Verlinker",
"item.gircredstone.multilinker": "WLR Multi Verlinker",
"item.gircredstone.activator": "WLR Fernaktivator",
"block.gircredstone.emitter": "WLR Signal-Sender",
"block.gircredstone.multiemitter": "WLR Multi-Signal-Sender",
Expand All @@ -11,6 +12,7 @@
"lt.notlinked.msg": "§l§9Bitte klicke auf einen Signal-Akzeptor um zu verknüpfen.§r",
"lt.reset": "§cDer Verlinker ist zurückgesetzt.§r",
"lt.notset": "§cDer Verlinker ist nicht verlinkt.§r",
"lt.unlink": "§cDer Signal-Sender ist nicht mehr verlinkt!§r",
"em.notlinked": "§cDer Signal-Sender ist nicht verlinkt!§r",
"em.unlink": "§cNicht mehr verlinkt.§r",
"ra.state": "Aktiviert: %s"
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/gircredstone/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"item.gircredstone.linker": "WLR Linker",
"item.gircredstone.multilinker": "WLR Multi Linker",
"item.gircredstone.activator": "WLR Remote Activator",
"block.gircredstone.emitter": "WLR Emitter",
"block.gircredstone.multiemitter": "WLR Multi-Emitter",
Expand All @@ -11,6 +12,7 @@
"lt.notlinked.msg": "§l§9Please click on an Acceptor to link.§r",
"lt.reset": "§cThe tool has been reset.§r",
"lt.notset": "§cThe tool is not linked.§r",
"lt.unlink": "§cEmitter is not more linked!§r",
"em.notlinked": "§cEmitter is not linked!§r",
"em.unlink": "§cUnlinked.§r",
"ra.state": "Activated: %s"
Expand Down
34 changes: 18 additions & 16 deletions src/main/resources/assets/gircredstone/lang/pt_br.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
{
"item.gircredstone.linker": "WLR Vinculador",
"item.gircredstone.activator": "WLR Ativador Remoto",
"block.gircredstone.emitter": "WLR Emissor",
"block.gircredstone.multiemitter": "WLR Multi-Emissor",
"block.gircredstone.acceptor": "WLR Receptor",
"lt.linkedpos": "§2Ligado a: {%d, %d, %d§2}§r",
"lt.setpos": "§2Definido como: {%d, %d, %d§2}§r",
"lt.setpos.msg": "§l§9Por favor, clique em um emissor para definir o link.§r",
"lt.notlinked": "§cNão ligado!§r",
"lt.notlinked.msg": "§l§9Por favor, clique em um aceitador para vincular.§r",
"lt.reset": "§cA ferramenta foi redefinida.§r",
"lt.notset": "§cA ferramenta não está vinculado.§r",
"em.notlinked": "§cEmissor não está vinculado!§r",
"em.unlink": "§cDesvinculado.§r",
"ra.state": "Ativado: %s"
{
"item.gircredstone.linker": "WLR Vinculador",
"item.gircredstone.multilinker": "WLR Múltiplo Vinculador",
"item.gircredstone.activator": "WLR Ativador Remoto",
"block.gircredstone.emitter": "WLR Emissor",
"block.gircredstone.multiemitter": "WLR Multi-Emissor",
"block.gircredstone.acceptor": "WLR Receptor",
"lt.linkedpos": "§2Ligado a: {%d, %d, %d§2}§r",
"lt.setpos": "§2Definido como: {%d, %d, %d§2}§r",
"lt.setpos.msg": "§l§9Por favor, clique em um emissor para definir o link.§r",
"lt.notlinked": "§cNão ligado!§r",
"lt.notlinked.msg": "§l§9Por favor, clique em um aceitador para vincular.§r",
"lt.reset": "§cA ferramenta foi redefinida.§r",
"lt.notset": "§cA ferramenta não está vinculado.§r",
"lt.unlink": "§cEmissor não está mais vinculado!§r",
"em.notlinked": "§cEmissor não está vinculado!§r",
"em.unlink": "§cDesvinculado.§r",
"ra.state": "Ativado: %s"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"parent": "minecraft:item/generated", "textures": {"layer0": "gircredstone:item/multilinker"}, "credit": "Made with Blockbench by Mc_Jeronimo"}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions src/main/resources/data/gircredstone/recipes/multilinker.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
" I ",
" i ",
" x "
],
"key": {
"I": {
"item": "minecraft:quartz"
},
"i": {
"item": "minecraft:redstone_torch"
},
"x": {
"item": "minecraft:diamond"
}
},
"result": {
"item": "gircredstone:multilinker"
}
}
6 changes: 3 additions & 3 deletions src/main/resources/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"pack": {
"description": "GIRC Redstone",
"pack_format": 12,
"forge:resource_pack_format": 12,
"forge:data_pack_format": 10
"pack_format": 13,
"forge:resource_pack_format": 13,
"forge:data_pack_format": 12
}
}

0 comments on commit 4520fd5

Please sign in to comment.