Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
more work on redstone torch covers
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed Jun 9, 2024
1 parent 8bcf964 commit 2337094
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand All @@ -35,4 +44,10 @@ public int getWeakPower() {
BlockEntityRedstoneWire<?> wire = (BlockEntityRedstoneWire<?>) source().getTile();
return wire.getRedstoneValue() > 0 ? 0 : 15;
}

@Override
public void setTextures(BiConsumer<String, Texture> texer) {
BlockEntityRedstoneWire<?> wire = (BlockEntityRedstoneWire<?>) source().getTile();
texer.accept("overlay", factory.getTextures().get(wire.getRedstoneValue() > 0 ? 0 : 1));
}
}
Original file line number Diff line number Diff line change
@@ -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(){}
}
Original file line number Diff line number Diff line change
@@ -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"}
}
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2337094

Please sign in to comment.