use of gregtech.api.pipenet.tile.IPipeTile 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());
}
}
}
}
}
Aggregations