Fixed regression in video channels reported status
This commit is contained in:
parent
5aa2d54459
commit
b70735f5d6
10 changed files with 45 additions and 24 deletions
|
@ -101,10 +101,17 @@ public class Commons {
|
|||
}
|
||||
|
||||
public static void addChatMessage(final ICommandSender commandSender, final String message) {
|
||||
// validate context
|
||||
if (commandSender == null) {
|
||||
WarpDrive.logger.error("Unable to send message to NULL commandSender: " + message);
|
||||
return;
|
||||
}
|
||||
|
||||
// skip empty messages
|
||||
if (message.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
final String[] lines = updateEscapeCodes(message).split("\n");
|
||||
String format = "";
|
||||
getFormatFromString(lines[0]);
|
||||
|
|
|
@ -4,6 +4,7 @@ import cr0s.warpdrive.Commons;
|
|||
import cr0s.warpdrive.WarpDrive;
|
||||
import cr0s.warpdrive.api.IBlockBase;
|
||||
import cr0s.warpdrive.api.IBlockUpdateDetector;
|
||||
import cr0s.warpdrive.api.IVideoChannel;
|
||||
import cr0s.warpdrive.config.WarpDriveConfig;
|
||||
import cr0s.warpdrive.data.EnumComponentType;
|
||||
import cr0s.warpdrive.item.ItemComponent;
|
||||
|
@ -208,18 +209,21 @@ public abstract class BlockAbstractContainer extends BlockContainer implements I
|
|||
public boolean onBlockActivated(final World world, final int x, final int y, final int z,
|
||||
final EntityPlayer entityPlayer,
|
||||
final int side, final float hitX, final float hitY, final float hitZ) {
|
||||
if (world.isRemote) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// get context
|
||||
final TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (!(tileEntity instanceof TileEntityAbstractBase)) {
|
||||
return false;
|
||||
}
|
||||
final TileEntityAbstractBase tileEntityAbstractBase = (TileEntityAbstractBase) tileEntity;
|
||||
final boolean hasVideoChannel = tileEntity instanceof IVideoChannel;
|
||||
final ItemStack itemStackHeld = entityPlayer.getHeldItem();
|
||||
|
||||
// video channel is reported client side, everything else is reported server side
|
||||
if ( world.isRemote
|
||||
&& !hasVideoChannel ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
EnumComponentType enumComponentType = null;
|
||||
if ( itemStackHeld != null
|
||||
&& itemStackHeld.getItem() instanceof ItemComponent ) {
|
||||
|
@ -227,7 +231,8 @@ public abstract class BlockAbstractContainer extends BlockContainer implements I
|
|||
}
|
||||
|
||||
// sneaking with an empty hand or an upgrade item in hand to dismount current upgrade
|
||||
if (entityPlayer.isSneaking()) {
|
||||
if ( !world.isRemote
|
||||
&& entityPlayer.isSneaking() ) {
|
||||
// using an upgrade item or an empty hand means dismount upgrade
|
||||
if ( tileEntityAbstractBase.isUpgradeable()
|
||||
&& ( itemStackHeld == null
|
||||
|
@ -258,11 +263,13 @@ public abstract class BlockAbstractContainer extends BlockContainer implements I
|
|||
return false;
|
||||
}
|
||||
|
||||
} else if (itemStackHeld == null) {// no sneaking and no item in hand => show status
|
||||
} else if ( !entityPlayer.isSneaking()
|
||||
&& itemStackHeld == null ) {// no sneaking and no item in hand => show status
|
||||
Commons.addChatMessage(entityPlayer, tileEntityAbstractBase.getStatus());
|
||||
return true;
|
||||
|
||||
} else if ( tileEntityAbstractBase.isUpgradeable()
|
||||
} else if ( !world.isRemote
|
||||
&& tileEntityAbstractBase.isUpgradeable()
|
||||
&& enumComponentType != null ) {// no sneaking and an upgrade in hand => mounting an upgrade
|
||||
// validate type
|
||||
if (tileEntityAbstractBase.getUpgradeMaxCount(enumComponentType) <= 0) {
|
||||
|
|
|
@ -6,6 +6,8 @@ import cr0s.warpdrive.WarpDrive;
|
|||
import cr0s.warpdrive.api.IBeamFrequency;
|
||||
import cr0s.warpdrive.api.IBlockUpdateDetector;
|
||||
import cr0s.warpdrive.api.IVideoChannel;
|
||||
import cr0s.warpdrive.block.detection.TileEntityCamera;
|
||||
import cr0s.warpdrive.block.weapon.TileEntityLaserCamera;
|
||||
import cr0s.warpdrive.config.WarpDriveConfig;
|
||||
import cr0s.warpdrive.data.CameraRegistryItem;
|
||||
|
||||
|
@ -264,12 +266,17 @@ public abstract class TileEntityAbstractBase extends TileEntity implements IBloc
|
|||
} else {
|
||||
final CameraRegistryItem camera = WarpDrive.cameras.getCameraByVideoChannel(worldObj, videoChannel);
|
||||
if (camera == null) {
|
||||
WarpDrive.cameras.printRegistry(worldObj);
|
||||
return StatCollector.translateToLocalFormatted("warpdrive.video_channel.status_line.invalid", videoChannel);
|
||||
if (WarpDrive.isDev) {
|
||||
if ( this instanceof TileEntityCamera
|
||||
|| this instanceof TileEntityLaserCamera) {
|
||||
WarpDrive.cameras.printRegistry(worldObj);
|
||||
}
|
||||
}
|
||||
return StatCollector.translateToLocalFormatted("warpdrive.video_channel.status_line.not_loaded", videoChannel);
|
||||
} else if (camera.isTileEntity(this)) {
|
||||
return StatCollector.translateToLocalFormatted("warpdrive.video_channel.status_line.valid", videoChannel);
|
||||
return StatCollector.translateToLocalFormatted("warpdrive.video_channel.status_line.valid_camera", videoChannel);
|
||||
} else {
|
||||
return StatCollector.translateToLocalFormatted("warpdrive.video_channel.status_line.validCamera",
|
||||
return StatCollector.translateToLocalFormatted("warpdrive.video_channel.status_line.valid_monitor",
|
||||
videoChannel,
|
||||
camera.position.chunkPosX,
|
||||
camera.position.chunkPosY,
|
||||
|
|
|
@ -669,8 +669,8 @@ warpdrive.upgrade.status_line.valid=%1$s Upgrade installiert.
|
|||
warpdrive.video_channel.tooltip=Videokanal auf %1$d gestellt
|
||||
warpdrive.video_channel.get=Videokanal %2$d wurde von %1$s abgerufen
|
||||
warpdrive.video_channel.set=%1$s ist jetzt auf Videokanal %2$d gestellt
|
||||
warpdrive.video_channel.status_line.valid=Videokanal %1$d ist gültig.
|
||||
warpdrive.video_channel.status_line.validCamera=Videokanal %1$d ist gültig für die Kamera bei %2$d, %3$d, %4$d.
|
||||
warpdrive.video_channel.status_line.valid_camera=Videokanal %1$d ist gültig.
|
||||
warpdrive.video_channel.status_line.valid_monitor=Videokanal %1$d ist gültig für die Kamera bei %2$d, %3$d, %4$d.
|
||||
warpdrive.video_channel.status_line.invalid=§cVideokanal %1$d ist ungültig.
|
||||
warpdrive.video_channel.status_line.not_loaded=§cVideokanal %1$d ist ungültig oder die Kamera ist zu weit weg!
|
||||
warpdrive.video_channel.status_line.undefined=§7Nicht definierter Videokanal.\n§bNutze eine Stimmgabel§r um ihn einzustellen.
|
||||
|
|
|
@ -666,8 +666,8 @@ warpdrive.upgrade.status_line.valid=Upgraded with %1$s.
|
|||
warpdrive.video_channel.tooltip=Video channel is set to %1$d
|
||||
warpdrive.video_channel.get=Video channel %2$d has been retrieved from %1$s
|
||||
warpdrive.video_channel.set=%1$s is now tuned to Video channel %2$d
|
||||
warpdrive.video_channel.status_line.valid=Video channel %1$d is valid.
|
||||
warpdrive.video_channel.status_line.validCamera=Video channel %1$d is valid for camera at %2$d, %3$d, %4$d.
|
||||
warpdrive.video_channel.status_line.valid_camera=Video channel %1$d is valid.
|
||||
warpdrive.video_channel.status_line.valid_monitor=Video channel %1$d is valid for camera at %2$d, %3$d, %4$d.
|
||||
warpdrive.video_channel.status_line.invalid=§cVideo channel %1$d is invalid.
|
||||
warpdrive.video_channel.status_line.not_loaded=§cVideo channel %1$d is invalid or camera is too far away!
|
||||
warpdrive.video_channel.status_line.undefined=§7Undefined Video channel.\n§bUse a Tuning fork§r to set it.
|
||||
|
|
|
@ -666,8 +666,8 @@ warpdrive.upgrade.status_line.valid=Augmenté avec %1$s.
|
|||
warpdrive.video_channel.tooltip=Canal vidéo ajusté à %1$d
|
||||
warpdrive.video_channel.get=Le canal vidéo %2$d a été recupéré depuis %1$s
|
||||
warpdrive.video_channel.set=%1$s est désormais accordé au Canal vidéo %2$d
|
||||
warpdrive.video_channel.status_line.valid=Le canal vidéo %1$d est valide.
|
||||
warpdrive.video_channel.status_line.validCamera=Le canal vidéo %1$d est valide pour la caméra à %2$d %3$d %4$d.
|
||||
warpdrive.video_channel.status_line.valid_camera=Le canal vidéo %1$d est valide.
|
||||
warpdrive.video_channel.status_line.valid_monitor=Le canal vidéo %1$d est valide pour la caméra à %2$d %3$d %4$d.
|
||||
warpdrive.video_channel.status_line.invalid=§cLe canal vidéo %1$d est invalide.
|
||||
warpdrive.video_channel.status_line.not_loaded=§cLe canal vidéo %1$d est invalide ou la caméra est trop loin!
|
||||
warpdrive.video_channel.status_line.undefined=§7Le canal vidéo est non défini.\n§bUtilises un Diapason§r pour l'ajuster.
|
||||
|
|
|
@ -666,8 +666,8 @@ warpdrive.upgrade.status_line.valid=Geupgrade met1$s.
|
|||
warpdrive.video_channel.tooltip=Videokanaal is gezet naar %1$d
|
||||
warpdrive.video_channel.get=Videokanaal %2$d is achterhaald door %1$s
|
||||
warpdrive.video_channel.set=%1$s is nu afgestemd op videokanaal %2$d
|
||||
warpdrive.video_channel.status_line.valid=Videokanaal %1$d is geldig.
|
||||
warpdrive.video_channel.status_line.validCamera=Videokanaal %1$d is geldig voor camera op %2$d, %3$d, %4$d.
|
||||
warpdrive.video_channel.status_line.valid_camera=Videokanaal %1$d is geldig.
|
||||
warpdrive.video_channel.status_line.valid_monitor=Videokanaal %1$d is geldig voor camera op %2$d, %3$d, %4$d.
|
||||
warpdrive.video_channel.status_line.invalid=§cVideokanaal %1$d is ongeldig.
|
||||
warpdrive.video_channel.status_line.not_loaded=§cVideokanaal %1$d is ongeldig of camera is te ver weg!
|
||||
warpdrive.video_channel.status_line.undefined=§7niet gedefinieerd videokanaal.\n§bGebruik een Afstemmingsvork§r om het te zetten.
|
||||
|
|
|
@ -666,8 +666,8 @@ warpdrive.upgrade.status_line.valid=Upgraded with %1$s.
|
|||
warpdrive.video_channel.tooltip=Видеоканал установлен на %1$d
|
||||
warpdrive.video_channel.get=Video channel %2$d has been retrieved from %1$s
|
||||
warpdrive.video_channel.set=%1$s настроен на видеоканал %2$d
|
||||
warpdrive.video_channel.status_line.valid=Видеоканал %1$d действителен.
|
||||
warpdrive.video_channel.status_line.validCamera=Видеоканал %1$d действителен для камеры на %2$d, %3$d, %4$d.
|
||||
warpdrive.video_channel.status_line.valid_camera=Видеоканал %1$d действителен.
|
||||
warpdrive.video_channel.status_line.valid_monitor=Видеоканал %1$d действителен для камеры на %2$d, %3$d, %4$d.
|
||||
warpdrive.video_channel.status_line.invalid=§cВидеоканал %1$d недействителен.
|
||||
warpdrive.video_channel.status_line.not_loaded=§cВидеоканал %1$d недействителен или камера слишком далеко.
|
||||
warpdrive.video_channel.status_line.undefined=§7Undefined Video channel.\n§bUse a Tuning fork§r to set it.
|
||||
|
|
|
@ -666,8 +666,8 @@ warpdrive.upgrade.status_line.valid=用升级%1$s.
|
|||
warpdrive.video_channel.tooltip-tbc=频道设置为%1$d
|
||||
warpdrive.video_channel.get=视频频道 %2$d 已从频道 %1$s 断开
|
||||
warpdrive.video_channel.set=%1$s正在切换至频道%2$d
|
||||
warpdrive.video_channel.status_line.valid=视频通道%1$d有效
|
||||
warpdrive.video_channel.status_line.validCamera=相机的视频通道 %1$d有效,位于%2$d, %3$d, %4$d.
|
||||
warpdrive.video_channel.status_line.valid_camera=视频通道%1$d有效
|
||||
warpdrive.video_channel.status_line.valid_monitor=相机的视频通道 %1$d有效,位于%2$d, %3$d, %4$d.
|
||||
warpdrive.video_channel.status_line.invalid=§c视频通道 %1$d 无效.
|
||||
warpdrive.video_channel.status_line.not_loaded=§c视频通道 %1$d 无效或者是相机的距离太远!
|
||||
warpdrive.video_channel.status_line.undefined=§7未定义的视频通道.\n§b使用一个音叉§r 去设置它.
|
||||
|
|
|
@ -664,7 +664,7 @@ warpdrive.upgrade.status_line.valid=已升級 %1$s.
|
|||
warpdrive.video_channel.tooltip=視頻頻道設置為 %1$d
|
||||
warpdrive.video_channel.get=Video channel %2$d has been retrieved from %1$s
|
||||
warpdrive.video_channel.set=%1$s 現在調整為視頻頻道 %2$d
|
||||
warpdrive.video_channel.status_line.valid=視頻頻道 %1$d 有效。
|
||||
warpdrive.video_channel.status_line.valid_camera=視頻頻道 %1$d 有效。
|
||||
warpdrive.video_channel.status_line.validCamera視頻頻道 %1$d 對於攝像機 %2$d, %3$d, %4$d 有效
|
||||
warpdrive.video_channel.status_line.invalid=§c視頻頻道 %1$d 是無效的。
|
||||
warpdrive.video_channel.status_line.not_loaded=§c視頻頻道 %1$d 是無效的或者錄像機太過遙遠。
|
||||
|
|
Loading…
Reference in a new issue