Added explicit status for undefined values

This commit is contained in:
LemADEC 2016-06-25 00:27:20 +02:00
parent 081df469f8
commit 3e72a2f23f
5 changed files with 28 additions and 31 deletions

View file

@ -522,12 +522,12 @@ public class TileEntityLaser extends TileEntityAbstractLaser implements IBeamFre
}
protected String getBeamFrequencyStatus() {
if (beamFrequency < 0) {
return StatCollector.translateToLocalFormatted("warpdrive.beamFrequency.statusLine.invalid",
beamFrequency );
if (beamFrequency == -1) {
return StatCollector.translateToLocalFormatted("warpdrive.beamFrequency.statusLine.undefined");
} else if (beamFrequency < 0) {
return StatCollector.translateToLocalFormatted("warpdrive.beamFrequency.statusLine.invalid", beamFrequency );
} else {
return StatCollector.translateToLocalFormatted("warpdrive.beamFrequency.statusLine.valid",
beamFrequency );
return StatCollector.translateToLocalFormatted("warpdrive.beamFrequency.statusLine.valid", beamFrequency );
}
}

View file

@ -80,24 +80,23 @@ public class TileEntityCamera extends TileEntityAbstractInterfaced implements IV
}
private String getVideoChannelStatus() {
if (videoChannel < 0) {
return StatCollector.translateToLocalFormatted("warpdrive.videoChannel.statusLine.invalid",
videoChannel );
if (videoChannel == -1) {
return StatCollector.translateToLocalFormatted("warpdrive.videoChannel.statusLine.undefined");
} else if (videoChannel < 0) {
return StatCollector.translateToLocalFormatted("warpdrive.videoChannel.statusLine.invalid", videoChannel);
} else {
CameraRegistryItem camera = WarpDrive.cameras.getCameraByVideoChannel(worldObj, videoChannel);
if (camera == null) {
WarpDrive.cameras.printRegistry(worldObj);
return StatCollector.translateToLocalFormatted("warpdrive.videoChannel.statusLine.invalid",
videoChannel );
return StatCollector.translateToLocalFormatted("warpdrive.videoChannel.statusLine.invalid", videoChannel);
} else if (camera.isTileEntity(this)) {
return StatCollector.translateToLocalFormatted("warpdrive.videoChannel.statusLine.valid",
videoChannel );
return StatCollector.translateToLocalFormatted("warpdrive.videoChannel.statusLine.valid", videoChannel);
} else {
return StatCollector.translateToLocalFormatted("warpdrive.videoChannel.statusLine.validCamera",
videoChannel,
camera.position.chunkPosX,
camera.position.chunkPosY,
camera.position.chunkPosZ );
camera.position.chunkPosZ);
}
}
}

View file

@ -64,24 +64,23 @@ public class TileEntityMonitor extends TileEntityAbstractInterfaced implements I
}
private String getVideoChannelStatus() {
if (videoChannel < 0) {
return StatCollector.translateToLocalFormatted("warpdrive.videoChannel.statusLine.invalid",
videoChannel );
if (videoChannel == -1) {
return StatCollector.translateToLocalFormatted("warpdrive.videoChannel.statusLine.undefined");
} else if (videoChannel < 0) {
return StatCollector.translateToLocalFormatted("warpdrive.videoChannel.statusLine.invalid", videoChannel);
} else {
CameraRegistryItem camera = WarpDrive.cameras.getCameraByVideoChannel(worldObj, videoChannel);
if (camera == null) {
WarpDrive.cameras.printRegistry(worldObj);
return StatCollector.translateToLocalFormatted("warpdrive.videoChannel.statusLine.invalidOrNotLoaded",
videoChannel );
return StatCollector.translateToLocalFormatted("warpdrive.videoChannel.statusLine.invalidOrNotLoaded", videoChannel);
} else if (camera.isTileEntity(this)) {
return StatCollector.translateToLocalFormatted("warpdrive.videoChannel.statusLine.valid",
videoChannel );
return StatCollector.translateToLocalFormatted("warpdrive.videoChannel.statusLine.valid", videoChannel);
} else {
return StatCollector.translateToLocalFormatted("warpdrive.videoChannel.statusLine.validCamera",
videoChannel,
camera.position.chunkPosX,
camera.position.chunkPosY,
camera.position.chunkPosZ );
camera.position.chunkPosZ);
}
}
}

View file

@ -79,25 +79,24 @@ public class TileEntityLaserCamera extends TileEntityLaser implements IVideoChan
}
}
public String getVideoChannelStatus() {
if (videoChannel < 0) {
return StatCollector.translateToLocalFormatted("warpdrive.videoChannel.statusLine.invalid",
videoChannel );
private String getVideoChannelStatus() {
if (videoChannel == -1) {
return StatCollector.translateToLocalFormatted("warpdrive.videoChannel.statusLine.undefined");
} else if (videoChannel < 0) {
return StatCollector.translateToLocalFormatted("warpdrive.videoChannel.statusLine.invalid", videoChannel);
} else {
CameraRegistryItem camera = WarpDrive.cameras.getCameraByVideoChannel(worldObj, videoChannel);
if (camera == null) {
WarpDrive.cameras.printRegistry(worldObj);
return StatCollector.translateToLocalFormatted("warpdrive.videoChannel.statusLine.invalid",
videoChannel );
return StatCollector.translateToLocalFormatted("warpdrive.videoChannel.statusLine.invalid", videoChannel);
} else if (camera.isTileEntity(this)) {
return StatCollector.translateToLocalFormatted("warpdrive.videoChannel.statusLine.valid",
videoChannel );
return StatCollector.translateToLocalFormatted("warpdrive.videoChannel.statusLine.valid", videoChannel);
} else {
return StatCollector.translateToLocalFormatted("warpdrive.videoChannel.statusLine.validCamera",
videoChannel,
camera.position.chunkPosX,
camera.position.chunkPosY,
camera.position.chunkPosZ );
camera.position.chunkPosZ);
}
}
}

View file

@ -124,7 +124,7 @@ public class ItemTuningFork extends Item {
tooltip += StatCollector.translateToLocalFormatted("item.warpdrive.tool.TuningFork.tooltip.videoChannel", getVideoChannel(itemStack));
tooltip += "\n" + StatCollector.translateToLocalFormatted("item.warpdrive.tool.TuningFork.tooltip.beamFrequency", getBeamFrequency(itemStack));
tooltip += StatCollector.translateToLocal("item.warpdrive.tool.TuningFork.tooltip.usage");
tooltip += "\n\n" + StatCollector.translateToLocal("item.warpdrive.tool.TuningFork.tooltip.usage");
WarpDrive.addTooltip(list, tooltip);
}