Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
1package net.minecraft.server;
2
3public class TileEntitySign extends TileEntity {
4
5 public String[] lines = new String[] { "", "", "", "" };
6 public int b = -1;
7 private boolean isEditable = true;
8
9 public TileEntitySign() {
10 }
11
12 public void b(NBTTagCompound nbttagcompound) {
13 super.b(nbttagcompound);
14 nbttagcompound.setString("Text1", this.lines[0]);
15 nbttagcompound.setString("Text2", this.lines[1]);
16 nbttagcompound.setString("Text3", this.lines[2]);
17 nbttagcompound.setString("Text4", this.lines[3]);
18 }
19
20 public void a(NBTTagCompound nbttagcompound) {
21 this.isEditable = false;
22 super.a(nbttagcompound);
23
24 for (int i = 0; i < 4; ++i) {
25 this.lines[i] = nbttagcompound.getString("Text" + (i + 1));
26 if (this.lines[i].length() > 15) {
27 this.lines[i] = this.lines[i].substring(0, 15);
28 }
29 }
30 }
31
32 public Packet f() {
33 String[] astring = new String[4];
34
35 for (int i = 0; i < 4; ++i) {
36 astring[i] = this.lines[i];
37
38 // CraftBukkit start - limit sign text to 15 chars per line
39 if (this.lines[i].length() > 15) {
40 astring[i] = this.lines[i].substring(0, 15);
41 }
42 // CraftBukkit end
43 }
44
45 return new Packet130UpdateSign(this.x, this.y, this.z, astring);
46 }
47
48 public boolean a() {
49 return this.isEditable;
50 }
51
52 public void a(boolean flag) {
53 this.isEditable = flag;
54 }
55}