From 4f7f866571caad06e348a085fac476147db90576 Mon Sep 17 00:00:00 2001 From: LemADEC Date: Sat, 13 Aug 2016 11:22:39 +0200 Subject: [PATCH] Refactored tooltip handling --- src/main/java/cr0s/warpdrive/WarpDrive.java | 70 ++++++++----------- .../block/ItemBlockAbstractBase.java | 4 +- .../block/TileEntityAbstractBase.java | 6 ++ .../cr0s/warpdrive/block/TileEntityLaser.java | 10 ++- .../collection/TileEntityLaserTreeFarm.java | 2 + .../collection/TileEntityMiningLaser.java | 2 + .../block/detection/TileEntityCamera.java | 4 +- .../detection/TileEntityCloakingCore.java | 13 ++-- .../block/detection/TileEntityMonitor.java | 5 +- .../TileEntityIC2reactorLaserMonitor.java | 16 +++-- .../TileEntityAbstractForceField.java | 5 +- .../TileEntityForceFieldProjector.java | 1 + .../movement/TileEntityShipController.java | 4 +- .../block/movement/TileEntityShipCore.java | 4 +- .../block/movement/TileEntityTransporter.java | 4 +- .../block/weapon/TileEntityLaserCamera.java | 9 ++- .../weapon/TileEntityWeaponController.java | 7 +- .../cr0s/warpdrive/data/CamerasRegistry.java | 7 +- 18 files changed, 91 insertions(+), 82 deletions(-) diff --git a/src/main/java/cr0s/warpdrive/WarpDrive.java b/src/main/java/cr0s/warpdrive/WarpDrive.java index f4fbe318..90300e36 100644 --- a/src/main/java/cr0s/warpdrive/WarpDrive.java +++ b/src/main/java/cr0s/warpdrive/WarpDrive.java @@ -5,6 +5,7 @@ import java.util.List; import java.util.UUID; import com.mojang.authlib.GameProfile; +import cr0s.warpdrive.block.*; import cr0s.warpdrive.block.forcefield.*; import cr0s.warpdrive.block.hull.BlockHullStairs; import cr0s.warpdrive.item.*; @@ -46,15 +47,6 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLServerStartingEvent; import cpw.mods.fml.common.registry.GameRegistry; -import cr0s.warpdrive.block.BlockAirGenerator; -import cr0s.warpdrive.block.BlockChunkLoader; -import cr0s.warpdrive.block.BlockLaser; -import cr0s.warpdrive.block.BlockLaserMedium; -import cr0s.warpdrive.block.TileEntityAbstractChunkLoading; -import cr0s.warpdrive.block.TileEntityAirGenerator; -import cr0s.warpdrive.block.TileEntityChunkLoader; -import cr0s.warpdrive.block.TileEntityLaser; -import cr0s.warpdrive.block.TileEntityLaserMedium; import cr0s.warpdrive.block.building.BlockShipScanner; import cr0s.warpdrive.block.building.TileEntityShipScanner; import cr0s.warpdrive.block.collection.BlockLaserTreeFarm; @@ -248,158 +240,158 @@ public class WarpDrive implements LoadingCallback { // CORE CONTROLLER blockShipController = new BlockShipController(); - GameRegistry.registerBlock(blockShipController, "blockShipController"); + GameRegistry.registerBlock(blockShipController, ItemBlockAbstractBase.class, "blockShipController"); GameRegistry.registerTileEntity(TileEntityShipController.class, MODID + ":blockShipController"); // SHIP CORE blockShipCore = new BlockShipCore(); - GameRegistry.registerBlock(blockShipCore, "blockShipCore"); + GameRegistry.registerBlock(blockShipCore, ItemBlockAbstractBase.class, "blockShipCore"); GameRegistry.registerTileEntity(TileEntityShipCore.class, MODID + ":blockShipCore"); // RADAR blockRadar = new BlockRadar(); - GameRegistry.registerBlock(blockRadar, "blockRadar"); + GameRegistry.registerBlock(blockRadar, ItemBlockAbstractBase.class, "blockRadar"); GameRegistry.registerTileEntity(TileEntityRadar.class, MODID + ":blockRadar"); // WARP ISOLATION blockWarpIsolation = new BlockWarpIsolation(); - GameRegistry.registerBlock(blockWarpIsolation, "blockWarpIsolation"); + GameRegistry.registerBlock(blockWarpIsolation, ItemBlockAbstractBase.class, "blockWarpIsolation"); // AIR GENERATOR blockAirGenerator = new BlockAirGenerator(); - GameRegistry.registerBlock(blockAirGenerator, "blockAirGenerator"); + GameRegistry.registerBlock(blockAirGenerator, ItemBlockAbstractBase.class, "blockAirGenerator"); GameRegistry.registerTileEntity(TileEntityAirGenerator.class, MODID + ":blockAirGenerator"); // AIR BLOCK blockAir = new BlockAir(); - GameRegistry.registerBlock(blockAir, "blockAir"); + GameRegistry.registerBlock(blockAir, ItemBlockAbstractBase.class, "blockAir"); // GAS BLOCK blockGas = new BlockGas(); - GameRegistry.registerBlock(blockGas, "blockGas"); + GameRegistry.registerBlock(blockGas, ItemBlockAbstractBase.class, "blockGas"); // LASER EMITTER blockLaser = new BlockLaser(); - GameRegistry.registerBlock(blockLaser, "blockLaser"); + GameRegistry.registerBlock(blockLaser, ItemBlockAbstractBase.class, "blockLaser"); GameRegistry.registerTileEntity(TileEntityLaser.class, MODID + ":blockLaser"); // LASER EMITTER WITH CAMERA blockLaserCamera = new BlockLaserCamera(); - GameRegistry.registerBlock(blockLaserCamera, "blockLaserCamera"); + GameRegistry.registerBlock(blockLaserCamera, ItemBlockAbstractBase.class, "blockLaserCamera"); GameRegistry.registerTileEntity(TileEntityLaserCamera.class, MODID + ":blockLaserCamera"); // LASER EMITTER WITH CAMERA blockWeaponController = new BlockWeaponController(); - GameRegistry.registerBlock(blockWeaponController, "blockWeaponController"); + GameRegistry.registerBlock(blockWeaponController, ItemBlockAbstractBase.class, "blockWeaponController"); GameRegistry.registerTileEntity(TileEntityWeaponController.class, MODID + ":blockWeaponController"); // CAMERA blockCamera = new BlockCamera(); - GameRegistry.registerBlock(blockCamera, "blockCamera"); + GameRegistry.registerBlock(blockCamera, ItemBlockAbstractBase.class, "blockCamera"); GameRegistry.registerTileEntity(TileEntityCamera.class, MODID + ":blockCamera"); // MONITOR blockMonitor = new BlockMonitor(); - GameRegistry.registerBlock(blockMonitor, "blockMonitor"); + GameRegistry.registerBlock(blockMonitor, ItemBlockAbstractBase.class, "blockMonitor"); GameRegistry.registerTileEntity(TileEntityMonitor.class, MODID + ":blockMonitor"); // MINING LASER blockMiningLaser = new BlockMiningLaser(); - GameRegistry.registerBlock(blockMiningLaser, "blockMiningLaser"); + GameRegistry.registerBlock(blockMiningLaser, ItemBlockAbstractBase.class, "blockMiningLaser"); GameRegistry.registerTileEntity(TileEntityMiningLaser.class, MODID + ":blockMiningLaser"); // LASER TREE FARM blockLaserTreeFarm = new BlockLaserTreeFarm(); - GameRegistry.registerBlock(blockLaserTreeFarm, "blockLaserTreeFarm"); + GameRegistry.registerBlock(blockLaserTreeFarm, ItemBlockAbstractBase.class, "blockLaserTreeFarm"); GameRegistry.registerTileEntity(TileEntityLaserTreeFarm.class, MODID + ":blockLaserTreeFarm"); // LASER MEDIUM blockLaserMedium = new BlockLaserMedium(); - GameRegistry.registerBlock(blockLaserMedium, "blockLaserMedium"); + GameRegistry.registerBlock(blockLaserMedium, ItemBlockAbstractBase.class, "blockLaserMedium"); GameRegistry.registerTileEntity(TileEntityLaserMedium.class, MODID + ":blockLaserMedium"); // LIFT blockLift = new BlockLift(); - GameRegistry.registerBlock(blockLift, "blockLift"); + GameRegistry.registerBlock(blockLift, ItemBlockAbstractBase.class, "blockLift"); GameRegistry.registerTileEntity(TileEntityLift.class, MODID + ":blockLift"); // IRIDIUM BLOCK blockIridium = new BlockIridium(); - GameRegistry.registerBlock(blockIridium, "blockIridium"); + GameRegistry.registerBlock(blockIridium, ItemBlockAbstractBase.class, "blockIridium"); // HIGHLY ADVANCED MACHINE BLOCK blockHighlyAdvancedMachine = new BlockHighlyAdvancedMachine(); - GameRegistry.registerBlock(blockHighlyAdvancedMachine, "blockHighlyAdvancedMachine"); + GameRegistry.registerBlock(blockHighlyAdvancedMachine, ItemBlockAbstractBase.class, "blockHighlyAdvancedMachine"); // SHIP SCANNER blockShipScanner = new BlockShipScanner(); - GameRegistry.registerBlock(blockShipScanner, "blockShipScanner"); + GameRegistry.registerBlock(blockShipScanner, ItemBlockAbstractBase.class, "blockShipScanner"); GameRegistry.registerTileEntity(TileEntityShipScanner.class, MODID + ":blockShipScanner"); // CLOAKING DEVICE CORE blockCloakingCore = new BlockCloakingCore(); - GameRegistry.registerBlock(blockCloakingCore, "blockCloakingCore"); + GameRegistry.registerBlock(blockCloakingCore, ItemBlockAbstractBase.class, "blockCloakingCore"); GameRegistry.registerTileEntity(TileEntityCloakingCore.class, MODID + ":blockCloakingCore"); // CLOAKING DEVICE COIL blockCloakingCoil = new BlockCloakingCoil(); - GameRegistry.registerBlock(blockCloakingCoil, "blockCloakingCoil"); + GameRegistry.registerBlock(blockCloakingCoil, ItemBlockAbstractBase.class, "blockCloakingCoil"); // TRANSPORTER blockTransporter = new BlockTransporter(); - GameRegistry.registerBlock(blockTransporter, "blockTransporter"); + GameRegistry.registerBlock(blockTransporter, ItemBlockAbstractBase.class, "blockTransporter"); GameRegistry.registerTileEntity(TileEntityTransporter.class, MODID + ":blockTransporter"); // IC2 REACTOR LASER MONITOR if (WarpDriveConfig.isIndustrialCraft2Loaded) { blockIC2reactorLaserMonitor = new BlockIC2reactorLaserMonitor(); - GameRegistry.registerBlock(blockIC2reactorLaserMonitor, "blockIC2reactorLaserMonitor"); + GameRegistry.registerBlock(blockIC2reactorLaserMonitor, ItemBlockAbstractBase.class, "blockIC2reactorLaserMonitor"); GameRegistry.registerTileEntity(TileEntityIC2reactorLaserMonitor.class, MODID + ":blockIC2reactorLaserMonitor"); } // TRANSPORT BEACON blockTransportBeacon = new BlockTransportBeacon(); - GameRegistry.registerBlock(blockTransportBeacon, "blockTransportBeacon"); + GameRegistry.registerBlock(blockTransportBeacon, ItemBlockAbstractBase.class, "blockTransportBeacon"); // POWER REACTOR, LASER, STORE blockEnanReactorCore = new BlockEnanReactorCore(); - GameRegistry.registerBlock(blockEnanReactorCore, "blockEnanReactorCore"); + GameRegistry.registerBlock(blockEnanReactorCore, ItemBlockAbstractBase.class, "blockEnanReactorCore"); GameRegistry.registerTileEntity(TileEntityEnanReactorCore.class, MODID + ":blockEnanReactorCore"); blockEnanReactorLaser = new BlockEnanReactorLaser(); - GameRegistry.registerBlock(blockEnanReactorLaser, "blockEnanReactorLaser"); + GameRegistry.registerBlock(blockEnanReactorLaser, ItemBlockAbstractBase.class, "blockEnanReactorLaser"); GameRegistry.registerTileEntity(TileEntityEnanReactorLaser.class, MODID + ":blockEnanReactorLaser"); blockEnergyBank = new BlockEnergyBank(); - GameRegistry.registerBlock(blockEnergyBank, "blockEnergyBank"); + GameRegistry.registerBlock(blockEnergyBank, ItemBlockAbstractBase.class, "blockEnergyBank"); GameRegistry.registerTileEntity(TileEntityEnergyBank.class, MODID + ":blockEnergyBank"); // CHUNK LOADER blockChunkLoader = new BlockChunkLoader(); - GameRegistry.registerBlock(blockChunkLoader, "blockChunkLoader"); + GameRegistry.registerBlock(blockChunkLoader, ItemBlockAbstractBase.class, "blockChunkLoader"); GameRegistry.registerTileEntity(TileEntityChunkLoader.class, MODID + ":blockChunkLoader"); // FORCE FIELD BLOCKS @@ -410,7 +402,7 @@ public class WarpDrive implements LoadingCallback { int index = tier - 1; // FORCE FIELD blockForceFields[index] = new BlockForceField(tier); - GameRegistry.registerBlock(blockForceFields[index], "blockForceField" + tier); + GameRegistry.registerBlock(blockForceFields[index], ItemBlockAbstractBase.class, "blockForceField" + tier); GameRegistry.registerTileEntity(TileEntityForceField.class, MODID + ":blockForceField" + tier); // FORCE FIELD PROJECTOR @@ -426,7 +418,7 @@ public class WarpDrive implements LoadingCallback { /* TODO // SECURITY STATION blockSecurityStation = new BlockSecurityStation(); - GameRegistry.registerBlock(blockSecurityStation, "blockSecurityStation"); + GameRegistry.registerBlock(blockSecurityStation, ItemBlockAbstractBase.class, "blockSecurityStation"); GameRegistry.registerTileEntity(TileEntitySecurityStation.class, MODID + ":blockSecurityStation"); */ // DECORATIVE diff --git a/src/main/java/cr0s/warpdrive/block/ItemBlockAbstractBase.java b/src/main/java/cr0s/warpdrive/block/ItemBlockAbstractBase.java index e0ac7698..d89cea42 100644 --- a/src/main/java/cr0s/warpdrive/block/ItemBlockAbstractBase.java +++ b/src/main/java/cr0s/warpdrive/block/ItemBlockAbstractBase.java @@ -33,11 +33,11 @@ public class ItemBlockAbstractBase extends ItemBlock { public String getStatus(final NBTTagCompound nbtTagCompound) { TileEntity tileEntity = field_150939_a.createTileEntity(null, 0); - if (tileEntity instanceof TileEntityAbstractEnergy) { + if (tileEntity instanceof TileEntityAbstractBase) { if (nbtTagCompound != null) { tileEntity.readFromNBT(nbtTagCompound); } - return ((TileEntityAbstractEnergy)tileEntity).getStatus(); + return ((TileEntityAbstractBase)tileEntity).getStatus(); } else { return ""; diff --git a/src/main/java/cr0s/warpdrive/block/TileEntityAbstractBase.java b/src/main/java/cr0s/warpdrive/block/TileEntityAbstractBase.java index 0fb5db66..87afc4de 100644 --- a/src/main/java/cr0s/warpdrive/block/TileEntityAbstractBase.java +++ b/src/main/java/cr0s/warpdrive/block/TileEntityAbstractBase.java @@ -13,6 +13,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityChest; +import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; @@ -335,6 +336,11 @@ public abstract class TileEntityAbstractBase extends TileEntity implements IBloc return nbtTagCompound; } + // status + public String getStatus() { + return (worldObj != null ? StatCollector.translateToLocalFormatted("warpdrive.guide.prefix", getBlockType().getLocalizedName()) : ""); + } + // upgrade system private final HashMap installedUpgrades = new HashMap<>(10); private final HashMap maxUpgrades = new HashMap<>(10); diff --git a/src/main/java/cr0s/warpdrive/block/TileEntityLaser.java b/src/main/java/cr0s/warpdrive/block/TileEntityLaser.java index 591fd82d..8e5a5176 100644 --- a/src/main/java/cr0s/warpdrive/block/TileEntityLaser.java +++ b/src/main/java/cr0s/warpdrive/block/TileEntityLaser.java @@ -531,10 +531,14 @@ public class TileEntityLaser extends TileEntityAbstractLaser implements IBeamFre } } + @Override public String getStatus() { - return StatCollector.translateToLocalFormatted("warpdrive.guide.prefix", - getBlockType().getLocalizedName()) - + getBeamFrequencyStatus(); + if (worldObj == null || !worldObj.isRemote) { + return super.getStatus() + + "\n" + getBeamFrequencyStatus(); + } else { + return super.getStatus(); + } } private void playSoundCorrespondsEnergy(int energy) { diff --git a/src/main/java/cr0s/warpdrive/block/collection/TileEntityLaserTreeFarm.java b/src/main/java/cr0s/warpdrive/block/collection/TileEntityLaserTreeFarm.java index 0c66c519..f43c315e 100644 --- a/src/main/java/cr0s/warpdrive/block/collection/TileEntityLaserTreeFarm.java +++ b/src/main/java/cr0s/warpdrive/block/collection/TileEntityLaserTreeFarm.java @@ -720,7 +720,9 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner { return super.callMethod(computer, context, method, arguments); } + @Override public String getStatus() { + // @TODO merge with base int energy = getEnergyStored(); String state = "IDLE (not farming)"; if (currentState == STATE_IDLE) { diff --git a/src/main/java/cr0s/warpdrive/block/collection/TileEntityMiningLaser.java b/src/main/java/cr0s/warpdrive/block/collection/TileEntityMiningLaser.java index 193cde8f..120486c9 100644 --- a/src/main/java/cr0s/warpdrive/block/collection/TileEntityMiningLaser.java +++ b/src/main/java/cr0s/warpdrive/block/collection/TileEntityMiningLaser.java @@ -514,7 +514,9 @@ public class TileEntityMiningLaser extends TileEntityAbstractMiner { return super.callMethod(computer, context, method, arguments); } + @Override public String getStatus() { + // @TODO merge with base int energy = getEnergyStored(); String state = "IDLE (not mining)"; if (currentState == STATE_IDLE) { diff --git a/src/main/java/cr0s/warpdrive/block/detection/TileEntityCamera.java b/src/main/java/cr0s/warpdrive/block/detection/TileEntityCamera.java index 96caf18f..36b45b1e 100644 --- a/src/main/java/cr0s/warpdrive/block/detection/TileEntityCamera.java +++ b/src/main/java/cr0s/warpdrive/block/detection/TileEntityCamera.java @@ -102,9 +102,9 @@ public class TileEntityCamera extends TileEntityAbstractInterfaced implements IV } } + @Override public String getStatus() { - return StatCollector.translateToLocalFormatted("warpdrive.guide.prefix", - getBlockType().getLocalizedName()) + return super.getStatus() + getVideoChannelStatus(); } diff --git a/src/main/java/cr0s/warpdrive/block/detection/TileEntityCloakingCore.java b/src/main/java/cr0s/warpdrive/block/detection/TileEntityCloakingCore.java index 62ca9c7e..8c387e94 100644 --- a/src/main/java/cr0s/warpdrive/block/detection/TileEntityCloakingCore.java +++ b/src/main/java/cr0s/warpdrive/block/detection/TileEntityCloakingCore.java @@ -360,6 +360,10 @@ public class TileEntityCloakingCore extends TileEntityAbstractEnergy { @Override public String getStatus() { + if (worldObj == null) { + return super.getStatus(); + } + String unlocalizedStatus; if (!isValid) { unlocalizedStatus = "warpdrive.cloakingCore.invalidAssembly"; @@ -370,11 +374,10 @@ public class TileEntityCloakingCore extends TileEntityAbstractEnergy { } else { unlocalizedStatus = "warpdrive.cloakingCore.cloaking"; } - return StatCollector.translateToLocalFormatted("warpdrive.guide.prefix", - getBlockType().getLocalizedName()) - + StatCollector.translateToLocalFormatted(unlocalizedStatus, - tier, - volume); + return super.getStatus() + + "\n" + StatCollector.translateToLocalFormatted(unlocalizedStatus, + tier, + volume); } // OpenComputer callback methods diff --git a/src/main/java/cr0s/warpdrive/block/detection/TileEntityMonitor.java b/src/main/java/cr0s/warpdrive/block/detection/TileEntityMonitor.java index f05b573b..66eebbe9 100644 --- a/src/main/java/cr0s/warpdrive/block/detection/TileEntityMonitor.java +++ b/src/main/java/cr0s/warpdrive/block/detection/TileEntityMonitor.java @@ -72,7 +72,6 @@ public class TileEntityMonitor extends TileEntityAbstractInterfaced implements I } else { CameraRegistryItem camera = WarpDrive.cameras.getCameraByVideoChannel(worldObj, videoChannel); if (camera == null) { - WarpDrive.cameras.printRegistry(worldObj); return StatCollector.translateToLocalFormatted("warpdrive.videoChannel.statusLine.invalidOrNotLoaded", videoChannel); } else if (camera.isTileEntity(this)) { return StatCollector.translateToLocalFormatted("warpdrive.videoChannel.statusLine.valid", videoChannel); @@ -86,9 +85,9 @@ public class TileEntityMonitor extends TileEntityAbstractInterfaced implements I } } + @Override public String getStatus() { - return StatCollector.translateToLocalFormatted("warpdrive.guide.prefix", - getBlockType().getLocalizedName()) + return super.getStatus() + getVideoChannelStatus(); } diff --git a/src/main/java/cr0s/warpdrive/block/energy/TileEntityIC2reactorLaserMonitor.java b/src/main/java/cr0s/warpdrive/block/energy/TileEntityIC2reactorLaserMonitor.java index 724060d3..2a581262 100644 --- a/src/main/java/cr0s/warpdrive/block/energy/TileEntityIC2reactorLaserMonitor.java +++ b/src/main/java/cr0s/warpdrive/block/energy/TileEntityIC2reactorLaserMonitor.java @@ -187,16 +187,18 @@ public class TileEntityIC2reactorLaserMonitor extends TileEntityAbstractEnergy { @Override @Optional.Method(modid = "IC2") public String getStatus() { + if (worldObj == null) { + return super.getStatus(); + } + Set reactors = findReactors(); if (reactors != null && !reactors.isEmpty()) { - return StatCollector.translateToLocalFormatted("warpdrive.guide.prefix", - getBlockType().getLocalizedName()) - + StatCollector.translateToLocalFormatted("warpdrive.IC2reactorLaserMonitor.multipleReactors", - reactors.size()); + return super.getStatus() + + StatCollector.translateToLocalFormatted("warpdrive.IC2reactorLaserMonitor.multipleReactors", + reactors.size()); } else { - return StatCollector.translateToLocalFormatted("warpdrive.guide.prefix", - getBlockType().getLocalizedName()) - + StatCollector.translateToLocalFormatted("warpdrive.IC2reactorLaserMonitor.noReactor"); + return super.getStatus() + + StatCollector.translateToLocalFormatted("warpdrive.IC2reactorLaserMonitor.noReactor"); } } diff --git a/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityAbstractForceField.java b/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityAbstractForceField.java index 39e21c62..d38f5371 100644 --- a/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityAbstractForceField.java +++ b/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityAbstractForceField.java @@ -109,10 +109,9 @@ public class TileEntityAbstractForceField extends TileEntityAbstractEnergy imple } } + @Override public String getStatus() { - String strEnergyStatus = getEnergyStatus(); - return (worldObj != null ? StatCollector.translateToLocalFormatted("warpdrive.guide.prefix", getBlockType().getLocalizedName()) : "") - + (strEnergyStatus.isEmpty() ? "" : "\n" + strEnergyStatus) + return super.getStatus() + "\n" + getBeamFrequencyStatus(); } diff --git a/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityForceFieldProjector.java b/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityForceFieldProjector.java index 983a5351..0fd10f90 100644 --- a/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityForceFieldProjector.java +++ b/src/main/java/cr0s/warpdrive/block/forcefield/TileEntityForceFieldProjector.java @@ -864,6 +864,7 @@ public class TileEntityForceFieldProjector extends TileEntityAbstractForceField } } + @Override public String getStatus() { return super.getStatus() + "\n" + getShapeStatus() diff --git a/src/main/java/cr0s/warpdrive/block/movement/TileEntityShipController.java b/src/main/java/cr0s/warpdrive/block/movement/TileEntityShipController.java index b7385809..b423ad85 100644 --- a/src/main/java/cr0s/warpdrive/block/movement/TileEntityShipController.java +++ b/src/main/java/cr0s/warpdrive/block/movement/TileEntityShipController.java @@ -260,9 +260,9 @@ public class TileEntityShipController extends TileEntityAbstractInterfaced { getAttachedPlayersList()); } + @Override public String getStatus() { - return StatCollector.translateToLocalFormatted("warpdrive.guide.prefix", - getBlockType().getLocalizedName()) + return super.getStatus() + StatCollector.translateToLocalFormatted("warpdrive.ship.attachedPlayers", getAttachedPlayersList()); } diff --git a/src/main/java/cr0s/warpdrive/block/movement/TileEntityShipCore.java b/src/main/java/cr0s/warpdrive/block/movement/TileEntityShipCore.java index 3c732b1f..9eedbaac 100644 --- a/src/main/java/cr0s/warpdrive/block/movement/TileEntityShipCore.java +++ b/src/main/java/cr0s/warpdrive/block/movement/TileEntityShipCore.java @@ -1016,9 +1016,7 @@ public class TileEntityShipCore extends TileEntityAbstractEnergy { @Override public String getStatus() { - return StatCollector.translateToLocalFormatted("warpdrive.guide.prefix", - getBlockType().getLocalizedName()) - + "\n" + getEnergyStatus() + return super.getStatus() + ((cooldownTime > 0) ? "\n" + StatCollector.translateToLocalFormatted("warpdrive.ship.statusLine.cooling", cooldownTime / 20) : "") + ((isolationBlocksCount > 0) ? "\n" + StatCollector.translateToLocalFormatted("warpdrive.ship.statusLine.isolation", isolationBlocksCount, isolationRate * 100.0) : ""); } diff --git a/src/main/java/cr0s/warpdrive/block/movement/TileEntityTransporter.java b/src/main/java/cr0s/warpdrive/block/movement/TileEntityTransporter.java index 165e6fb6..5d9ca9b8 100644 --- a/src/main/java/cr0s/warpdrive/block/movement/TileEntityTransporter.java +++ b/src/main/java/cr0s/warpdrive/block/movement/TileEntityTransporter.java @@ -76,9 +76,7 @@ public class TileEntityTransporter extends TileEntityAbstractEnergy implements I @Override public String getStatus() { - return StatCollector.translateToLocalFormatted("warpdrive.guide.prefix", - getBlockType().getLocalizedName()) - + "\n" + getEnergyStatus() + return super.getStatus() + "\n" + StatCollector.translateToLocalFormatted("warpdrive.transporter.status", sourceVec.x, sourceVec.y, sourceVec.z, destVec.x, destVec.y, destVec.z); diff --git a/src/main/java/cr0s/warpdrive/block/weapon/TileEntityLaserCamera.java b/src/main/java/cr0s/warpdrive/block/weapon/TileEntityLaserCamera.java index 810aa8e3..84372fe1 100644 --- a/src/main/java/cr0s/warpdrive/block/weapon/TileEntityLaserCamera.java +++ b/src/main/java/cr0s/warpdrive/block/weapon/TileEntityLaserCamera.java @@ -104,9 +104,12 @@ public class TileEntityLaserCamera extends TileEntityLaser implements IVideoChan @Override public String getStatus() { - return StatCollector.translateToLocalFormatted("warpdrive.guide.prefix", - getBlockType().getLocalizedName()) - + (worldObj.isRemote ? getVideoChannelStatus() : getBeamFrequencyStatus()); + if (worldObj == null || worldObj.isRemote) { + return super.getStatus() + + "\n" + getVideoChannelStatus(); + } else { + return super.getStatus(); + } } @Override diff --git a/src/main/java/cr0s/warpdrive/block/weapon/TileEntityWeaponController.java b/src/main/java/cr0s/warpdrive/block/weapon/TileEntityWeaponController.java index fc59218b..634ee6be 100644 --- a/src/main/java/cr0s/warpdrive/block/weapon/TileEntityWeaponController.java +++ b/src/main/java/cr0s/warpdrive/block/weapon/TileEntityWeaponController.java @@ -21,12 +21,7 @@ public class TileEntityWeaponController extends TileEntityAbstractInterfaced { public void updateEntity() { super.updateEntity(); } - - public String getStatus() { - return StatCollector.translateToLocalFormatted("warpdrive.guide.prefix", - getBlockType().getLocalizedName()); - } - + @Override public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); diff --git a/src/main/java/cr0s/warpdrive/data/CamerasRegistry.java b/src/main/java/cr0s/warpdrive/data/CamerasRegistry.java index c6ddf5bd..a2e9061c 100644 --- a/src/main/java/cr0s/warpdrive/data/CamerasRegistry.java +++ b/src/main/java/cr0s/warpdrive/data/CamerasRegistry.java @@ -17,6 +17,9 @@ public class CamerasRegistry { } public CameraRegistryItem getCameraByVideoChannel(World world, int videoChannel) { + if (world == null) { + return null; + } CameraRegistryItem cam; for (Iterator it = registry.iterator(); it.hasNext();) { cam = it.next(); @@ -107,7 +110,6 @@ public class CamerasRegistry { public void updateInRegistry(World world, ChunkPosition position, int videoChannel, EnumCameraType enumCameraType) { CameraRegistryItem cam = new CameraRegistryItem(world, position, videoChannel, enumCameraType); - // WarpDrive.debugPrint("updateInRegistry " + cam.position.x + ", " + cam.position.y + ", " + cam.position.z); removeDeadCams(world); if (isCamAlive(world, cam)) { @@ -135,6 +137,9 @@ public class CamerasRegistry { } public void printRegistry(World world) { + if (world == null) { + return; + } WarpDrive.logger.info("Cameras registry for dimension " + world.provider.dimensionId + ":"); for (CameraRegistryItem cam : registry) {