CraftBukkit/src/main/java/net/minecraft/server/WorldGenerator.java
Nate Mortensen 39719fff74 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.
2013-12-02 21:03:57 -07:00

51 lines
1.5 KiB
Java

package net.minecraft.server;
import java.util.Random;
import org.bukkit.craftbukkit.CraftBlockChangeDelegate; // CraftBukkit
public abstract class WorldGenerator {
private final boolean a;
public WorldGenerator() {
this.a = false;
}
public WorldGenerator(boolean flag) {
this.a = flag;
}
public abstract boolean a(World world, Random random, int i, int j, int k);
public void a(double d0, double d1, double d2) {}
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 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 {
world.setTypeAndData(i, j, k, block, l, 2);
}
}
// CraftBukkit end
}