use of gregtech.blocks.tool.BlockLongDistPipe in project gregtech6 by GregTech6.
the class MultiTileEntityLongDistancePipelineItem method scanPipes.
private void scanPipes() {
if (mSender != null && !mSender.isDead() && mSender.mTarget == this)
return;
mIgnoreUnloadedChunks = F;
mTargetPos = getCoords();
mTarget = this;
mSender = null;
Block aBlock = getBlockAtSide(OPOS[mFacing]);
byte aMetaData = getMetaDataAtSide(OPOS[mFacing]);
if (aBlock instanceof BlockLongDistPipe) {
if (((BlockLongDistPipe) aBlock).mTemperatures[aMetaData] >= 0)
return;
HashSetNoNulls<ChunkCoordinates> tNewChecks = new HashSetNoNulls<>(), tOldChecks = new HashSetNoNulls<>(F, getCoords()), tToCheck = new HashSetNoNulls<>(F, getOffsetN(mFacing, 1)), tWires = new HashSetNoNulls<>();
while (!tToCheck.isEmpty()) {
for (ChunkCoordinates aCoords : tToCheck) {
if (getBlock(aCoords) == aBlock && getMetaData(aCoords) == aMetaData) {
tWires.add(aCoords);
ChunkCoordinates tCoords;
if (tOldChecks.add(tCoords = new ChunkCoordinates(aCoords.posX + 1, aCoords.posY, aCoords.posZ)))
tNewChecks.add(tCoords);
if (tOldChecks.add(tCoords = new ChunkCoordinates(aCoords.posX - 1, aCoords.posY, aCoords.posZ)))
tNewChecks.add(tCoords);
if (tOldChecks.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY + 1, aCoords.posZ)))
tNewChecks.add(tCoords);
if (tOldChecks.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY - 1, aCoords.posZ)))
tNewChecks.add(tCoords);
if (tOldChecks.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY, aCoords.posZ + 1)))
tNewChecks.add(tCoords);
if (tOldChecks.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY, aCoords.posZ - 1)))
tNewChecks.add(tCoords);
} else {
TileEntity tTileEntity = getTileEntity(aCoords);
if (tTileEntity != this && tTileEntity instanceof MultiTileEntityLongDistancePipelineItem) {
if (tWires.contains(((MultiTileEntityLongDistancePipelineItem) tTileEntity).getOffset(((MultiTileEntityLongDistancePipelineItem) tTileEntity).mFacing, 1))) {
mTarget = (MultiTileEntityLongDistancePipelineItem) tTileEntity;
mTargetPos = mTarget.getCoords();
mIgnoreUnloadedChunks = T;
return;
}
tOldChecks.remove(aCoords);
}
}
}
tToCheck.clear();
tToCheck.addAll(tNewChecks);
tNewChecks.clear();
}
}
mIgnoreUnloadedChunks = T;
}
use of gregtech.blocks.tool.BlockLongDistPipe in project gregtech6 by GregTech6.
the class MultiTileEntityLongDistancePipelineFluid method scanPipes.
private void scanPipes() {
if (mSender != null && !mSender.isDead() && mSender.mTarget == this)
return;
mIgnoreUnloadedChunks = F;
mTargetPos = getCoords();
mTarget = this;
mSender = null;
mTemperature = 0;
Block aBlock = getBlockAtSide(OPOS[mFacing]);
byte aMetaData = getMetaDataAtSide(OPOS[mFacing]);
if (aBlock instanceof BlockLongDistPipe) {
mTemperature = ((BlockLongDistPipe) aBlock).mTemperatures[aMetaData];
if (mTemperature <= 0)
return;
HashSetNoNulls<ChunkCoordinates> tNewChecks = new HashSetNoNulls<>(), tOldChecks = new HashSetNoNulls<>(F, getCoords()), tToCheck = new HashSetNoNulls<>(F, getOffsetN(mFacing, 1)), tWires = new HashSetNoNulls<>();
while (!tToCheck.isEmpty()) {
for (ChunkCoordinates aCoords : tToCheck) {
if (getBlock(aCoords) == aBlock && getMetaData(aCoords) == aMetaData) {
tWires.add(aCoords);
ChunkCoordinates tCoords;
if (tOldChecks.add(tCoords = new ChunkCoordinates(aCoords.posX + 1, aCoords.posY, aCoords.posZ)))
tNewChecks.add(tCoords);
if (tOldChecks.add(tCoords = new ChunkCoordinates(aCoords.posX - 1, aCoords.posY, aCoords.posZ)))
tNewChecks.add(tCoords);
if (tOldChecks.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY + 1, aCoords.posZ)))
tNewChecks.add(tCoords);
if (tOldChecks.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY - 1, aCoords.posZ)))
tNewChecks.add(tCoords);
if (tOldChecks.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY, aCoords.posZ + 1)))
tNewChecks.add(tCoords);
if (tOldChecks.add(tCoords = new ChunkCoordinates(aCoords.posX, aCoords.posY, aCoords.posZ - 1)))
tNewChecks.add(tCoords);
} else {
TileEntity tTileEntity = getTileEntity(aCoords);
if (tTileEntity != this && tTileEntity instanceof MultiTileEntityLongDistancePipelineFluid) {
if (tWires.contains(((MultiTileEntityLongDistancePipelineFluid) tTileEntity).getOffset(((MultiTileEntityLongDistancePipelineFluid) tTileEntity).mFacing, 1))) {
mTarget = (MultiTileEntityLongDistancePipelineFluid) tTileEntity;
mTargetPos = mTarget.getCoords();
mIgnoreUnloadedChunks = T;
return;
}
tOldChecks.remove(aCoords);
}
}
}
tToCheck.clear();
tToCheck.addAll(tNewChecks);
tNewChecks.clear();
}
}
mIgnoreUnloadedChunks = T;
}
Aggregations