55 |
} |
} |
56 |
|
|
57 |
private Block[] getAdjacentBlocks(Block block) { |
private Block[] getAdjacentBlocks(Block block) { |
58 |
|
/* |
59 |
Block out[] = new Block[6]; |
Block out[] = new Block[6]; |
60 |
|
|
61 |
out[0] = block.getRelative(-1,0,0); |
out[0] = block.getRelative(-1,0,0); |
66 |
|
|
67 |
out[4] = block.getRelative(0,0,-1); |
out[4] = block.getRelative(0,0,-1); |
68 |
out[5] = block.getRelative(0,0,1); |
out[5] = block.getRelative(0,0,1); |
69 |
|
*/ |
70 |
|
|
71 |
|
Block out[] = new Block[27]; |
72 |
|
int count = 0; |
73 |
|
for (int x=-1; x<=1; x++) { |
74 |
|
for (int y=-1; y<=1; y++) { |
75 |
|
for (int z=-1; z<=1; z++) { |
76 |
|
out[count++] = block.getRelative(x,y,z); |
77 |
|
} |
78 |
|
} |
79 |
|
|
80 |
|
} |
81 |
|
|
82 |
return out; |
return out; |
83 |
|
|
85 |
|
|
86 |
@Override |
@Override |
87 |
public void onBlockRedstoneChange(BlockRedstoneEvent event) { |
public void onBlockRedstoneChange(BlockRedstoneEvent event) { |
|
//System.out.println( event.getBlock().toString() ); |
|
88 |
|
|
89 |
Block block = event.getBlock(); |
Block block = event.getBlock(); |
90 |
|
|
91 |
|
//System.out.println( block.toString() + " / " + block.getTypeId() ); |
92 |
|
|
93 |
|
|
94 |
int x,y,z; |
int x,y,z; |
95 |
Block blocks[] = getAdjacentBlocks(block); |
Block blocks[] = getAdjacentBlocks(block); |
101 |
if (d != null) { |
if (d != null) { |
102 |
//System.out.println(" found door"); |
//System.out.println(" found door"); |
103 |
d.powerChange(block.getWorld(), event.getOldCurrent(), event.getNewCurrent() ); |
d.powerChange(block.getWorld(), event.getOldCurrent(), event.getNewCurrent() ); |
104 |
|
return; |
105 |
} |
} |
106 |
} |
} |
107 |
|
|