diff options
author | Nate Mortensen <nate.richard.mortensen@gmail.com> | 2013-12-02 19:41:51 -0700 |
---|---|---|
committer | Nate Mortensen <nate.richard.mortensen@gmail.com> | 2013-12-02 21:03:57 -0700 |
commit | 39719fff74e7eb64842f5c2f243c1fea1d51659b (patch) | |
tree | f8d04f0a5c93f91b9a109d81d7311ec1cee698a8 /src/main/java/net/minecraft/server/WorldGenerator.java | |
parent | a721fe8473ed5a7c0849231c6d155288fd3e8847 (diff) | |
download | craftbukkit-39719fff74e7eb64842f5c2f243c1fea1d51659b.tar craftbukkit-39719fff74e7eb64842f5c2f243c1fea1d51659b.tar.gz craftbukkit-39719fff74e7eb64842f5c2f243c1fea1d51659b.tar.lz craftbukkit-39719fff74e7eb64842f5c2f243c1fea1d51659b.tar.xz craftbukkit-39719fff74e7eb64842f5c2f243c1fea1d51659b.zip |
Maintain old setType method in WorldGenerator. Fixes BUKKIT-4915
WorldGenerator setType and setTypeAndData have their arguments changed to
add in support for CraftBlockChangeDelegate, which changes the method
signature. This change in the method signature breaks any WorldGenerators
that aren't modified to use CraftBlockChangeDelegate.
This commit fixes the issue by readding the old method and maintaining the
CraftBlockChangeDelegate method. This makes it so that there is a
compatible method for both CraftBlockChangeDelegate WorldGenerators and
unmodified WorldGenerators.
Additionally, this commit reduces and corrects the diffs in
WorldGenerator, moving the fix for layering violations to
CraftBlockChangeDelegate.
Diffstat (limited to 'src/main/java/net/minecraft/server/WorldGenerator.java')
-rw-r--r-- | src/main/java/net/minecraft/server/WorldGenerator.java | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/main/java/net/minecraft/server/WorldGenerator.java b/src/main/java/net/minecraft/server/WorldGenerator.java index f79a0fba..94c225a8 100644 --- a/src/main/java/net/minecraft/server/WorldGenerator.java +++ b/src/main/java/net/minecraft/server/WorldGenerator.java @@ -20,23 +20,31 @@ public abstract class WorldGenerator { public void a(double d0, double d1, double d2) {} - // CraftBukkit - change signature + protected void setType(World world, int i, int j, int k, Block block) { + this.setTypeAndData(world, i, j, k, block, 0); + } + + // CraftBukkit start - Duplicate method to add support for CraftBlockChangeDelegate protected void setType(CraftBlockChangeDelegate world, int i, int j, int k, Block block) { this.setTypeAndData(world, i, j, k, block, 0); } + // CraftBukkit end + + protected void setTypeAndData(World world, int i, int j, int k, Block block, int l) { + if (this.a) { + world.setTypeAndData(i, j, k, block, l, 3); + } else { + world.setTypeAndData(i, j, k, block, l, 2); + } + } - // CraftBukkit - change signature + // CraftBukkit start - Duplicate method to add support for CraftBlockChangeDelegate protected void setTypeAndData(CraftBlockChangeDelegate world, int i, int j, int k, Block block, int l) { if (this.a) { world.setTypeAndData(i, j, k, block, l, 3); } else { - // CraftBukkit start - Layering violation :( - if (world.getDelegate() instanceof World) { - ((World) world.getDelegate()).setTypeAndData(i, j, k, block, l, 2); - } else { - world.setTypeAndData(i, j, k, block, l, 2); - } - // CraftBukkit end + world.setTypeAndData(i, j, k, block, l, 2); } } + // CraftBukkit end } |