/[projects]/miscJava/bukkit-minecraft-plugins/HoerupUtils/src/dk/thoerup/bukkit/hoeruputils/secretdoor/Door.java
ViewVC logotype

Diff of /miscJava/bukkit-minecraft-plugins/HoerupUtils/src/dk/thoerup/bukkit/hoeruputils/secretdoor/Door.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1540 by torben, Thu Jun 30 17:20:38 2011 UTC revision 1579 by torben, Sat Jul 16 11:16:09 2011 UTC
# Line 62  class Door { Line 62  class Door {
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] );
# Line 92  class Door { Line 92  class Door {
92                                    
93                  loadBlocks();                  loadBlocks();
94          }          }
95    
96            public void powerChange(World world, int oldCurrent, int newCurrent ) {
97                    if (newCurrent != 0 && 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                                    if (blocks[w][h].getBlock().isBlockIndirectlyPowered() == true)
108                                            return true;
109                            }
110                    }
111                            
112                    return false;
113            }
114                    
115          private void loadBlocks() {          private void loadBlocks() {
116                                    
# Line 164  class Door { Line 183  class Door {
183    
184          }          }
185    
186          public void open(World world) {          public void open() {
187                  for (int w=0; w<width; w++) {                  for (int w=0; w<width; w++) {
188                          for (int h=0; h<height; h++) {                                                    for (int h=0; h<height; h++) {                          
189                                  blocks[w][h].getBlock().setTypeId(0, false);                                  blocks[w][h].getBlock().setTypeId(0, false);
# Line 173  class Door { Line 192  class Door {
192    
193          }          }
194    
195          public void close(World world) {          public void close() {
196                  for (int w=0; w<width; w++) {                  for (int w=0; w<width; w++) {
197                          for (int h=0; h<height; h++) {                                                    for (int h=0; h<height; h++) {                          
198                                  blocks[w][h].getBlock().setTypeId( material );                                  blocks[w][h].getBlock().setTypeId( material );

Legend:
Removed from v.1540  
changed lines
  Added in v.1579

  ViewVC Help
Powered by ViewVC 1.1.20