Make the cross show which direction the pipe is connecting with

This commit is contained in:
Antifluxfield 2017-11-13 14:31:56 +08:00
parent 51334d19db
commit e9e88db6dd
3 changed files with 78 additions and 73 deletions

View file

@ -708,13 +708,11 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable {
public int connect(byte aSide) { public int connect(byte aSide) {
if (aSide >= 6) return 0; if (aSide >= 6) return 0;
mConnections |= (1 << aSide); mConnections |= (1 << aSide);
if (GT_Mod.gregtechproxy.gt6Pipe) { byte tSide = GT_Utility.getOppositeSide(aSide);
byte tSide = GT_Utility.getOppositeSide(aSide); IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSide(aSide);
IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSide(aSide); IMetaTileEntity tPipe = tTileEntity instanceof IGregTechTileEntity ? ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() : null;
IMetaTileEntity tPipe = tTileEntity instanceof IGregTechTileEntity ? ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() : null; if (this.getClass().isInstance(tPipe) && (((MetaPipeEntity) tPipe).mConnections & (1 << tSide)) == 0)
if (this.getClass().isInstance(tPipe) && (((MetaPipeEntity) tPipe).mConnections & (1 << tSide)) == 0) ((MetaPipeEntity) tPipe).connect(tSide);
((MetaPipeEntity) tPipe).connect(tSide);
}
return 1; return 1;
} }
@ -722,12 +720,10 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable {
public void disconnect(byte aSide) { public void disconnect(byte aSide) {
if (aSide >= 6) return; if (aSide >= 6) return;
mConnections &= ~(1 << aSide); mConnections &= ~(1 << aSide);
if (GT_Mod.gregtechproxy.gt6Pipe) { byte tSide = GT_Utility.getOppositeSide(aSide);
byte tSide = GT_Utility.getOppositeSide(aSide); IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSide(aSide);
IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSide(aSide); IMetaTileEntity tPipe = tTileEntity == null ? null : tTileEntity.getMetaTileEntity();
IMetaTileEntity tPipe = tTileEntity == null ? null : tTileEntity.getMetaTileEntity(); if (this.getClass().isInstance(tPipe) && (((MetaPipeEntity) tPipe).mConnections & (1 << tSide)) != 0)
if (this.getClass().isInstance(tPipe) && (((MetaPipeEntity) tPipe).mConnections & (1 << tSide)) != 0) ((MetaPipeEntity) tPipe).disconnect(tSide);
((MetaPipeEntity) tPipe).disconnect(tSide);
}
} }
} }

View file

@ -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); GL11.glVertex3d(-.25D, .0D, -.50D);
GL11.glVertex3d(-.25D, .0D, +.50D); GL11.glVertex3d(-.25D, .0D, +.50D);
int[][] GridSwitchArr = new int[][]{ GL11.glLineWidth(2.0F);
{0, 5, 3, 1, 2, 4}, TileEntity tTile = aEvent.player.worldObj.getTileEntity(aEvent.target.blockX, aEvent.target.blockY, aEvent.target.blockZ);
{5, 0, 1, 3, 2, 4}, if (tTile instanceof BaseMetaPipeEntity) {
{1, 3, 0, 5, 2, 4}, int[][] GridSwitchArr = new int[][]{
{3, 1, 5, 0, 2, 4}, {0, 5, 3, 1, 2, 4},
{4, 2, 3, 1, 0, 5}, {5, 0, 1, 3, 2, 4},
{2, 4, 3, 1, 5, 0}, {1, 3, 0, 5, 2, 4},
}; {3, 1, 5, 0, 2, 4},
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)]) { {4, 2, 3, 1, 0, 5},
case 0: {2, 4, 3, 1, 5, 0},
GL11.glVertex3d(+.25D, .0D, +.25D); };
GL11.glVertex3d(-.25D, .0D, -.25D); int tConnections = ((BaseMetaPipeEntity) tTile).mConnections;
GL11.glVertex3d(-.25D, .0D, +.25D); for (byte i = 0; i < 6; i++) {
GL11.glVertex3d(+.25D, .0D, -.25D); if ((tConnections & (1 << i)) != 0) {
break; switch (GridSwitchArr[aEvent.target.sideHit][i]) {
case 1: case 0:
GL11.glVertex3d(-.25D, .0D, +.50D); GL11.glVertex3d(+.25D, .0D, +.25D);
GL11.glVertex3d(+.25D, .0D, +.25D); GL11.glVertex3d(-.25D, .0D, -.25D);
GL11.glVertex3d(-.25D, .0D, +.25D); GL11.glVertex3d(-.25D, .0D, +.25D);
GL11.glVertex3d(+.25D, .0D, +.50D); GL11.glVertex3d(+.25D, .0D, -.25D);
break; break;
case 2: case 1:
GL11.glVertex3d(-.50D, .0D, -.25D); GL11.glVertex3d(-.25D, .0D, +.50D);
GL11.glVertex3d(-.25D, .0D, +.25D); GL11.glVertex3d(+.25D, .0D, +.25D);
GL11.glVertex3d(-.50D, .0D, +.25D); GL11.glVertex3d(-.25D, .0D, +.25D);
GL11.glVertex3d(-.25D, .0D, -.25D); GL11.glVertex3d(+.25D, .0D, +.50D);
break; break;
case 3: case 2:
GL11.glVertex3d(-.25D, .0D, -.50D); GL11.glVertex3d(-.50D, .0D, -.25D);
GL11.glVertex3d(+.25D, .0D, -.25D); GL11.glVertex3d(-.25D, .0D, +.25D);
GL11.glVertex3d(-.25D, .0D, -.25D); GL11.glVertex3d(-.50D, .0D, +.25D);
GL11.glVertex3d(+.25D, .0D, -.50D); GL11.glVertex3d(-.25D, .0D, -.25D);
break; break;
case 4: case 3:
GL11.glVertex3d(+.50D, .0D, -.25D); GL11.glVertex3d(-.25D, .0D, -.50D);
GL11.glVertex3d(+.25D, .0D, +.25D); GL11.glVertex3d(+.25D, .0D, -.25D);
GL11.glVertex3d(+.50D, .0D, +.25D); GL11.glVertex3d(-.25D, .0D, -.25D);
GL11.glVertex3d(+.25D, .0D, -.25D); GL11.glVertex3d(+.25D, .0D, -.50D);
break; break;
case 5: case 4:
GL11.glVertex3d(+.50D, .0D, +.50D); GL11.glVertex3d(+.50D, .0D, -.25D);
GL11.glVertex3d(+.25D, .0D, +.25D); GL11.glVertex3d(+.25D, .0D, +.25D);
GL11.glVertex3d(+.50D, .0D, +.25D); GL11.glVertex3d(+.50D, .0D, +.25D);
GL11.glVertex3d(+.25D, .0D, +.50D); GL11.glVertex3d(+.25D, .0D, -.25D);
GL11.glVertex3d(+.50D, .0D, -.50D); break;
GL11.glVertex3d(+.25D, .0D, -.25D); case 5:
GL11.glVertex3d(+.50D, .0D, -.25D); GL11.glVertex3d(+.50D, .0D, +.50D);
GL11.glVertex3d(+.25D, .0D, -.50D); GL11.glVertex3d(+.25D, .0D, +.25D);
GL11.glVertex3d(-.50D, .0D, +.50D); GL11.glVertex3d(+.50D, .0D, +.25D);
GL11.glVertex3d(-.25D, .0D, +.25D); GL11.glVertex3d(+.25D, .0D, +.50D);
GL11.glVertex3d(-.50D, .0D, +.25D); GL11.glVertex3d(+.50D, .0D, -.50D);
GL11.glVertex3d(-.25D, .0D, +.50D); GL11.glVertex3d(+.25D, .0D, -.25D);
GL11.glVertex3d(-.50D, .0D, -.50D); GL11.glVertex3d(+.50D, .0D, -.25D);
GL11.glVertex3d(-.25D, .0D, -.25D); GL11.glVertex3d(+.25D, .0D, -.50D);
GL11.glVertex3d(-.50D, .0D, -.25D); GL11.glVertex3d(-.50D, .0D, +.50D);
GL11.glVertex3d(-.25D, .0D, -.50D); GL11.glVertex3d(-.25D, .0D, +.25D);
break; 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.glEnd();
GL11.glPopMatrix(); GL11.glPopMatrix();

View file

@ -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){ 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.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", 0.875F, aMaterial, baseCapacity / 3, heatCapacity, gasProof, 9).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));
} }
} }