diff options
author | Jason Mitchell <mitchej@gmail.com> | 2023-04-22 22:33:35 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-23 07:33:35 +0200 |
commit | 56f2269f4af6d2130bdb2b6e6ac6e13bce89e47b (patch) | |
tree | 745e6d92025ec4ef449fc59fa5fdd741200b0489 /src/main/java/gregtech/api/threads | |
parent | ac0b7a7da46646d325def36eed811941dbfc5950 (diff) | |
download | GT5-Unofficial-56f2269f4af6d2130bdb2b6e6ac6e13bce89e47b.tar.gz GT5-Unofficial-56f2269f4af6d2130bdb2b6e6ac6e13bce89e47b.tar.bz2 GT5-Unofficial-56f2269f4af6d2130bdb2b6e6ac6e13bce89e47b.zip |
Forge direction (#1895)
* ForgeDirection
Also refactor the clusterfuck that was `getCoordinateScan`
Co-authored by: Jason Mitchell <mitchej@gmail.com>
* 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 <lea.gris@noiraude.net>
Diffstat (limited to 'src/main/java/gregtech/api/threads')
-rw-r--r-- | src/main/java/gregtech/api/threads/GT_Runnable_Cable_Update.java | 18 |
1 files changed, 7 insertions, 11 deletions
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); } } |