Closes gh-262. 98% better door resets. Iron and wooden door should reset a lot more reliably now that I'm setting the proper block data in all but tiny edge cases.

This commit is contained in:
taoneill 2011-09-20 00:59:35 -04:00
parent f947f204b9
commit 1266462635
2 changed files with 8 additions and 6 deletions

View File

@ -200,7 +200,7 @@ public class ZoneVolumeMapper {
}
} else if (diskBlockType == Material.WOODEN_DOOR.getId() || diskBlockType == Material.IRON_DOOR_BLOCK.getId()) {
// Door blocks
if (j - 1 > 0) {
Block blockBelow = world.getBlockAt(x, y - 1, z);
boolean belowIsGlass = blockBelow.getTypeId() == Material.GLASS.getId();
@ -209,9 +209,9 @@ public class ZoneVolumeMapper {
if (belowIsGlass) {
// Top door block. Set both it and the block below as door.
blockBelow.setType(Material.getMaterial(diskBlockType));
blockBelow.setData(diskBlockData);
blockBelow.setData((byte)(diskBlockData & ~((byte)8))); // turn off 8 bit for bottom door
worldBlock.setType(Material.getMaterial(diskBlockType));
worldBlock.setData(diskBlockData);
worldBlock.setData(diskBlockData);
} else {
worldBlock.setType(Material.GLASS);
}
@ -243,7 +243,7 @@ public class ZoneVolumeMapper {
x++;
}
if (!deferred.isEmpty()) {
War.war.getServer().getScheduler().scheduleSyncDelayedTask(War.war, deferred, 1);
War.war.getServer().getScheduler().scheduleSyncDelayedTask(War.war, deferred, 2);
}
}
} catch (FileNotFoundException e) {

View File

@ -241,11 +241,13 @@ public class Volume {
// Check if is bottom door block
if (j + 1 < this.getSizeY() && this.getBlockTypes()[i][j + 1][k] == oldBlockType) {
// set both door blocks right away
currentBlock.setType(Material.getMaterial(oldBlockType));
currentBlock.setData(oldBlockData);
Block blockAbove = this.getWorld().getBlockAt(x, y + 1, z);
blockAbove.setType(Material.getMaterial(oldBlockType));
blockAbove.setData(this.getBlockDatas()[i][j + 1][k]);
currentBlock.setType(Material.getMaterial(oldBlockType));
currentBlock.setData(oldBlockData);
}
} else if (((oldBlockType == Material.TORCH.getId() && ((oldBlockData & 0x02) == 0x02)) || (oldBlockType == Material.REDSTONE_TORCH_OFF.getId() && ((oldBlockData & 0x02) == 0x02)) || (oldBlockType == Material.REDSTONE_TORCH_ON.getId() && ((oldBlockData & 0x02) == 0x02)) || (oldBlockType == Material.LEVER.getId() && ((oldBlockData & 0x02) == 0x02)) || (oldBlockType == Material.STONE_BUTTON.getId() && ((oldBlockData & 0x02) == 0x02)) || (oldBlockType == Material.LADDER.getId() && ((oldBlockData & 0x04) == 0x04)) || (oldBlockType == Material.RAILS.getId() && ((oldBlockData & 0x02) == 0x02))) && i + 1 != this.getSizeX()) {
// Blocks that hang on a block south of themselves need to make sure that block is there before placing themselves... lol