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

Commit

Permalink
added rudimentory sunctionality to selector tag covers
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed Jul 6, 2024
1 parent f3e293b commit 36e35db
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> getInfo(boolean simple) {
List<String> info = super.getInfo(simple);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down

0 comments on commit 36e35db

Please sign in to comment.