From 9bb79683587aaa308cbf7d977eae68d3d00d0520 Mon Sep 17 00:00:00 2001 From: Wizjany Date: Sun, 27 Jan 2013 03:03:05 -0500 Subject: [PATCH] Make forest and pumpkin gens respect toggleplace. Make pumpkin gen have random faces. --- src/main/java/com/sk89q/worldedit/EditSession.java | 9 ++++----- .../com/sk89q/worldedit/commands/GenerationCommands.java | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/sk89q/worldedit/EditSession.java b/src/main/java/com/sk89q/worldedit/EditSession.java index 358a20fb1..8e07952a3 100644 --- a/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/src/main/java/com/sk89q/worldedit/EditSession.java @@ -2508,7 +2508,6 @@ public class EditSession { int h = prng.nextInt(3) - 1; BaseBlock log = new BaseBlock(BlockID.LOG); - BaseBlock pumpkin = new BaseBlock(BlockID.PUMPKIN); switch (t) { case 0: @@ -2518,7 +2517,7 @@ public class EditSession { if (prng.nextBoolean()) { setBlockIfAir(pos.add(1, h, -1), log); } - setBlockIfAir(pos.add(0, 0, -1), pumpkin); + setBlockIfAir(pos.add(0, 0, -1), new BaseBlock(BlockID.PUMPKIN, prng.nextInt(4))); break; case 1: @@ -2528,7 +2527,7 @@ public class EditSession { if (prng.nextBoolean()) { setBlockIfAir(pos.add(1, h, 0), log); } - setBlockIfAir(pos.add(1, 0, 1), pumpkin); + setBlockIfAir(pos.add(1, 0, 1), new BaseBlock(BlockID.PUMPKIN, prng.nextInt(4))); break; case 2: @@ -2538,7 +2537,7 @@ public class EditSession { if (prng.nextBoolean()) { setBlockIfAir(pos.add(-1, h, 0), log); } - setBlockIfAir(pos.add(-1, 0, 1), pumpkin); + setBlockIfAir(pos.add(-1, 0, 1), new BaseBlock(BlockID.PUMPKIN, prng.nextInt(4))); break; case 3: @@ -2548,7 +2547,7 @@ public class EditSession { if (prng.nextBoolean()) { setBlockIfAir(pos.add(-1, h, -1), log); } - setBlockIfAir(pos.add(-1, 0, -1), pumpkin); + setBlockIfAir(pos.add(-1, 0, -1), new BaseBlock(BlockID.PUMPKIN, prng.nextInt(4))); break; } } diff --git a/src/main/java/com/sk89q/worldedit/commands/GenerationCommands.java b/src/main/java/com/sk89q/worldedit/commands/GenerationCommands.java index 4de8b7601..3e745a603 100644 --- a/src/main/java/com/sk89q/worldedit/commands/GenerationCommands.java +++ b/src/main/java/com/sk89q/worldedit/commands/GenerationCommands.java @@ -260,7 +260,7 @@ public class GenerationCommands { return; } - int affected = editSession.makeForest(player.getPosition(), + int affected = editSession.makeForest(session.getPlacementPosition(player), size, density, new TreeGenerator(type)); player.print(affected + " trees created."); } @@ -279,7 +279,7 @@ public class GenerationCommands { int size = args.argsLength() > 0 ? Math.max(1, args.getInteger(0)) : 10; - int affected = editSession.makePumpkinPatches(player.getPosition(), size); + int affected = editSession.makePumpkinPatches(session.getPlacementPosition(player), size); player.print(affected + " pumpkin patches created."); }