From da75d0cef4054397c6b37275f4460d60a7ad1294 Mon Sep 17 00:00:00 2001 From: sk89q Date: Thu, 1 Mar 2012 20:15:39 -0800 Subject: [PATCH] Made tree planter tool try 10 times to make the tree before giving up. --- .../java/com/sk89q/worldedit/tools/TreePlanter.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/sk89q/worldedit/tools/TreePlanter.java b/src/main/java/com/sk89q/worldedit/tools/TreePlanter.java index 74de38954..7842dfcc1 100644 --- a/src/main/java/com/sk89q/worldedit/tools/TreePlanter.java +++ b/src/main/java/com/sk89q/worldedit/tools/TreePlanter.java @@ -44,7 +44,16 @@ public class TreePlanter implements BlockTool { EditSession editSession = session.createEditSession(player); try { - if (!gen.generate(editSession, clicked.add(0, 1, 0))) { + boolean successful = false; + + for (int i = 0; i < 10; i++) { + if (gen.generate(editSession, clicked.add(0, 1, 0))) { + successful = true; + break; + } + } + + if (!successful) { player.printError("A tree can't go there."); } } catch (MaxChangedBlocksException e) {