Convert strings to chat messages

Fixes https://github.com/BuildCraft/BuildCraft/issues/1027
This commit is contained in:
viliml 2013-07-21 14:39:56 +02:00
parent 502af8f9ae
commit 32adf8a309

View file

@ -17,6 +17,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet3Chat; import net.minecraft.network.packet.Packet3Chat;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChatMessageComponent;
import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.ChunkCoordIntPair;
import net.minecraftforge.common.ForgeChunkManager; import net.minecraftforge.common.ForgeChunkManager;
import net.minecraftforge.common.ForgeChunkManager.Ticket; import net.minecraftforge.common.ForgeChunkManager.Ticket;
@ -514,8 +515,8 @@ public class TileQuarry extends TileBuildCraft implements IMachine, IPowerRecept
isAlive = false; isAlive = false;
if (placedBy != null && CoreProxy.proxy.isSimulating(worldObj)) { if (placedBy != null && CoreProxy.proxy.isSimulating(worldObj)) {
PacketDispatcher.sendPacketToPlayer( PacketDispatcher.sendPacketToPlayer(
new Packet3Chat(String.format("[BUILDCRAFT] The quarry at %d, %d, %d will not work because there are no more chunkloaders available", new Packet3Chat(ChatMessageComponent.func_111066_d(String.format("[BUILDCRAFT] The quarry at %d, %d, %d will not work because there are no more chunkloaders available",
xCoord, yCoord, zCoord)), (Player) placedBy); xCoord, yCoord, zCoord))), (Player) placedBy);
} }
sendNetworkUpdate(); sendNetworkUpdate();
return; return;
@ -543,8 +544,8 @@ public class TileQuarry extends TileBuildCraft implements IMachine, IPowerRecept
if (xSize < 3 || zSize < 3 || ((xSize * zSize) >> 8) >= chunkTicket.getMaxChunkListDepth()) { if (xSize < 3 || zSize < 3 || ((xSize * zSize) >> 8) >= chunkTicket.getMaxChunkListDepth()) {
if (placedBy != null) { if (placedBy != null) {
PacketDispatcher.sendPacketToPlayer( PacketDispatcher.sendPacketToPlayer(
new Packet3Chat(String.format("Quarry size is outside of chunkloading bounds or too small %d %d (%d)", xSize, zSize, new Packet3Chat(ChatMessageComponent.func_111066_d(String.format("Quarry size is outside of chunkloading bounds or too small %d %d (%d)", xSize, zSize,
chunkTicket.getMaxChunkListDepth())), (Player) placedBy); chunkTicket.getMaxChunkListDepth()))), (Player) placedBy);
} }
a = new DefaultAreaProvider(xCoord, yCoord, zCoord, xCoord + 10, yCoord + 4, zCoord + 10); a = new DefaultAreaProvider(xCoord, yCoord, zCoord, xCoord + 10, yCoord + 4, zCoord + 10);
@ -839,7 +840,7 @@ public class TileQuarry extends TileBuildCraft implements IMachine, IPowerRecept
} }
if (placedBy != null) { if (placedBy != null) {
PacketDispatcher.sendPacketToPlayer( PacketDispatcher.sendPacketToPlayer(
new Packet3Chat(String.format("[BUILDCRAFT] The quarry at %d %d %d will keep %d chunks loaded", xCoord, yCoord, zCoord, chunks.size())), new Packet3Chat(ChatMessageComponent.func_111066_d(String.format("[BUILDCRAFT] The quarry at %d %d %d will keep %d chunks loaded", xCoord, yCoord, zCoord, chunks.size()))),
(Player) placedBy); (Player) placedBy);
} }
sendNetworkUpdate(); sendNetworkUpdate();