18 |
|
|
19 |
|
|
20 |
private Location blocks[][]; // [width][height] - [0][0] == leftUpper |
private Location blocks[][]; // [width][height] - [0][0] == leftUpper |
21 |
|
private int material[][]; |
22 |
private int material; |
private byte data[][]; |
23 |
|
|
24 |
private int direction; |
private int direction; |
25 |
|
|
37 |
|
|
38 |
this.owner = owner; |
this.owner = owner; |
39 |
|
|
|
blocks = new Location[width][height]; |
|
40 |
|
|
41 |
direction = sign.getData() - 2; |
direction = sign.getData() - 2; |
42 |
|
|
57 |
|
|
58 |
|
|
59 |
|
|
60 |
material = leftUpper.getBlock().getTypeId(); |
//material = leftUpper.getBlock().getTypeId(); |
61 |
|
|
62 |
loadBlocks(); |
loadBlocks(); |
63 |
|
|
80 |
|
|
81 |
leftUpper = new Location(w, Integer.parseInt(parts[1]), Integer.parseInt(parts[2]), Integer.parseInt(parts[3]) ); |
leftUpper = new Location(w, Integer.parseInt(parts[1]), Integer.parseInt(parts[2]), Integer.parseInt(parts[3]) ); |
82 |
direction = Integer.parseInt( parts[4] ); |
direction = Integer.parseInt( parts[4] ); |
83 |
material = Integer.parseInt( parts[5] ); |
//material = Integer.parseInt( parts[5] ); |
84 |
|
|
85 |
width = Integer.parseInt( parts[6] ); |
width = Integer.parseInt( parts[6] ); |
86 |
height = Integer.parseInt( parts[7] ); |
height = Integer.parseInt( parts[7] ); |
87 |
owner = parts[8]; |
owner = parts[8]; |
88 |
|
|
|
|
|
|
blocks = new Location[width][height]; |
|
89 |
|
|
90 |
loadBlocks(); |
loadBlocks(); |
91 |
} |
} |
112 |
} |
} |
113 |
|
|
114 |
private void loadBlocks() { |
private void loadBlocks() { |
115 |
|
blocks = new Location[width][height]; |
116 |
|
material = new int[width][height]; |
117 |
|
data = new byte[width][height]; |
118 |
|
|
119 |
for (int w=0; w<width; w++) { |
for (int w=0; w<width; w++) { |
120 |
for (int h=0; h<height; h++) { |
for (int h=0; h<height; h++) { |
142 |
//System.out.println("Add block: " + x + ":" + y + ":" + z); |
//System.out.println("Add block: " + x + ":" + y + ":" + z); |
143 |
|
|
144 |
blocks[w][h] = new Location( leftUpper.getWorld(), x, y, z); |
blocks[w][h] = new Location( leftUpper.getWorld(), x, y, z); |
145 |
|
|
146 |
|
material[w][h] = blocks[w][h].getBlock().getTypeId(); |
147 |
|
data[w][h] = blocks[w][h].getBlock().getData(); |
148 |
|
|
149 |
} |
} |
150 |
} |
} |
161 |
|
|
162 |
sb.append( ":" + direction ); |
sb.append( ":" + direction ); |
163 |
|
|
164 |
sb.append( ":" + material ); |
sb.append( ":" + material[0][0] ); |
165 |
|
|
166 |
sb.append( ":" + width ); |
sb.append( ":" + width ); |
167 |
sb.append( ":" + height ); |
sb.append( ":" + height ); |
200 |
public void close() { |
public void close() { |
201 |
for (int w=0; w<width; w++) { |
for (int w=0; w<width; w++) { |
202 |
for (int h=0; h<height; h++) { |
for (int h=0; h<height; h++) { |
203 |
blocks[w][h].getBlock().setTypeId( material ); |
blocks[w][h].getBlock().setTypeIdAndData( material[w][h], data[w][h], true ); |
204 |
} |
} |
205 |
} |
} |
206 |
} |
} |