/[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 1580 by torben, Sun Jul 17 19:28:22 2011 UTC revision 1581 by torben, Sun Jul 24 17:23:48 2011 UTC
# Line 18  class Door { Line 18  class Door {
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                    
# Line 37  class Door { Line 37  class Door {
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                                    
# Line 58  class Door { Line 57  class Door {
57    
58                                    
59                                    
60                  material = leftUpper.getBlock().getTypeId();                  //material = leftUpper.getBlock().getTypeId();
61                                    
62                  loadBlocks();                  loadBlocks();
63                                    
# Line 81  class Door { Line 80  class Door {
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          }          }
# Line 115  class Door { Line 112  class Door {
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++) {
# Line 142  class Door { Line 142  class Door {
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                  }                  }
# Line 158  class Door { Line 161  class Door {
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 );
# Line 197  class Door { Line 200  class Door {
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          }          }

Legend:
Removed from v.1580  
changed lines
  Added in v.1581

  ViewVC Help
Powered by ViewVC 1.1.20