diff --git a/common/src/main/java/io/github/gregtechintergalactical/gtcore/blockentity/BlockEntityRedstoneWire.java b/common/src/main/java/io/github/gregtechintergalactical/gtcore/blockentity/BlockEntityRedstoneWire.java index cc8da99..63b9ccf 100644 --- a/common/src/main/java/io/github/gregtechintergalactical/gtcore/blockentity/BlockEntityRedstoneWire.java +++ b/common/src/main/java/io/github/gregtechintergalactical/gtcore/blockentity/BlockEntityRedstoneWire.java @@ -202,6 +202,17 @@ public static void doRedstoneUpdate(BlockEntityRedstoneWire aTileEntity) { } } + public void setMode(int mode){ + int oldMode = mMode; + mMode = CodeUtils.bind4(mode); + if (oldMode != mMode) { + if (updateRedstone()) doRedstoneUpdate(this); + for (Direction tSide : Direction.values()) { + if (mConnectedToNonWire) updateBlock(tSide); + } + } + } + @Override public List getInfo(boolean simple) { List info = super.getInfo(simple); diff --git a/common/src/main/java/io/github/gregtechintergalactical/gtcore/cover/CoverSelectorTag.java b/common/src/main/java/io/github/gregtechintergalactical/gtcore/cover/CoverSelectorTag.java index 6123145..b8d38c8 100644 --- a/common/src/main/java/io/github/gregtechintergalactical/gtcore/cover/CoverSelectorTag.java +++ b/common/src/main/java/io/github/gregtechintergalactical/gtcore/cover/CoverSelectorTag.java @@ -15,14 +15,24 @@ import java.util.function.BiConsumer; public class CoverSelectorTag extends BaseCover { - public CoverSelectorTag(@NotNull ICoverHandler source, @Nullable Tier tier, Direction side, CoverFactory factory) { + final int mode; + public CoverSelectorTag(@NotNull ICoverHandler source, @Nullable Tier tier, Direction side, CoverFactory factory, int mode) { super(source, tier, side, factory); + this.mode = mode; } @Override public void onPlace() { if (source().getTile() instanceof BlockEntityRedstoneWire wire) { + wire.setMode(mode); + } + } + @Override + public void onRemove() { + super.onRemove(); + if (source().getTile() instanceof BlockEntityRedstoneWire wire) { + wire.setMode(0); } } diff --git a/common/src/main/java/io/github/gregtechintergalactical/gtcore/data/GTCoreItems.java b/common/src/main/java/io/github/gregtechintergalactical/gtcore/data/GTCoreItems.java index bcd049b..0ab8e2e 100644 --- a/common/src/main/java/io/github/gregtechintergalactical/gtcore/data/GTCoreItems.java +++ b/common/src/main/java/io/github/gregtechintergalactical/gtcore/data/GTCoreItems.java @@ -215,7 +215,8 @@ public class GTCoreItems { ingredientBuilder.put(i, RecipeIngredient.of(selectorTag,1).setNoConsume()); itemBuilder.put(i, selectorTag); if (i > 15) continue; - coverBuilder.put(i, CoverFactory.builder(CoverSelectorTag::new) + int finalI = i; + coverBuilder.put(i, CoverFactory.builder((source, tier, side, factory) -> new CoverSelectorTag(source, tier, side, factory, finalI)) .addTextures(new Texture(GTCore.ID, "block/cover/selector_tags/" + i), new Texture(GTCore.ID, "block/cover/selector_tags/underlay")) .item((c, t) -> selectorTag).build(GTCore.ID, "selector_tag_"+i)); }