2011-04-23 07:09:50 +02:00
|
|
|
package net.minecraft.server;
|
|
|
|
|
|
|
|
public class TileEntitySign extends TileEntity {
|
|
|
|
|
|
|
|
public String[] lines = new String[] { "", "", "", ""};
|
2013-11-04 14:07:38 +01:00
|
|
|
public int i = -1;
|
2013-03-25 05:22:32 +01:00
|
|
|
public boolean isEditable = true; // CraftBukkit - private -> public
|
2013-11-04 14:07:38 +01:00
|
|
|
private EntityHuman k;
|
2011-04-23 07:09:50 +02:00
|
|
|
|
|
|
|
public TileEntitySign() {}
|
|
|
|
|
|
|
|
public void b(NBTTagCompound nbttagcompound) {
|
|
|
|
super.b(nbttagcompound);
|
|
|
|
nbttagcompound.setString("Text1", this.lines[0]);
|
|
|
|
nbttagcompound.setString("Text2", this.lines[1]);
|
|
|
|
nbttagcompound.setString("Text3", this.lines[2]);
|
|
|
|
nbttagcompound.setString("Text4", this.lines[3]);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void a(NBTTagCompound nbttagcompound) {
|
2011-06-27 00:25:01 +02:00
|
|
|
this.isEditable = false;
|
2011-04-23 07:09:50 +02:00
|
|
|
super.a(nbttagcompound);
|
|
|
|
|
|
|
|
for (int i = 0; i < 4; ++i) {
|
|
|
|
this.lines[i] = nbttagcompound.getString("Text" + (i + 1));
|
|
|
|
if (this.lines[i].length() > 15) {
|
|
|
|
this.lines[i] = this.lines[i].substring(0, 15);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-06 13:05:28 +01:00
|
|
|
public Packet getUpdatePacket() {
|
2011-04-23 07:09:50 +02:00
|
|
|
String[] astring = new String[4];
|
|
|
|
|
2013-03-25 05:22:32 +01:00
|
|
|
// CraftBukkit start - Limit sign text to 15 chars per line
|
2011-04-23 07:09:50 +02:00
|
|
|
for (int i = 0; i < 4; ++i) {
|
|
|
|
astring[i] = this.lines[i];
|
|
|
|
|
|
|
|
if (this.lines[i].length() > 15) {
|
|
|
|
astring[i] = this.lines[i].substring(0, 15);
|
|
|
|
}
|
|
|
|
}
|
2012-07-29 09:33:13 +02:00
|
|
|
// CraftBukkit end
|
2011-04-23 07:09:50 +02:00
|
|
|
|
2013-11-04 14:07:38 +01:00
|
|
|
return new PacketPlayOutUpdateSign(this.x, this.y, this.z, astring);
|
2011-04-23 07:09:50 +02:00
|
|
|
}
|
|
|
|
|
2012-07-29 09:33:13 +02:00
|
|
|
public boolean a() {
|
2011-06-27 00:25:01 +02:00
|
|
|
return this.isEditable;
|
2011-04-23 07:09:50 +02:00
|
|
|
}
|
2013-07-09 01:43:37 +02:00
|
|
|
|
|
|
|
public void a(EntityHuman entityhuman) {
|
2013-11-04 14:07:38 +01:00
|
|
|
this.k = entityhuman;
|
2013-07-09 01:43:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public EntityHuman b() {
|
2013-11-04 14:07:38 +01:00
|
|
|
return this.k;
|
2013-07-09 01:43:37 +02:00
|
|
|
}
|
2011-04-23 07:09:50 +02:00
|
|
|
}
|