94 |
} |
} |
95 |
|
|
96 |
public void powerChange(World world, int oldCurrent, int newCurrent ) { |
public void powerChange(World world, int oldCurrent, int newCurrent ) { |
97 |
if (newCurrent != 0 && isPowered() == true) { |
if (isPowered() == true) { |
98 |
open(); |
open(); |
99 |
} else { |
} else { |
100 |
close(); |
close(); |
104 |
public boolean isPowered() { |
public boolean isPowered() { |
105 |
for (int w=0; w<width; w++) { |
for (int w=0; w<width; w++) { |
106 |
for (int h=0; h<height; h++) { |
for (int h=0; h<height; h++) { |
107 |
if (blocks[w][h].getBlock().isBlockIndirectlyPowered() == true) |
Block b = blocks[w][h].getBlock(); |
108 |
|
|
109 |
|
if ( b.isBlockPowered() || b.isBlockIndirectlyPowered() ) |
110 |
return true; |
return true; |
111 |
} |
} |
112 |
} |
} |