diff options
author | Nathan Adams <dinnerbone@dinnerbone.com> | 2011-12-19 16:41:55 +0000 |
---|---|---|
committer | Nathan Adams <dinnerbone@dinnerbone.com> | 2011-12-19 16:41:55 +0000 |
commit | 972b2087f202d1b8ebe4195ee83e967f45241b82 (patch) | |
tree | 0ea6040ee0186fd21e88320a27b112cf8d7b1d8a /src/main/java/net/minecraft | |
parent | 246d07482bf1bc3a6545e06aae19bd42f5da2a46 (diff) | |
download | craftbukkit-972b2087f202d1b8ebe4195ee83e967f45241b82.tar craftbukkit-972b2087f202d1b8ebe4195ee83e967f45241b82.tar.gz craftbukkit-972b2087f202d1b8ebe4195ee83e967f45241b82.tar.lz craftbukkit-972b2087f202d1b8ebe4195ee83e967f45241b82.tar.xz craftbukkit-972b2087f202d1b8ebe4195ee83e967f45241b82.zip |
Fixed bonemeal not being consumed on failed growth attempts. This fixes BUKKIT-337. Thanks to md-5 for the pull request!
Diffstat (limited to 'src/main/java/net/minecraft')
7 files changed, 9 insertions, 17 deletions
diff --git a/src/main/java/net/minecraft/server/BlockMushroom.java b/src/main/java/net/minecraft/server/BlockMushroom.java index 3c6e662e..2d8cf25f 100644 --- a/src/main/java/net/minecraft/server/BlockMushroom.java +++ b/src/main/java/net/minecraft/server/BlockMushroom.java @@ -108,10 +108,13 @@ public class BlockMushroom extends BlockFlower { event = new StructureGrowEvent(location, TreeType.RED_MUSHROOM, bonemeal, player, new ArrayList<BlockState>()); worldgenhugemushroom = new WorldGenHugeMushroom(1); } - if (worldgenhugemushroom != null && event != null){ + if (worldgenhugemushroom != null && event != null) { grown = worldgenhugemushroom.grow(world, random, i, j, k, event, itemstack, world.getWorld()); + if (event.isFromBonemeal() && itemstack != null) { + --itemstack.count; + } } - if (!grown || event.isCancelled()){ + if (!grown || event.isCancelled()) { world.setRawTypeIdAndData(i, j, k, this.id, l); return false; } diff --git a/src/main/java/net/minecraft/server/BlockSapling.java b/src/main/java/net/minecraft/server/BlockSapling.java index db1a3caa..c9877ba8 100644 --- a/src/main/java/net/minecraft/server/BlockSapling.java +++ b/src/main/java/net/minecraft/server/BlockSapling.java @@ -70,6 +70,9 @@ public class BlockSapling extends BlockFlower { if (event == null) { return; } + if (event.isFromBonemeal() && itemstack != null) { + --itemstack.count; + } if (!grownTree || event.isCancelled()) { world.setRawTypeIdAndData(i, j, k, this.id, l); } @@ -82,6 +85,7 @@ public class BlockSapling extends BlockFlower { // CraftBukkit start private class BlockChangeWithNotify implements BlockChangeDelegate { + World world; BlockChangeWithNotify(World world) { diff --git a/src/main/java/net/minecraft/server/WorldGenBigTree.java b/src/main/java/net/minecraft/server/WorldGenBigTree.java index 0407b8f5..14d122a2 100644 --- a/src/main/java/net/minecraft/server/WorldGenBigTree.java +++ b/src/main/java/net/minecraft/server/WorldGenBigTree.java @@ -401,9 +401,6 @@ public class WorldGenBigTree extends WorldGenerator { for (BlockState state : event.getBlocks()) { state.update(); } - if (event.isFromBonemeal() && itemstack != null) { - --itemstack.count; - } } } // Craftbukkit end diff --git a/src/main/java/net/minecraft/server/WorldGenForest.java b/src/main/java/net/minecraft/server/WorldGenForest.java index 8b014d28..3d0ce870 100644 --- a/src/main/java/net/minecraft/server/WorldGenForest.java +++ b/src/main/java/net/minecraft/server/WorldGenForest.java @@ -126,9 +126,6 @@ public class WorldGenForest extends WorldGenerator { for (BlockState state : event.getBlocks()) { state.update(true); } - if (event.isFromBonemeal() && itemstack != null) { - --itemstack.count; - } } } // Craftbukkit end diff --git a/src/main/java/net/minecraft/server/WorldGenHugeMushroom.java b/src/main/java/net/minecraft/server/WorldGenHugeMushroom.java index 1da757d8..95ab4979 100644 --- a/src/main/java/net/minecraft/server/WorldGenHugeMushroom.java +++ b/src/main/java/net/minecraft/server/WorldGenHugeMushroom.java @@ -196,9 +196,6 @@ public class WorldGenHugeMushroom extends WorldGenerator { for (BlockState state : event.getBlocks()) { state.update(true); } - if (event.isFromBonemeal() && itemstack != null) { - --itemstack.count; - } } } // Craftbukkit end diff --git a/src/main/java/net/minecraft/server/WorldGenTaiga2.java b/src/main/java/net/minecraft/server/WorldGenTaiga2.java index c20ffc01..47da3a99 100644 --- a/src/main/java/net/minecraft/server/WorldGenTaiga2.java +++ b/src/main/java/net/minecraft/server/WorldGenTaiga2.java @@ -144,9 +144,6 @@ public class WorldGenTaiga2 extends WorldGenerator { for (BlockState state : event.getBlocks()) { state.update(true); } - if (event.isFromBonemeal() && itemstack != null) { - --itemstack.count; - } } } // Craftbukkit end diff --git a/src/main/java/net/minecraft/server/WorldGenTrees.java b/src/main/java/net/minecraft/server/WorldGenTrees.java index c9c81b64..8bcc0652 100644 --- a/src/main/java/net/minecraft/server/WorldGenTrees.java +++ b/src/main/java/net/minecraft/server/WorldGenTrees.java @@ -124,9 +124,6 @@ public class WorldGenTrees extends WorldGenerator { for (BlockState state : event.getBlocks()) { state.update(true); } - if (event.isFromBonemeal() && itemstack != null) { - --itemstack.count; - } } } // Craftbukkit end |