62 |
|
|
63 |
loadBlocks(); |
loadBlocks(); |
64 |
|
|
65 |
|
|
66 |
for (int w=0; w<width; w++) { |
for (int w=0; w<width; w++) { |
67 |
for (int h=0; h<height; h++) { |
for (int h=0; h<height; h++) { |
68 |
Door d = store.findDoor( blocks[w][h] ); |
Door d = store.findDoor( blocks[w][h] ); |
92 |
|
|
93 |
loadBlocks(); |
loadBlocks(); |
94 |
} |
} |
95 |
|
|
96 |
|
public void powerChange(World world, int oldCurrent, int newCurrent ) { |
97 |
|
if (isPowered() == true) { |
98 |
|
open(); |
99 |
|
} else { |
100 |
|
close(); |
101 |
|
} |
102 |
|
} |
103 |
|
|
104 |
|
public boolean isPowered() { |
105 |
|
for (int w=0; w<width; w++) { |
106 |
|
for (int h=0; h<height; h++) { |
107 |
|
Block b = blocks[w][h].getBlock(); |
108 |
|
|
109 |
|
if ( b.isBlockPowered() || b.isBlockIndirectlyPowered() ) |
110 |
|
return true; |
111 |
|
} |
112 |
|
} |
113 |
|
|
114 |
|
return false; |
115 |
|
} |
116 |
|
|
117 |
private void loadBlocks() { |
private void loadBlocks() { |
118 |
|
|
185 |
|
|
186 |
} |
} |
187 |
|
|
188 |
public void open(World world) { |
public void open() { |
189 |
for (int w=0; w<width; w++) { |
for (int w=0; w<width; w++) { |
190 |
for (int h=0; h<height; h++) { |
for (int h=0; h<height; h++) { |
191 |
blocks[w][h].getBlock().setTypeId(0); |
blocks[w][h].getBlock().setTypeId(0, false); |
192 |
} |
} |
193 |
} |
} |
194 |
|
|
195 |
} |
} |
196 |
|
|
197 |
public void close(World world) { |
public void close() { |
198 |
for (int w=0; w<width; w++) { |
for (int w=0; w<width; w++) { |
199 |
for (int h=0; h<height; h++) { |
for (int h=0; h<height; h++) { |
200 |
blocks[w][h].getBlock().setTypeId( material ); |
blocks[w][h].getBlock().setTypeId( material ); |