Fixed debug logs and multiline chat messages

This commit is contained in:
LemADEC 2015-08-09 05:07:19 +02:00
parent a97e0ccf6c
commit c01ff627f8
22 changed files with 44 additions and 57 deletions

View file

@ -17,7 +17,7 @@ buildscript {
apply plugin: 'forge' apply plugin: 'forge'
version = "1.3.1" version = "1.3.2dev"
group = "cr0s.warpdrive" // http://maven.apache.org/guides/mini/guide-naming-conventions.html group = "cr0s.warpdrive" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "warpdrive" archivesBaseName = "warpdrive"

View file

@ -19,7 +19,6 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.ChunkCoordIntPair;
@ -293,8 +292,8 @@ public class EntityJump extends Entity {
WarpDrive.logger.info("" + this + " messageToAllPlayersOnShip: " + msg); WarpDrive.logger.info("" + this + " messageToAllPlayersOnShip: " + msg);
for (MovingEntity me : entitiesOnShip) { for (MovingEntity me : entitiesOnShip) {
if (me.entity instanceof EntityPlayer) { if (me.entity instanceof EntityPlayer) {
((EntityPlayer) me.entity).addChatMessage(new ChatComponentText("[" WarpDrive.addChatMessage((EntityPlayer) me.entity, "["
+ ((reactor != null && reactor.coreFrequency.length() > 0) ? reactor.coreFrequency : "WarpCore") + "] " + msg)); + ((reactor != null && reactor.coreFrequency.length() > 0) ? reactor.coreFrequency : "WarpCore") + "] " + msg);
} }
} }
} }

View file

@ -8,6 +8,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.Item; import net.minecraft.item.Item;
@ -15,6 +16,7 @@ import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldServer; import net.minecraft.world.WorldServer;
import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.BiomeGenBase;
@ -213,7 +215,7 @@ public class WarpDrive implements LoadingCallback {
public static void debugPrint(String out) { public static void debugPrint(String out) {
if (WarpDriveConfig.G_DEBUGMODE) { if (WarpDriveConfig.G_DEBUGMODE) {
logger.debug(out); logger.info(out);
} }
} }
@ -667,4 +669,11 @@ public class WarpDrive implements LoadingCallback {
ForgeChunkManager.releaseTicket(ticket); ForgeChunkManager.releaseTicket(ticket);
} }
} }
public static void addChatMessage(final EntityPlayer player, final String message) {
String[] lines = message.split("\n");
for (String line : lines) {
player.addChatMessage(new ChatComponentText(line));
}
}
} }

View file

@ -5,7 +5,6 @@ import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender; import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.DimensionManager;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
@ -82,7 +81,7 @@ public class DebugCommand extends CommandBase
catch (Exception e) catch (Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
player.addChatMessage(new ChatComponentText(getCommandUsage(icommandsender))); WarpDrive.addChatMessage(player, getCommandUsage(icommandsender));
return; return;
} }
@ -150,7 +149,7 @@ public class DebugCommand extends CommandBase
} }
else else
{ {
player.addChatMessage(new ChatComponentText(getCommandUsage(icommandsender))); WarpDrive.addChatMessage(player, getCommandUsage(icommandsender));
} }
} }

View file

@ -3,7 +3,6 @@ package cr0s.warpdrive.command;
import net.minecraft.command.CommandBase; import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender; import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.WarpDrive;
@ -42,7 +41,7 @@ public class GenerateCommand extends CommandBase {
// Reject command, if player is not in space // Reject command, if player is not in space
if (player.dimension != WarpDriveConfig.G_SPACE_DIMENSION_ID && (!"ship".equals(struct))) { if (player.dimension != WarpDriveConfig.G_SPACE_DIMENSION_ID && (!"ship".equals(struct))) {
player.addChatMessage(new ChatComponentText("* generate: this structure is only allowed in space!")); WarpDrive.addChatMessage(player, "* generate: this structure is only allowed in space!");
return; return;
} }
@ -84,11 +83,11 @@ public class GenerateCommand extends CommandBase {
} }
} }
} else { } else {
player.addChatMessage(new ChatComponentText(getCommandUsage(icommandsender))); WarpDrive.addChatMessage(player, getCommandUsage(icommandsender));
} }
} }
} else { } else {
player.addChatMessage(new ChatComponentText(getCommandUsage(icommandsender))); WarpDrive.addChatMessage(player, getCommandUsage(icommandsender));
} }
} }
} }

View file

@ -3,7 +3,6 @@ package cr0s.warpdrive.command;
import net.minecraft.command.CommandBase; import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender; import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.ChatComponentText;
import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.WarpDrive;
public class JumpgateCommand extends CommandBase { public class JumpgateCommand extends CommandBase {
@ -25,6 +24,6 @@ public class JumpgateCommand extends CommandBase {
@Override @Override
public void processCommand(ICommandSender icommandsender, String[] astring) { public void processCommand(ICommandSender icommandsender, String[] astring) {
EntityPlayerMP player = (EntityPlayerMP) icommandsender; EntityPlayerMP player = (EntityPlayerMP) icommandsender;
player.addChatMessage(new ChatComponentText(WarpDrive.jumpgates.commaList())); WarpDrive.addChatMessage(player, WarpDrive.jumpgates.commaList());
} }
} }

View file

@ -11,7 +11,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
@ -95,7 +94,7 @@ public class BlockAirGenerator extends BlockContainer
if (te != null) { if (te != null) {
ItemStack heldItemStack = player.getHeldItem(); ItemStack heldItemStack = player.getHeldItem();
if (heldItemStack == null) { if (heldItemStack == null) {
player.addChatMessage(new ChatComponentText(te.getStatus())); WarpDrive.addChatMessage(player, te.getStatus());
return true; return true;
} else { } else {
Item heldItem = heldItemStack.getItem(); Item heldItem = heldItemStack.getItem();

View file

@ -9,7 +9,6 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
@ -80,9 +79,9 @@ public class BlockCamera extends BlockContainer {
CamRegistryItem cam = WarpDrive.instance.cams.getCamByFrequency(par1World, frequency); CamRegistryItem cam = WarpDrive.instance.cams.getCamByFrequency(par1World, frequency);
if (cam == null) { if (cam == null) {
WarpDrive.instance.cams.printRegistry(par1World); WarpDrive.instance.cams.printRegistry(par1World);
par5EntityPlayer.addChatMessage(new ChatComponentText(getLocalizedName() + " Frequency '" + frequency + "' is invalid!")); WarpDrive.addChatMessage(par5EntityPlayer, getLocalizedName() + " Frequency '" + frequency + "' is invalid!");
} else { } else {
par5EntityPlayer.addChatMessage(new ChatComponentText(getLocalizedName() + " Frequency '" + frequency + "' is valid for camera at " + cam.position.chunkPosX + ", " + cam.position.chunkPosY + ", " + cam.position.chunkPosZ)); WarpDrive.addChatMessage(par5EntityPlayer, getLocalizedName() + " Frequency '" + frequency + "' is valid for camera at " + cam.position.chunkPosX + ", " + cam.position.chunkPosY + ", " + cam.position.chunkPosZ);
} }
return true; return true;
} }

View file

@ -9,7 +9,6 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
@ -71,11 +70,11 @@ public class BlockCloakingDeviceCore extends BlockContainer {
TileEntityCloakingDeviceCore te = (TileEntityCloakingDeviceCore)par1World.getTileEntity(par2, par3, par4); TileEntityCloakingDeviceCore te = (TileEntityCloakingDeviceCore)par1World.getTileEntity(par2, par3, par4);
if (te != null && (par5EntityPlayer.getHeldItem() == null)) { if (te != null && (par5EntityPlayer.getHeldItem() == null)) {
par5EntityPlayer.addChatMessage(new ChatComponentText(te.getStatus() + "\n" WarpDrive.addChatMessage(par5EntityPlayer, te.getStatus()
// + " Valid? " + te.isValid + " Cloaking? " + te.isCloaking + " Enabled? " + te.isEnabled + "\n" // + " isInvalid? " + te.isInvalid() + " Valid? " + te.isValid + " Cloaking? " + te.isCloaking + " Enabled? " + te.isEnabled
+ ((!te.isValid) ? "Invalid assembly!" : + ((!te.isValid) ? "Invalid assembly!" :
((!te.isEnabled) ? "Cloak is disabled" : ((!te.isEnabled) ? "Cloak is disabled" :
((te.isCloaking) ? "A tier " + te.tier + " cloak is currently covering " + te.volume + " blocks!" : "Cloak needs more power!"))))); ((te.isCloaking) ? "A tier " + te.tier + " cloak is currently covering " + te.volume + " blocks!" : "Cloak needs more power!"))));
return true; return true;
} }

View file

@ -9,7 +9,6 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
@ -79,9 +78,9 @@ public class BlockLaserCam extends BlockContainer {
CamRegistryItem cam = WarpDrive.instance.cams.getCamByFrequency(par1World, cameraFrequency); CamRegistryItem cam = WarpDrive.instance.cams.getCamByFrequency(par1World, cameraFrequency);
WarpDrive.debugPrint("cam detected as " + cam); WarpDrive.debugPrint("cam detected as " + cam);
par5EntityPlayer.addChatMessage(new ChatComponentText(getLocalizedName() WarpDrive.addChatMessage(par5EntityPlayer, getLocalizedName()
+ ": Beam frequency '" + beamFrequency + "' is " + ((beamFrequency < 0) ? "invalid!" : "valid.") + ": Beam frequency '" + beamFrequency + "' is " + ((beamFrequency < 0) ? "invalid!" : "valid.")
+ " Camera frequency '" + cameraFrequency + "' is " + ((cam == null) ? "invalid!" : "valid for laser-camera at " + cam.position.chunkPosX + ", " + cam.position.chunkPosY + ", " + cam.position.chunkPosZ))); + " Camera frequency '" + cameraFrequency + "' is " + ((cam == null) ? "invalid!" : "valid for laser-camera at " + cam.position.chunkPosX + ", " + cam.position.chunkPosY + ", " + cam.position.chunkPosZ));
return true; return true;
} }

View file

@ -9,7 +9,6 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
@ -88,7 +87,7 @@ public class BlockLift extends BlockContainer
WarpEnergyTE te = (WarpEnergyTE)par1World.getTileEntity(par2, par3, par4); WarpEnergyTE te = (WarpEnergyTE)par1World.getTileEntity(par2, par3, par4);
if (te != null && (par5EntityPlayer.getHeldItem() == null)) { if (te != null && (par5EntityPlayer.getHeldItem() == null)) {
par5EntityPlayer.addChatMessage(new ChatComponentText(te.getStatus())); WarpDrive.addChatMessage(par5EntityPlayer, te.getStatus());
return true; return true;
} }

View file

@ -9,7 +9,6 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
@ -89,7 +88,7 @@ public class BlockMiningLaser extends BlockContainer {
TileEntityMiningLaser miningLaser = (TileEntityMiningLaser)par1World.getTileEntity(par2, par3, par4); TileEntityMiningLaser miningLaser = (TileEntityMiningLaser)par1World.getTileEntity(par2, par3, par4);
if (miningLaser != null && (par5EntityPlayer.getHeldItem() == null)) { if (miningLaser != null && (par5EntityPlayer.getHeldItem() == null)) {
par5EntityPlayer.addChatMessage(new ChatComponentText(miningLaser.getStatus())); WarpDrive.addChatMessage(par5EntityPlayer, miningLaser.getStatus());
return true; return true;
} }

View file

@ -8,7 +8,6 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
@ -75,10 +74,10 @@ public class BlockMonitor extends BlockContainer {
int frequency = ((TileEntityMonitor)te).getFrequency(); int frequency = ((TileEntityMonitor)te).getFrequency();
CamRegistryItem cam = WarpDrive.instance.cams.getCamByFrequency(par1World, frequency); CamRegistryItem cam = WarpDrive.instance.cams.getCamByFrequency(par1World, frequency);
if (cam == null) { if (cam == null) {
par5EntityPlayer.addChatMessage(new ChatComponentText(getLocalizedName() + " Frequency '" + frequency + "' is invalid or camera is too far!")); WarpDrive.addChatMessage(par5EntityPlayer, getLocalizedName() + " Frequency '" + frequency + "' is invalid or camera is too far!");
return false; return false;
} else { } else {
par5EntityPlayer.addChatMessage(new ChatComponentText(getLocalizedName() + " Frequency '" + frequency + "' is valid. Viewing camera at " + cam.position.chunkPosX + ", " + cam.position.chunkPosY + ", " + cam.position.chunkPosZ)); WarpDrive.addChatMessage(par5EntityPlayer, getLocalizedName() + " Frequency '" + frequency + "' is valid. Viewing camera at " + cam.position.chunkPosX + ", " + cam.position.chunkPosY + ", " + cam.position.chunkPosZ);
// Spawn camera entity // Spawn camera entity
EntityCamera e = new EntityCamera(par1World, cam.position, par5EntityPlayer); EntityCamera e = new EntityCamera(par1World, cam.position, par5EntityPlayer);
par1World.spawnEntityInWorld(e); par1World.spawnEntityInWorld(e);

View file

@ -9,7 +9,6 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
@ -85,7 +84,7 @@ public class BlockParticleBooster extends BlockContainer {
if (par5EntityPlayer.getHeldItem() == null) { if (par5EntityPlayer.getHeldItem() == null) {
TileEntity te = par1World.getTileEntity(par2, par3, par4); TileEntity te = par1World.getTileEntity(par2, par3, par4);
if (te != null && te instanceof WarpEnergyTE) { if (te != null && te instanceof WarpEnergyTE) {
par5EntityPlayer.addChatMessage(new ChatComponentText(((WarpEnergyTE) te).getStatus())); WarpDrive.addChatMessage(par5EntityPlayer, ((WarpEnergyTE) te).getStatus());
return true; return true;
} }
} }

View file

@ -3,10 +3,10 @@ package cr0s.warpdrive.machines;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
import cr0s.warpdrive.WarpDrive;
public class BlockPowerStore extends WarpBlockContainer { public class BlockPowerStore extends WarpBlockContainer {
private IIcon iconBuffer; private IIcon iconBuffer;
@ -41,7 +41,7 @@ public class BlockPowerStore extends WarpBlockContainer {
WarpEnergyTE te = (WarpEnergyTE) par1World.getTileEntity(par2, par3, par4); WarpEnergyTE te = (WarpEnergyTE) par1World.getTileEntity(par2, par3, par4);
if (te != null && (par5EntityPlayer.getHeldItem() == null)) { if (te != null && (par5EntityPlayer.getHeldItem() == null)) {
par5EntityPlayer.addChatMessage(new ChatComponentText(te.getStatus())); WarpDrive.addChatMessage(par5EntityPlayer, te.getStatus());
return true; return true;
} }

View file

@ -9,7 +9,6 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
@ -102,7 +101,7 @@ public class BlockProtocol extends BlockContainer {
TileEntityProtocol controller = (TileEntityProtocol)par1World.getTileEntity(par2, par3, par4); TileEntityProtocol controller = (TileEntityProtocol)par1World.getTileEntity(par2, par3, par4);
if (controller != null) { if (controller != null) {
controller.attachPlayer(par5EntityPlayer); controller.attachPlayer(par5EntityPlayer);
par5EntityPlayer.addChatMessage(new ChatComponentText(controller.getBlockType().getLocalizedName() + " Attached players: " + controller.getAttachedPlayersList())); WarpDrive.addChatMessage(par5EntityPlayer, controller.getBlockType().getLocalizedName() + " Attached players: " + controller.getAttachedPlayersList());
return true; return true;
} }
} }

View file

@ -9,7 +9,6 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
@ -91,7 +90,7 @@ public class BlockRadar extends BlockContainer
WarpEnergyTE te = (WarpEnergyTE)par1World.getTileEntity(par2, par3, par4); WarpEnergyTE te = (WarpEnergyTE)par1World.getTileEntity(par2, par3, par4);
if (te != null && (par5EntityPlayer.getHeldItem() == null)) { if (te != null && (par5EntityPlayer.getHeldItem() == null)) {
par5EntityPlayer.addChatMessage(new ChatComponentText(te.getStatus())); WarpDrive.addChatMessage(par5EntityPlayer, te.getStatus());
return true; return true;
} }

View file

@ -9,7 +9,6 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
@ -90,7 +89,7 @@ public class BlockReactor extends BlockContainer {
if (par5EntityPlayer.getHeldItem() == null) { if (par5EntityPlayer.getHeldItem() == null) {
TileEntity te = par1World.getTileEntity(par2, par3, par4); TileEntity te = par1World.getTileEntity(par2, par3, par4);
if (te != null && te instanceof TileEntityReactor) { if (te != null && te instanceof TileEntityReactor) {
par5EntityPlayer.addChatMessage(new ChatComponentText(((TileEntityReactor)te).getStatus())); WarpDrive.addChatMessage(par5EntityPlayer, ((TileEntityReactor)te).getStatus());
return true; return true;
} }
} }

View file

@ -9,7 +9,6 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
@ -77,7 +76,7 @@ public class BlockShipScanner extends BlockContainer {
WarpEnergyTE te = (WarpEnergyTE)par1World.getTileEntity(par2, par3, par4); WarpEnergyTE te = (WarpEnergyTE)par1World.getTileEntity(par2, par3, par4);
if (te != null && (par5EntityPlayer.getHeldItem() == null)) { if (te != null && (par5EntityPlayer.getHeldItem() == null)) {
par5EntityPlayer.addChatMessage(new ChatComponentText(te.getStatus())); WarpDrive.addChatMessage(par5EntityPlayer, te.getStatus());
return true; return true;
} }

View file

@ -1,8 +1,5 @@
package cr0s.warpdrive.machines; package cr0s.warpdrive.machines;
import java.lang.reflect.Array;
import java.util.Arrays;
import cpw.mods.fml.common.Optional; import cpw.mods.fml.common.Optional;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
@ -13,7 +10,6 @@ import cr0s.warpdrive.data.Vector3;
import cr0s.warpdrive.network.PacketHandler; import cr0s.warpdrive.network.PacketHandler;
import dan200.computercraft.api.lua.ILuaContext; import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.peripheral.IComputerAccess; import dan200.computercraft.api.peripheral.IComputerAccess;
import dan200.computercraft.api.peripheral.IPeripheral;
public class TileEntityPowerLaser extends TileEntityAbstractLaser implements IBlockUpdateDetector { public class TileEntityPowerLaser extends TileEntityAbstractLaser implements IBlockUpdateDetector {
Vector3 myVec; Vector3 myVec;

View file

@ -8,7 +8,6 @@ import li.cil.oc.api.machine.Context;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.DamageSource; import net.minecraft.util.DamageSource;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Optional; import cpw.mods.fml.common.Optional;
@ -171,7 +170,7 @@ public class TileEntityProtocol extends WarpInterfacedTE {
String name = players.get(i); String name = players.get(i);
if (entityPlayer.getDisplayName().equals(name)) { if (entityPlayer.getDisplayName().equals(name)) {
entityPlayer.addChatMessage(new ChatComponentText(getBlockType().getLocalizedName() + " Detached.")); WarpDrive.addChatMessage(entityPlayer, getBlockType().getLocalizedName() + " Detached.");
players.remove(i); players.remove(i);
return; return;
} }
@ -180,7 +179,7 @@ public class TileEntityProtocol extends WarpInterfacedTE {
entityPlayer.attackEntityFrom(DamageSource.generic, 1); entityPlayer.attackEntityFrom(DamageSource.generic, 1);
players.add(entityPlayer.getDisplayName()); players.add(entityPlayer.getDisplayName());
updatePlayersString(); updatePlayersString();
entityPlayer.addChatMessage(new ChatComponentText(getBlockType().getLocalizedName() + " Successfully attached.")); WarpDrive.addChatMessage(entityPlayer, getBlockType().getLocalizedName() + " Successfully attached.");
} }
public void updatePlayersString() { public void updatePlayersString() {

View file

@ -15,7 +15,6 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest; import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3; import net.minecraft.util.Vec3;
import net.minecraft.world.WorldServer; import net.minecraft.world.WorldServer;
@ -312,12 +311,12 @@ public class TileEntityReactor extends WarpEnergyTE {
List list = worldObj.getEntitiesWithinAABBExcludingEntity(null, axisalignedbb); List list = worldObj.getEntitiesWithinAABBExcludingEntity(null, axisalignedbb);
WarpDrive.logger.info(this + " messageToAllPlayersOnShip: " + msg); WarpDrive.logger.info(this + " messageToAllPlayersOnShip: " + msg);
for (Object o : list) { for (Object object : list) {
if (o == null || !(o instanceof EntityPlayer)) { if (object == null || !(object instanceof EntityPlayer)) {
continue; continue;
} }
((EntityPlayer) o).addChatMessage(new ChatComponentText("[" + (coreFrequency.length() > 0 ? coreFrequency : "WarpCore") + "] " + msg)); WarpDrive.addChatMessage((EntityPlayer) object, "[" + (coreFrequency.length() > 0 ? coreFrequency : "WarpCore") + "] " + msg);
} }
} }