From 2337094c2317787cae61c6263b0fd4cd4c44d40b Mon Sep 17 00:00:00 2001 From: trinsdar <30245301+Trinsdar@users.noreply.github.com> Date: Sun, 9 Jun 2024 16:57:42 -0400 Subject: [PATCH] more work on redstone torch covers --- .../gtcore/GTCore.java | 1 + .../gtcore/cover/CoverRedstoneTorch.java | 15 ++++++++++++ .../gtcore/data/GTCoreCovers.java | 17 ++++++++++++++ .../models/block/cover/redstone_torch.json | 22 ++++++++++++++++++ .../block/cover/redstone_torch_off.png | Bin 0 -> 135 bytes .../block/cover/redstone_torch_on.png | Bin 0 -> 146 bytes 6 files changed, 55 insertions(+) create mode 100644 common/src/main/java/io/github/gregtechintergalactical/gtcore/data/GTCoreCovers.java create mode 100644 common/src/main/resources/assets/gtcore/models/block/cover/redstone_torch.json create mode 100644 common/src/main/resources/assets/gtcore/textures/block/cover/redstone_torch_off.png create mode 100644 common/src/main/resources/assets/gtcore/textures/block/cover/redstone_torch_on.png diff --git a/common/src/main/java/io/github/gregtechintergalactical/gtcore/GTCore.java b/common/src/main/java/io/github/gregtechintergalactical/gtcore/GTCore.java index 0a2a5e6..e804484 100644 --- a/common/src/main/java/io/github/gregtechintergalactical/gtcore/GTCore.java +++ b/common/src/main/java/io/github/gregtechintergalactical/gtcore/GTCore.java @@ -95,6 +95,7 @@ public void onRegistrationEvent(RegistrationEvent event, Side side) { SlotTypes.init(); MenuHandlers.init(); GTCoreData.init(); + GTCoreCovers.init(); GTCoreBlocks.init(); GTCoreItems.init(); GTCoreFluids.init(); diff --git a/common/src/main/java/io/github/gregtechintergalactical/gtcore/cover/CoverRedstoneTorch.java b/common/src/main/java/io/github/gregtechintergalactical/gtcore/cover/CoverRedstoneTorch.java index 72e549b..b5f3cd6 100644 --- a/common/src/main/java/io/github/gregtechintergalactical/gtcore/cover/CoverRedstoneTorch.java +++ b/common/src/main/java/io/github/gregtechintergalactical/gtcore/cover/CoverRedstoneTorch.java @@ -5,10 +5,13 @@ import muramasa.antimatter.cover.BaseCover; import muramasa.antimatter.cover.CoverFactory; import muramasa.antimatter.machine.Tier; +import muramasa.antimatter.texture.Texture; import net.minecraft.core.Direction; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.function.BiConsumer; + public class CoverRedstoneTorch extends BaseCover { public CoverRedstoneTorch(@NotNull ICoverHandler source, @Nullable Tier tier, Direction side, CoverFactory factory) { super(source, tier, side, factory); @@ -19,6 +22,12 @@ public boolean canPlace() { return source().getTile() instanceof BlockEntityRedstoneWire; } + @Override + public void onPlace() { + BlockEntityRedstoneWire wire = (BlockEntityRedstoneWire) source().getTile(); + wire.clearConnection(side); + } + @Override public boolean blockConnection(Direction side) { return true; @@ -35,4 +44,10 @@ public int getWeakPower() { BlockEntityRedstoneWire wire = (BlockEntityRedstoneWire) source().getTile(); return wire.getRedstoneValue() > 0 ? 0 : 15; } + + @Override + public void setTextures(BiConsumer texer) { + BlockEntityRedstoneWire wire = (BlockEntityRedstoneWire) source().getTile(); + texer.accept("overlay", factory.getTextures().get(wire.getRedstoneValue() > 0 ? 0 : 1)); + } } diff --git a/common/src/main/java/io/github/gregtechintergalactical/gtcore/data/GTCoreCovers.java b/common/src/main/java/io/github/gregtechintergalactical/gtcore/data/GTCoreCovers.java new file mode 100644 index 0000000..43f4e56 --- /dev/null +++ b/common/src/main/java/io/github/gregtechintergalactical/gtcore/data/GTCoreCovers.java @@ -0,0 +1,17 @@ +package io.github.gregtechintergalactical.gtcore.data; + +import io.github.gregtechintergalactical.gtcore.GTCore; +import io.github.gregtechintergalactical.gtcore.cover.CoverRedstoneTorch; +import muramasa.antimatter.cover.CoverFactory; +import muramasa.antimatter.item.ItemCover; +import muramasa.antimatter.texture.Texture; +import net.minecraft.world.item.Items; + +public class GTCoreCovers { + + public static CoverFactory REDSTONE_TORCH = CoverFactory.builder(CoverRedstoneTorch::new) + .addTextures(new Texture(GTCore.ID, "block/cover/redstone_torch_off"), new Texture(GTCore.ID, "block/cover/redstone_torch_on")) + .item((f, t) -> new ItemCover(GTCore.ID, "redstone_torch")).build(GTCore.ID, "redstone_torch"); + + public static void init(){} +} diff --git a/common/src/main/resources/assets/gtcore/models/block/cover/redstone_torch.json b/common/src/main/resources/assets/gtcore/models/block/cover/redstone_torch.json new file mode 100644 index 0000000..a19b836 --- /dev/null +++ b/common/src/main/resources/assets/gtcore/models/block/cover/redstone_torch.json @@ -0,0 +1,22 @@ +{ + "credit": "Made with Blockbench", + "elements": [ + { + "from": [7, 7, 16], + "to": [9, 9, 16], + "faces": { + "south": {"uv": [7, 7, 9, 9], "texture": "#overlay"} + } + }, + { + "from": [7, 7, 10], + "to": [9, 9, 16], + "faces": { + "east": {"uv": [7, 7, 9, 13], "texture": "#overlay"}, + "west": {"uv": [7, 7, 9, 13], "texture": "#overlay"}, + "up": {"uv": [7, 7, 9, 13], "texture": "#overlay"}, + "down": {"uv": [7, 7, 9, 13], "texture": "#overlay"} + } + } + ] +} \ No newline at end of file diff --git a/common/src/main/resources/assets/gtcore/textures/block/cover/redstone_torch_off.png b/common/src/main/resources/assets/gtcore/textures/block/cover/redstone_torch_off.png new file mode 100644 index 0000000000000000000000000000000000000000..cd82b6414b7e6ba25c0f242586bc18ac7bebcc4e GIT binary patch literal 135 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`ex5FlAr_~T6C_xhWm*gk{(NUh z+QiF{d2Pv&hM!*<{}&%Vd%`>+Yvt|#0pYf%VjiTda+%2}va=yczk%t(HHT?N`Vp@^ igP$=K>lW?-8hd|-%Fgn)dcHuD89ZJ6T-G@yGywn~nlHZq literal 0 HcmV?d00001 diff --git a/common/src/main/resources/assets/gtcore/textures/block/cover/redstone_torch_on.png b/common/src/main/resources/assets/gtcore/textures/block/cover/redstone_torch_on.png new file mode 100644 index 0000000000000000000000000000000000000000..d49a7a9d6f13ba7d0d3b9ce658bca4fb9181c2cf GIT binary patch literal 146 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`k)AG&Ar_~T6C_x-u+~dT{A)J2 zIqUy@hDUWqyo}Nx>VMS>EI1+h`s7s}reN>8|JrxGnwWp!&##96e#^Y3NIFd9*7)X> ux8r7gG;`#sJqc^oeP?o?*?Q!o6a&LQU-PrUn^u4AUBNw literal 0 HcmV?d00001