From 56f2269f4af6d2130bdb2b6e6ac6e13bce89e47b Mon Sep 17 00:00:00 2001 From: Jason Mitchell Date: Sat, 22 Apr 2023 22:33:35 -0700 Subject: Forge direction (#1895) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ForgeDirection Also refactor the clusterfuck that was `getCoordinateScan` Co-authored by: Jason Mitchell * Fix rendering of Frame Boxes Frame boxes needed their own implementation of getTexture with int connexion mask, which is returning an error texture for the MetaTileEntity, because pipes (FrameBox **is** a pipe) do use this method to return different textures based on connexion status. --------- Co-authored-by: Léa Gris --- .../gregtech/api/threads/GT_Runnable_Cable_Update.java | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'src/main/java/gregtech/api/threads') diff --git a/src/main/java/gregtech/api/threads/GT_Runnable_Cable_Update.java b/src/main/java/gregtech/api/threads/GT_Runnable_Cable_Update.java index c670307b5d..31c3c56aa8 100644 --- a/src/main/java/gregtech/api/threads/GT_Runnable_Cable_Update.java +++ b/src/main/java/gregtech/api/threads/GT_Runnable_Cable_Update.java @@ -1,7 +1,5 @@ package gregtech.api.threads; -import static gregtech.api.enums.GT_Values.ALL_VALID_SIDES; - import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChunkCoordinates; import net.minecraft.world.World; @@ -51,18 +49,16 @@ public class GT_Runnable_Cable_Update extends GT_Runnable_MachineBlockUpdate { // Now see if we should add the nearby blocks to the queue: // only add blocks the cable is connected to - if (tTileEntity instanceof BaseMetaPipeEntity - && ((BaseMetaPipeEntity) tTileEntity).getMetaTileEntity() instanceof GT_MetaPipeEntity_Cable) { + if (tTileEntity instanceof BaseMetaPipeEntity metaPipe + && metaPipe.getMetaTileEntity() instanceof GT_MetaPipeEntity_Cable cable) { ChunkCoordinates tCoords; - for (byte tSide : ALL_VALID_SIDES) { - if (((GT_MetaPipeEntity_Cable) ((BaseMetaPipeEntity) tTileEntity).getMetaTileEntity()) - .isConnectedAtSide(tSide)) { - final ForgeDirection offset = ForgeDirection.getOrientation(tSide); + for (final ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { + if (cable.isConnectedAtSide(side)) { if (visited.add( tCoords = new ChunkCoordinates( - aCoords.posX + offset.offsetX, - aCoords.posY + offset.offsetY, - aCoords.posZ + offset.offsetZ))) + aCoords.posX + side.offsetX, + aCoords.posY + side.offsetY, + aCoords.posZ + side.offsetZ))) tQueue.add(tCoords); } } -- cgit