From 64dbaaa00df4a8254f9a5094470e66e8254be656 Mon Sep 17 00:00:00 2001 From: taoneill Date: Sat, 15 Jan 2011 16:03:09 -0500 Subject: [PATCH] Fixing wall outline. Poor trees would get massacred by glass. --- war/src/main/java/com/tommytony/war/Warzone.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/war/src/main/java/com/tommytony/war/Warzone.java b/war/src/main/java/com/tommytony/war/Warzone.java index 0321376..40d26c7 100644 --- a/war/src/main/java/com/tommytony/war/Warzone.java +++ b/war/src/main/java/com/tommytony/war/Warzone.java @@ -106,6 +106,7 @@ public class Warzone { private void addNorthwestCursorBlocks() { int newHighest = this.world.getHighestBlockYAt(this.northwest.getBlockX(), this.northwest.getBlockZ()) - 1; Block topNWBlock = this.world.getBlockAt(this.northwest.getBlockX(), newHighest, this.northwest.getBlockZ()); + originalNorthwestBlocks = new Material[3]; originalNorthwestBlocks[0] = topNWBlock.getType(); // save blocks for reset originalNorthwestBlocks[1] = topNWBlock.getFace(BlockFace.East).getType(); originalNorthwestBlocks[2] = topNWBlock.getFace(BlockFace.South).getType(); @@ -139,6 +140,7 @@ public class Warzone { private void addSoutheastCursorBlocks() { int newHighest = this.world.getHighestBlockYAt(this.southeast.getBlockX(), this.southeast.getBlockZ()) - 1; Block topSEBlock = this.world.getBlockAt(this.southeast.getBlockX(), newHighest, this.southeast.getBlockZ()); + originalSoutheastBlocks = new Material[3]; originalSoutheastBlocks[0] = topSEBlock.getType(); // save block for reset originalSoutheastBlocks[1] = topSEBlock.getFace(BlockFace.West).getType(); originalSoutheastBlocks[2] = topSEBlock.getFace(BlockFace.North).getType(); @@ -269,12 +271,13 @@ public class Warzone { int highest = world.getHighestBlockYAt(x, z); Block block = world.getBlockAt(x, highest -1 , z); - if(block.getType() == Material.LEAVES) { // top of tree, lets find some dirt + if(block.getType() == Material.LEAVES) { // top of tree, lets find some dirt/ground Block over = block.getFace(BlockFace.Down); Block under = over.getFace(BlockFace.Down); int treeHeight = 0; - while(!((over.getType() == Material.AIR || over.getType() == Material.LEAVES || over.getType() == Material.WOOD) - && (under.getType() != Material.AIR || under.getType() != Material.LEAVES || under.getType() != Material.WOOD)) + while(!((over.getType() == Material.AIR && under.getType() != Material.AIR && under.getType() != Material.LEAVES) + || (over.getType() == Material.LEAVES && under.getType() != Material.LEAVES && under.getType() != Material.AIR) + || (over.getType() == Material.WOOD && under.getType() != Material.WOOD && under.getType() != Material.AIR)) && treeHeight < 40) { over = under; under = over.getFace(BlockFace.Down);