Last active
December 15, 2015 19:49
-
-
Save magnifikus/5314314 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void checkConnections() { | |
for (int i = 0; i < 6; i++) { | |
if (i == this.side.ordinal() || i == this.side.getOpposite().ordinal()) | |
continue; | |
ForgeDirection sideC = ForgeDirection.getOrientation(i); | |
TileEntity te = base.worldObj.getBlockTileEntity(base.xCoord+sideC.offsetX, | |
base.yCoord+sideC.offsetY,base.zCoord+sideC.offsetZ); | |
// check internal conn | |
TileSeptonPart tsp = base.getParts()[sideC.ordinal()]; | |
if (tsp != null) { | |
if (tsp instanceof SeptonBusWire) { | |
SeptonBusWire sbw = (SeptonBusWire) tsp; | |
sbw.connectTo(this.side, SeptonBusWire.ConnMode.Internal); | |
connectTo(sideC, SeptonBusWire.ConnMode.Internal); | |
continue; | |
} | |
} | |
// check direct conn | |
if (te instanceof TileSepton) { | |
TileSeptonPart sp = ((TileSepton) te).getParts()[this.side.ordinal()]; | |
if (sp instanceof SeptonBusWire) { | |
((SeptonBusWire) sp).connectTo(sideC.getOpposite(), SeptonBusWire.ConnMode.External); | |
connectTo(sideC, SeptonBusWire.ConnMode.External); | |
continue; | |
} | |
} | |
// check edgeConn | |
int bidO = base.worldObj.getBlockId(base.xCoord+sideC.offsetX, | |
base.yCoord+sideC.offsetY,base.zCoord+sideC.offsetZ); | |
if (bidO == 0) { | |
te = base.worldObj.getBlockTileEntity( | |
base.xCoord + sideC.offsetX + this.side.offsetX, | |
base.yCoord + sideC.offsetY + this.side.offsetY, | |
base.zCoord + sideC.offsetZ + this.side.offsetZ); | |
if (te instanceof TileSepton) { | |
TileSeptonPart sp = ((TileSepton) te).getParts()[sideC.getOpposite().ordinal()]; | |
if (sp instanceof SeptonBusWire) { | |
((SeptonBusWire) sp).connectTo(this.side.getOpposite(), SeptonBusWire.ConnMode.ExternalEdge); | |
connectTo(sideC, SeptonBusWire.ConnMode.ExternalEdge); | |
continue; | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment