use of gregtech.common.pipelike.fluidpipe.tile.TileEntityFluidPipeTickable in project GregTech by GregTechCE.
the class DebugPipeNetInfoProvider method addProbeInfo.
@Override
public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data) {
if (mode == ProbeMode.DEBUG && ConfigHolder.debug) {
TileEntity tileEntity = world.getTileEntity(data.getPos());
if (tileEntity instanceof MetaTileEntityHolder) {
MetaTileEntity metaTileEntity = ((MetaTileEntityHolder) tileEntity).getMetaTileEntity();
if (metaTileEntity != null) {
ArrayList<String> arrayList = new ArrayList<>();
arrayList.add("MetaTileEntity Id: " + metaTileEntity.metaTileEntityId);
metaTileEntity.addDebugInfo(arrayList);
arrayList.forEach(probeInfo::text);
}
}
if (tileEntity instanceof TileEntityPipeBase) {
IPipeTile<?, ?> pipeTile = (IPipeTile<?, ?>) tileEntity;
BlockPipe<?, ?, ?> blockPipe = pipeTile.getPipeBlock();
PipeNet<?> pipeNet = blockPipe.getWorldPipeNet(world).getNetFromPos(data.getPos());
if (pipeNet != null) {
probeInfo.text("Net: " + pipeNet.hashCode());
probeInfo.text("Node Info: ");
StringBuilder builder = new StringBuilder();
Map<BlockPos, ? extends Node<?>> nodeMap = pipeNet.getAllNodes();
Node<?> node = nodeMap.get(data.getPos());
builder.append("{").append("active: ").append(node.isActive).append(", mark: ").append(node.mark).append(", blocked: ").append(node.blockedConnections).append("}");
probeInfo.text(builder.toString());
}
probeInfo.text("tile blocked: " + pipeTile.getBlockedConnections());
if (blockPipe instanceof BlockFluidPipe) {
if (pipeTile instanceof TileEntityFluidPipeTickable) {
probeInfo.text("tile active: " + ((TileEntityFluidPipeTickable) pipeTile).isActive());
}
}
}
}
}
use of gregtech.common.pipelike.fluidpipe.tile.TileEntityFluidPipeTickable in project GregTech by GregTechCE.
the class BlockFluidPipe method onActiveModeChange.
@Override
protected void onActiveModeChange(World world, BlockPos pos, boolean isActiveNow, boolean isInitialChange) {
TileEntityFluidPipe oldTileEntity = (TileEntityFluidPipe) world.getTileEntity(pos);
if (!(oldTileEntity instanceof TileEntityFluidPipeTickable) && isActiveNow) {
TileEntityFluidPipeTickable newTileEntity = new TileEntityFluidPipeTickable();
newTileEntity.transferDataFrom(oldTileEntity);
newTileEntity.setActive(true);
world.setTileEntity(pos, newTileEntity);
} else if (oldTileEntity instanceof TileEntityFluidPipeTickable) {
((TileEntityFluidPipeTickable) oldTileEntity).setActive(isActiveNow);
}
}
Aggregations