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);
}
return 1;
}
@ -722,7 +720,6 @@ 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();
@ -730,4 +727,3 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable {
((MetaPipeEntity) tPipe).disconnect(tSide);
}
}
}

View file

@ -145,6 +145,9 @@ public class GT_Client extends GT_Proxy
GL11.glVertex3d(+.25D, .0D, +.50D);
GL11.glVertex3d(-.25D, .0D, -.50D);
GL11.glVertex3d(-.25D, .0D, +.50D);
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},
@ -153,7 +156,10 @@ public class GT_Client extends GT_Proxy
{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)]) {
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);
@ -203,6 +209,9 @@ public class GT_Client extends GT_Proxy
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));
}
}