}
int metadata = world.getBlockMetadata(x, y, z);
TileEntity te = world.getTileEntity(x, y, z);
IMultiblockPart part = null;
MultiblockControllerBase controller = null;
if(te instanceof IMultiblockPart) {
part = (IMultiblockPart)te;
controller = part.getMultiblockController();
}
if(isCasing(metadata) || isPowerTap(metadata) || isComputerPort(metadata)) {
// If the player's hands are empty and they rightclick on a multiblock, they get a
// multiblock-debugging message if the machine is not assembled.
if(player.getCurrentEquippedItem() == null) {
if(controller != null) {
Exception e = controller.getLastValidationException();
if(e != null) {
player.addChatMessage(new ChatComponentText(e.getMessage()));
return true;
}
}
else {
player.addChatMessage(new ChatComponentText("Block is not connected to a reactor. This could be due to lag, or a bug. If the problem persists, try breaking and re-placing the block.")); //TODO Localize
return true;
}
}
// If nonempty, or there was no error, just fall through
return false;
}
// Do toggly fiddly things for access/coolant ports
if(!world.isRemote && (isAccessPort(metadata) || isCoolantPort(metadata))) {
if(StaticUtils.Inventory.isPlayerHoldingWrench(player)) {
if(te instanceof TileEntityReactorCoolantPort) {
TileEntityReactorCoolantPort cp = (TileEntityReactorCoolantPort)te;
cp.setInlet(!cp.isInlet(), true);
return true;
}
else if(te instanceof TileEntityReactorAccessPort) {
TileEntityReactorAccessPort cp = (TileEntityReactorAccessPort)te;
cp.setInlet(!cp.isInlet());
return true;
}
}
else if(isCoolantPort(metadata)) {
return false;
}
}
// Don't open the controller GUI if the reactor isn't assembled
if(isController(metadata) && (controller == null || !controller.isAssembled())) { return false; }
if(!world.isRemote) {
player.openGui(BRLoader.instance, 0, world, x, y, z);
}
return true;