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) {
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);
}
}

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);
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();

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){
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));
}
}