Update CraftBukkit to Minecraft 1.7.2
This commit is contained in:
@@ -2,49 +2,51 @@ package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.BlockChangeDelegate; // CraftBukkit
|
||||
import org.bukkit.craftbukkit.CraftBlockChangeDelegate; // CraftBukkit
|
||||
|
||||
public class WorldGenGroundBush extends WorldGenerator implements BlockSapling.TreeGenerator { // CraftBukkit add interface
|
||||
public class WorldGenGroundBush extends WorldGenTrees {
|
||||
|
||||
private int a;
|
||||
private int b;
|
||||
|
||||
public WorldGenGroundBush(int i, int j) {
|
||||
super(false);
|
||||
this.b = i;
|
||||
this.a = j;
|
||||
}
|
||||
|
||||
public boolean a(World world, Random random, int i, int j, int k) {
|
||||
// CraftBukkit start - Moved to generate
|
||||
return this.generate((BlockChangeDelegate) world, random, i, j, k);
|
||||
return this.generate(new CraftBlockChangeDelegate((org.bukkit.BlockChangeDelegate) world), random, i, j, k);
|
||||
}
|
||||
|
||||
public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {
|
||||
@Override
|
||||
public boolean generate(CraftBlockChangeDelegate world, Random random, int i, int j, int k) {
|
||||
// CraftBukkit end
|
||||
int l;
|
||||
Block block;
|
||||
|
||||
for (boolean flag = false; ((l = world.getTypeId(i, j, k)) == 0 || l == Block.LEAVES.id) && j > 0; --j) {
|
||||
;
|
||||
while (((block = world.getType(i, j, k)).getMaterial() == Material.AIR || block.getMaterial() == Material.LEAVES) && j > 0) {
|
||||
--j;
|
||||
}
|
||||
|
||||
int i1 = world.getTypeId(i, j, k);
|
||||
Block block1 = world.getType(i, j, k);
|
||||
|
||||
if (i1 == Block.DIRT.id || i1 == Block.GRASS.id) {
|
||||
if (block1 == Blocks.DIRT || block1 == Blocks.GRASS) {
|
||||
++j;
|
||||
this.setTypeAndData(world, i, j, k, Block.LOG.id, this.b);
|
||||
this.setTypeAndData(world, i, j, k, Blocks.LOG, this.b);
|
||||
|
||||
for (int j1 = j; j1 <= j + 2; ++j1) {
|
||||
int k1 = j1 - j;
|
||||
int l1 = 2 - k1;
|
||||
for (int l = j; l <= j + 2; ++l) {
|
||||
int i1 = l - j;
|
||||
int j1 = 2 - i1;
|
||||
|
||||
for (int i2 = i - l1; i2 <= i + l1; ++i2) {
|
||||
int j2 = i2 - i;
|
||||
for (int k1 = i - j1; k1 <= i + j1; ++k1) {
|
||||
int l1 = k1 - i;
|
||||
|
||||
for (int k2 = k - l1; k2 <= k + l1; ++k2) {
|
||||
int l2 = k2 - k;
|
||||
for (int i2 = k - j1; i2 <= k + j1; ++i2) {
|
||||
int j2 = i2 - k;
|
||||
|
||||
if ((Math.abs(j2) != l1 || Math.abs(l2) != l1 || random.nextInt(2) != 0) && !Block.t[world.getTypeId(i2, j1, k2)]) {
|
||||
this.setTypeAndData(world, i2, j1, k2, Block.LEAVES.id, this.a);
|
||||
if ((Math.abs(l1) != j1 || Math.abs(j2) != j1 || random.nextInt(2) != 0) && !world.getType(k1, l, i2).j()) {
|
||||
this.setTypeAndData(world, k1, l, i2, Blocks.LEAVES, this.a);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user