@Override public void sendSignChange(Location loc, String[] lines) { if (getHandle().playerNetServerHandler == null) { return; } if (lines == null) { lines = new String[4]; } Validate.notNull(loc, "Location can not be null"); if (lines.length < 4) { throw new IllegalArgumentException("Must have at least 4 lines"); } // Limit to 15 chars per line and set null lines to blank String[] astring = CraftSign.sanitizeLines(lines); getHandle().playerNetServerHandler.sendPacket(new S33PacketUpdateSign(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), astring)); }
/** * Updates a specified sign with the specified text lines */ public void handleUpdateSign(S33PacketUpdateSign packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); boolean flag = false; if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos())) { TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos()); if (tileentity instanceof TileEntitySign) { TileEntitySign tileentitysign = (TileEntitySign) tileentity; if (tileentitysign.getIsEditable()) { System.arraycopy(packetIn.getLines(), 0, tileentitysign.signText, 0, 4); tileentitysign.markDirty(); } flag = true; } } if (!flag && this.gameController.thePlayer != null) { this.gameController.thePlayer.addChatMessage(new ChatComponentText("Unable to locate sign at " + packetIn.getPos().getX() + ", " + packetIn.getPos().getY() + ", " + packetIn.getPos().getZ())); } }
public Packet getDescriptionPacket() { String[] astring = new String[4]; // CraftBukkit start - Limit sign text to 15 chars per line for (int i = 0; i < 4; ++i) { astring[i] = this.signText[i]; if (this.signText[i].length() > 15) { astring[i] = this.signText[i].substring(0, 15); } } // CraftBukkit end return new S33PacketUpdateSign(this.xCoord, this.yCoord, this.zCoord, astring); }
/** * Allows for a specialized description packet to be created. This is often used to sync tile entity data from the * server to the client easily. For example this is used by signs to synchronise the text to be displayed. */ public Packet getDescriptionPacket() { IChatComponent[] aichatcomponent = new IChatComponent[4]; System.arraycopy(this.signText, 0, aichatcomponent, 0, 4); return new S33PacketUpdateSign(this.worldObj, this.pos, aichatcomponent); }
/** * Updates a specified sign with the specified text lines */ public void handleUpdateSign(S33PacketUpdateSign packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); boolean flag = false; if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos())) { TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos()); if (tileentity instanceof TileEntitySign) { TileEntitySign tileentitysign = (TileEntitySign)tileentity; if (tileentitysign.getIsEditable()) { System.arraycopy(packetIn.getLines(), 0, tileentitysign.signText, 0, 4); tileentitysign.markDirty(); } flag = true; } } if (!flag && this.gameController.thePlayer != null) { this.gameController.thePlayer.addChatMessage(new ChatComponentText("Unable to locate sign at " + packetIn.getPos().getX() + ", " + packetIn.getPos().getY() + ", " + packetIn.getPos().getZ())); } }
/** * Updates a specified sign with the specified text lines */ public void handleUpdateSign(S33PacketUpdateSign p_147248_1_) { boolean var2 = false; if (this.gameController.theWorld.blockExists(p_147248_1_.func_149346_c(), p_147248_1_.func_149345_d(), p_147248_1_.func_149344_e())) { TileEntity var3 = this.gameController.theWorld.getTileEntity(p_147248_1_.func_149346_c(), p_147248_1_.func_149345_d(), p_147248_1_.func_149344_e()); if (var3 instanceof TileEntitySign) { TileEntitySign var4 = (TileEntitySign)var3; if (var4.func_145914_a()) { for (int var5 = 0; var5 < 4; ++var5) { var4.field_145915_a[var5] = p_147248_1_.func_149347_f()[var5]; } var4.onInventoryChanged(); } var2 = true; } } if (!var2 && this.gameController.thePlayer != null) { this.gameController.thePlayer.addChatMessage(new ChatComponentText("Unable to locate sign at " + p_147248_1_.func_149346_c() + ", " + p_147248_1_.func_149345_d() + ", " + p_147248_1_.func_149344_e())); } }
/** * Overriden in a sign to provide the text. */ public Packet getDescriptionPacket() { String[] var1 = new String[4]; System.arraycopy(this.field_145915_a, 0, var1, 0, 4); return new S33PacketUpdateSign(this.field_145851_c, this.field_145848_d, this.field_145849_e, var1); }
@Override public Packet updateSign(int x, int y, int z, String[] text) { final List<ChatComponentText> texts = Lists.newArrayList(); for (String t : text) { texts.add(new ChatComponentText(t)); } return (Packet) new S33PacketUpdateSign(null, new BlockPos(x, y, z), texts.toArray(new ChatComponentText[texts.size()])); }
public void handleUpdateSign(S33PacketUpdateSign p_147248_1_) { boolean flag = false; if (this.gameController.theWorld.blockExists(p_147248_1_.func_149346_c(), p_147248_1_.func_149345_d(), p_147248_1_.func_149344_e())) { TileEntity tileentity = this.gameController.theWorld.getTileEntity(p_147248_1_.func_149346_c(), p_147248_1_.func_149345_d(), p_147248_1_.func_149344_e()); if (tileentity instanceof TileEntitySign) { TileEntitySign tileentitysign = (TileEntitySign)tileentity; if (tileentitysign.func_145914_a()) { for (int i = 0; i < 4; ++i) { tileentitysign.signText[i] = p_147248_1_.func_149347_f()[i]; } tileentitysign.markDirty(); } flag = true; } } if (!flag && this.gameController.thePlayer != null) { this.gameController.thePlayer.addChatMessage(new ChatComponentText("Unable to locate sign at " + p_147248_1_.func_149346_c() + ", " + p_147248_1_.func_149345_d() + ", " + p_147248_1_.func_149344_e())); } }
public Packet getDescriptionPacket() { String[] astring = new String[4]; System.arraycopy(this.signText, 0, astring, 0, 4); return new S33PacketUpdateSign(this.xCoord, this.yCoord, this.zCoord, astring); }
/** * Updates a specified sign with the specified text lines */ void handleUpdateSign(S33PacketUpdateSign packetIn);
/** * Updates a specified sign with the specified text lines */ void handleUpdateSign(S33PacketUpdateSign var1);
void handleUpdateSign(S33PacketUpdateSign p_147248_1_);