From e9e88db6dda1db98957f322f15cb75c11300fe58 Mon Sep 17 00:00:00 2001 From: Antifluxfield Date: Mon, 13 Nov 2017 14:31:56 +0800 Subject: [PATCH] Make the cross show which direction the pipe is connecting with --- .../api/metatileentity/MetaPipeEntity.java | 24 ++-- src/main/java/gregtech/common/GT_Client.java | 123 ++++++++++-------- .../preload/GT_Loader_MetaTileEntities.java | 4 +- 3 files changed, 78 insertions(+), 73 deletions(-) diff --git a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java index ab862318..9e4a79be 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java @@ -708,13 +708,11 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { public int connect(byte aSide) { if (aSide >= 6) return 0; mConnections |= (1 << aSide); - if (GT_Mod.gregtechproxy.gt6Pipe) { - byte tSide = GT_Utility.getOppositeSide(aSide); - IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSide(aSide); - IMetaTileEntity tPipe = tTileEntity instanceof IGregTechTileEntity ? ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() : null; - if (this.getClass().isInstance(tPipe) && (((MetaPipeEntity) tPipe).mConnections & (1 << tSide)) == 0) - ((MetaPipeEntity) tPipe).connect(tSide); - } + byte tSide = GT_Utility.getOppositeSide(aSide); + IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSide(aSide); + IMetaTileEntity tPipe = tTileEntity instanceof IGregTechTileEntity ? ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() : null; + if (this.getClass().isInstance(tPipe) && (((MetaPipeEntity) tPipe).mConnections & (1 << tSide)) == 0) + ((MetaPipeEntity) tPipe).connect(tSide); return 1; } @@ -722,12 +720,10 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { public void disconnect(byte aSide) { if (aSide >= 6) return; mConnections &= ~(1 << aSide); - if (GT_Mod.gregtechproxy.gt6Pipe) { - byte tSide = GT_Utility.getOppositeSide(aSide); - IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSide(aSide); - IMetaTileEntity tPipe = tTileEntity == null ? null : tTileEntity.getMetaTileEntity(); - if (this.getClass().isInstance(tPipe) && (((MetaPipeEntity) tPipe).mConnections & (1 << tSide)) != 0) - ((MetaPipeEntity) tPipe).disconnect(tSide); - } + byte tSide = GT_Utility.getOppositeSide(aSide); + IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSide(aSide); + IMetaTileEntity tPipe = tTileEntity == null ? null : tTileEntity.getMetaTileEntity(); + if (this.getClass().isInstance(tPipe) && (((MetaPipeEntity) tPipe).mConnections & (1 << tSide)) != 0) + ((MetaPipeEntity) tPipe).disconnect(tSide); } } \ No newline at end of file diff --git a/src/main/java/gregtech/common/GT_Client.java b/src/main/java/gregtech/common/GT_Client.java index 41efcd81..48713f92 100644 --- a/src/main/java/gregtech/common/GT_Client.java +++ b/src/main/java/gregtech/common/GT_Client.java @@ -145,63 +145,72 @@ public class GT_Client extends GT_Proxy GL11.glVertex3d(+.25D, .0D, +.50D); GL11.glVertex3d(-.25D, .0D, -.50D); GL11.glVertex3d(-.25D, .0D, +.50D); - int[][] GridSwitchArr = new int[][]{ - {0, 5, 3, 1, 2, 4}, - {5, 0, 1, 3, 2, 4}, - {1, 3, 0, 5, 2, 4}, - {3, 1, 5, 0, 2, 4}, - {4, 2, 3, 1, 0, 5}, - {2, 4, 3, 1, 5, 0}, - }; - switch (GridSwitchArr[aEvent.target.sideHit][GT_Utility.determineWrenchingSide((byte) aEvent.target.sideHit, (float) aEvent.target.hitVec.xCoord - (float) aEvent.target.blockX, (float) aEvent.target.hitVec.yCoord - (float) aEvent.target.blockY, (float) aEvent.target.hitVec.zCoord - (float) aEvent.target.blockZ)]) { - case 0: - GL11.glVertex3d(+.25D, .0D, +.25D); - GL11.glVertex3d(-.25D, .0D, -.25D); - GL11.glVertex3d(-.25D, .0D, +.25D); - GL11.glVertex3d(+.25D, .0D, -.25D); - break; - case 1: - GL11.glVertex3d(-.25D, .0D, +.50D); - GL11.glVertex3d(+.25D, .0D, +.25D); - GL11.glVertex3d(-.25D, .0D, +.25D); - GL11.glVertex3d(+.25D, .0D, +.50D); - break; - case 2: - GL11.glVertex3d(-.50D, .0D, -.25D); - GL11.glVertex3d(-.25D, .0D, +.25D); - GL11.glVertex3d(-.50D, .0D, +.25D); - GL11.glVertex3d(-.25D, .0D, -.25D); - break; - case 3: - GL11.glVertex3d(-.25D, .0D, -.50D); - GL11.glVertex3d(+.25D, .0D, -.25D); - GL11.glVertex3d(-.25D, .0D, -.25D); - GL11.glVertex3d(+.25D, .0D, -.50D); - break; - case 4: - GL11.glVertex3d(+.50D, .0D, -.25D); - GL11.glVertex3d(+.25D, .0D, +.25D); - GL11.glVertex3d(+.50D, .0D, +.25D); - GL11.glVertex3d(+.25D, .0D, -.25D); - break; - case 5: - GL11.glVertex3d(+.50D, .0D, +.50D); - GL11.glVertex3d(+.25D, .0D, +.25D); - GL11.glVertex3d(+.50D, .0D, +.25D); - GL11.glVertex3d(+.25D, .0D, +.50D); - GL11.glVertex3d(+.50D, .0D, -.50D); - GL11.glVertex3d(+.25D, .0D, -.25D); - GL11.glVertex3d(+.50D, .0D, -.25D); - GL11.glVertex3d(+.25D, .0D, -.50D); - GL11.glVertex3d(-.50D, .0D, +.50D); - GL11.glVertex3d(-.25D, .0D, +.25D); - GL11.glVertex3d(-.50D, .0D, +.25D); - GL11.glVertex3d(-.25D, .0D, +.50D); - GL11.glVertex3d(-.50D, .0D, -.50D); - GL11.glVertex3d(-.25D, .0D, -.25D); - GL11.glVertex3d(-.50D, .0D, -.25D); - GL11.glVertex3d(-.25D, .0D, -.50D); - break; + GL11.glLineWidth(2.0F); + TileEntity tTile = aEvent.player.worldObj.getTileEntity(aEvent.target.blockX, aEvent.target.blockY, aEvent.target.blockZ); + if (tTile instanceof BaseMetaPipeEntity) { + int[][] GridSwitchArr = new int[][]{ + {0, 5, 3, 1, 2, 4}, + {5, 0, 1, 3, 2, 4}, + {1, 3, 0, 5, 2, 4}, + {3, 1, 5, 0, 2, 4}, + {4, 2, 3, 1, 0, 5}, + {2, 4, 3, 1, 5, 0}, + }; + int tConnections = ((BaseMetaPipeEntity) tTile).mConnections; + for (byte i = 0; i < 6; i++) { + if ((tConnections & (1 << i)) != 0) { + switch (GridSwitchArr[aEvent.target.sideHit][i]) { + case 0: + GL11.glVertex3d(+.25D, .0D, +.25D); + GL11.glVertex3d(-.25D, .0D, -.25D); + GL11.glVertex3d(-.25D, .0D, +.25D); + GL11.glVertex3d(+.25D, .0D, -.25D); + break; + case 1: + GL11.glVertex3d(-.25D, .0D, +.50D); + GL11.glVertex3d(+.25D, .0D, +.25D); + GL11.glVertex3d(-.25D, .0D, +.25D); + GL11.glVertex3d(+.25D, .0D, +.50D); + break; + case 2: + GL11.glVertex3d(-.50D, .0D, -.25D); + GL11.glVertex3d(-.25D, .0D, +.25D); + GL11.glVertex3d(-.50D, .0D, +.25D); + GL11.glVertex3d(-.25D, .0D, -.25D); + break; + case 3: + GL11.glVertex3d(-.25D, .0D, -.50D); + GL11.glVertex3d(+.25D, .0D, -.25D); + GL11.glVertex3d(-.25D, .0D, -.25D); + GL11.glVertex3d(+.25D, .0D, -.50D); + break; + case 4: + GL11.glVertex3d(+.50D, .0D, -.25D); + GL11.glVertex3d(+.25D, .0D, +.25D); + GL11.glVertex3d(+.50D, .0D, +.25D); + GL11.glVertex3d(+.25D, .0D, -.25D); + break; + case 5: + GL11.glVertex3d(+.50D, .0D, +.50D); + GL11.glVertex3d(+.25D, .0D, +.25D); + GL11.glVertex3d(+.50D, .0D, +.25D); + GL11.glVertex3d(+.25D, .0D, +.50D); + GL11.glVertex3d(+.50D, .0D, -.50D); + GL11.glVertex3d(+.25D, .0D, -.25D); + GL11.glVertex3d(+.50D, .0D, -.25D); + GL11.glVertex3d(+.25D, .0D, -.50D); + GL11.glVertex3d(-.50D, .0D, +.50D); + GL11.glVertex3d(-.25D, .0D, +.25D); + GL11.glVertex3d(-.50D, .0D, +.25D); + GL11.glVertex3d(-.25D, .0D, +.50D); + GL11.glVertex3d(-.50D, .0D, -.50D); + GL11.glVertex3d(-.25D, .0D, -.25D); + GL11.glVertex3d(-.50D, .0D, -.25D); + GL11.glVertex3d(-.25D, .0D, -.50D); + break; + } + } + } } GL11.glEnd(); GL11.glPopMatrix(); diff --git a/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java b/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java index d0e6b431..872a2e40 100644 --- a/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java +++ b/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java @@ -1659,7 +1659,7 @@ public class GT_Loader_MetaTileEntities implements Runnable { } private static void generateFluidMultiPipes(Materials aMaterial, String name, String displayName, int startID, int baseCapacity, int heatCapacity, boolean gasProof){ - GT_OreDictUnificator.registerOre(OrePrefixes.pipeQuadruple.get(aMaterial), new GT_MetaPipeEntity_Fluid(startID, "GT_Pipe_" + name + "_Quadruple", "Quadruple " + displayName + " Fluid Pipe", 0.875F, aMaterial, baseCapacity, heatCapacity, gasProof, 4).getStackForm(1L)); - GT_OreDictUnificator.registerOre(OrePrefixes.pipeNonuple.get(aMaterial), new GT_MetaPipeEntity_Fluid(startID + 1, "GT_Pipe_" + name + "_Nonuple", "Nonuple " + displayName + " Fluid Pipe", 0.875F, aMaterial, baseCapacity / 3, heatCapacity, gasProof, 9).getStackForm(1L)); + GT_OreDictUnificator.registerOre(OrePrefixes.pipeQuadruple.get(aMaterial), new GT_MetaPipeEntity_Fluid(startID, "GT_Pipe_" + name + "_Quadruple", "Quadruple " + displayName + " Fluid Pipe", 1.0F, aMaterial, baseCapacity, heatCapacity, gasProof, 4).getStackForm(1L)); + GT_OreDictUnificator.registerOre(OrePrefixes.pipeNonuple.get(aMaterial), new GT_MetaPipeEntity_Fluid(startID + 1, "GT_Pipe_" + name + "_Nonuple", "Nonuple " + displayName + " Fluid Pipe", 1.0F, aMaterial, baseCapacity / 3, heatCapacity, gasProof, 9).getStackForm(1L)); } }