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 --- src/main/java/gregtech/common/GT_Client.java | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src/main/java/gregtech/common/GT_Client.java') diff --git a/src/main/java/gregtech/common/GT_Client.java b/src/main/java/gregtech/common/GT_Client.java index 4ae0204636..5951f95994 100644 --- a/src/main/java/gregtech/common/GT_Client.java +++ b/src/main/java/gregtech/common/GT_Client.java @@ -331,9 +331,9 @@ public class GT_Client extends GT_Proxy implements Runnable { byte tConnections = 0; if (tTile instanceof ICoverable) { if (showCoverConnections) { - for (byte tSide : ALL_VALID_SIDES) { + for (final ForgeDirection tSide : ForgeDirection.VALID_DIRECTIONS) { if (((ICoverable) tTile).getCoverIDAtSide(tSide) > 0) - tConnections = (byte) (tConnections + (1 << tSide)); + tConnections = (byte) (tConnections + (1 << tSide.ordinal())); } } else if (tTile instanceof BaseMetaPipeEntity) tConnections = ((BaseMetaPipeEntity) tTile).mConnections; } @@ -783,7 +783,7 @@ public class GT_Client extends GT_Proxy implements Runnable { || GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sSolderingToolList) || (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sSoftHammerList) && aTileEntity instanceof MultiBlockPart) && aEvent.player.isSneaking()) { - if (((ICoverable) aTileEntity).getCoverIDAtSide((byte) aEvent.target.sideHit) == 0) + if (((ICoverable) aTileEntity).getCoverIDAtSide(ForgeDirection.getOrientation(aEvent.target.sideHit)) == 0) drawGrid(aEvent, false, false, aEvent.player.isSneaking()); return; } @@ -791,21 +791,23 @@ public class GT_Client extends GT_Proxy implements Runnable { if ((aEvent.currentItem == null && aEvent.player.isSneaking()) || GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sCrowbarList) || GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sScrewdriverList)) { - if (((ICoverable) aTileEntity).getCoverIDAtSide((byte) aEvent.target.sideHit) == 0) - for (byte tSide : ALL_VALID_SIDES) if (((ICoverable) aTileEntity).getCoverIDAtSide(tSide) > 0) { - drawGrid(aEvent, true, false, true); - return; + if (((ICoverable) aTileEntity).getCoverIDAtSide(ForgeDirection.getOrientation(aEvent.target.sideHit)) == 0) + for (final ForgeDirection tSide : ForgeDirection.VALID_DIRECTIONS) { + if (((ICoverable) aTileEntity).getCoverIDAtSide(tSide) > 0) { + drawGrid(aEvent, true, false, true); + return; + } } return; } if (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sCovers.keySet())) { - if (((ICoverable) aTileEntity).getCoverIDAtSide((byte) aEvent.target.sideHit) == 0) + if (((ICoverable) aTileEntity).getCoverIDAtSide(ForgeDirection.getOrientation(aEvent.target.sideHit)) == 0) drawGrid(aEvent, true, false, aEvent.player.isSneaking()); } if (GT_Utility.areStacksEqual(ItemList.Tool_Cover_Copy_Paste.get(1), aEvent.currentItem, true)) { - if (((ICoverable) aTileEntity).getCoverIDAtSide((byte) aEvent.target.sideHit) == 0) + if (((ICoverable) aTileEntity).getCoverIDAtSide(ForgeDirection.getOrientation(aEvent.target.sideHit)) == 0) drawGrid(aEvent, true, false, aEvent.player.isSneaking()); } } -- cgit