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

Commit

Permalink
mostly got redstone torch cover working
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed Jun 9, 2024
1 parent 2337094 commit 96b210d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import io.github.gregtechintergalactical.gtcore.block.BlockRedstoneWire;
import io.github.gregtechintergalactical.gtcore.block.RedstoneWire;
import io.github.gregtechintergalactical.gtcore.cover.CoverRedstoneTorch;
import muramasa.antimatter.Antimatter;
import muramasa.antimatter.AntimatterAPI;
import muramasa.antimatter.blockentity.pipe.BlockEntityPipe;
Expand Down Expand Up @@ -43,7 +44,8 @@ public boolean validate(Direction dir) {
public CoverFactory[] getValidCovers() {
return AntimatterAPI.all(CoverFactory.class).stream().filter(t -> {
try {
return !t.get().get(ICoverHandler.empty(this), t.getValidTier(), Direction.SOUTH, t).isNode();
ICover cover = t.get().get(ICoverHandler.empty(this), t.getValidTier(), Direction.SOUTH, t);
return !cover.isNode() || cover instanceof CoverRedstoneTorch;
} catch (Exception ex) {
return false;
}
Expand Down Expand Up @@ -223,6 +225,9 @@ public void load(CompoundTag tag) {
mMode = tag.getByte("mMode");
mReceived = tag.getByte("mReceived");
mConnectedToNonWire = tag.getBoolean("mConnectedToNonWire");
if (this.getLevel() != null && this.isClientSide()){
sidedSync(true);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package io.github.gregtechintergalactical.gtcore.cover;

import io.github.gregtechintergalactical.gtcore.GTCore;
import io.github.gregtechintergalactical.gtcore.blockentity.BlockEntityRedstoneWire;
import muramasa.antimatter.capability.ICoverHandler;
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 net.minecraft.resources.ResourceLocation;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

Expand Down Expand Up @@ -50,4 +52,9 @@ public void setTextures(BiConsumer<String, Texture> texer) {
BlockEntityRedstoneWire<?> wire = (BlockEntityRedstoneWire<?>) source().getTile();
texer.accept("overlay", factory.getTextures().get(wire.getRedstoneValue() > 0 ? 0 : 1));
}

@Override
public ResourceLocation getModel(String type, Direction dir) {
return new ResourceLocation(GTCore.ID + ":block/cover/" + this.getRenderId());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
"from": [7, 7, 16],
"to": [9, 9, 16],
"faces": {
"south": {"uv": [7, 7, 9, 9], "texture": "#overlay"}
"south": {"uv": [7, 6, 9, 8], "texture": "#overlay"}
}
},
{
"from": [7, 7, 10],
"from": [7, 7, 9],
"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"}
"east": {"uv": [7, 6, 9, 13], "rotation": 270, "texture": "#overlay"},
"west": {"uv": [7, 6, 9, 13], "rotation": 90, "texture": "#overlay"},
"up": {"uv": [7, 6, 9, 13], "rotation": 180, "texture": "#overlay"},
"down": {"uv": [7, 6, 9, 13], "texture": "#overlay"}
}
}
]
Expand Down

0 comments on commit 96b210d

Please sign in to comment.