Update CraftBukkit to Minecraft 1.7.2
This commit is contained in:
@@ -2,18 +2,20 @@ package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.BlockChangeDelegate; // CraftBukkit
|
||||
import org.bukkit.craftbukkit.CraftBlockChangeDelegate; // CraftBukkit
|
||||
|
||||
public class WorldGenTaiga1 extends WorldGenerator implements BlockSapling.TreeGenerator { // CraftBukkit add interface
|
||||
public class WorldGenTaiga1 extends WorldGenTreeAbstract implements BlockSapling.TreeGenerator { // CraftBukkit - add interface
|
||||
|
||||
public WorldGenTaiga1() {}
|
||||
public WorldGenTaiga1() {
|
||||
super(false);
|
||||
}
|
||||
|
||||
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) {
|
||||
public boolean generate(CraftBlockChangeDelegate world, Random random, int i, int j, int k) {
|
||||
// CraftBukkit end
|
||||
int l = random.nextInt(5) + 7;
|
||||
int i1 = l - random.nextInt(2) - 3;
|
||||
@@ -21,27 +23,26 @@ public class WorldGenTaiga1 extends WorldGenerator implements BlockSapling.TreeG
|
||||
int k1 = 1 + random.nextInt(j1 + 1);
|
||||
boolean flag = true;
|
||||
|
||||
if (j >= 1 && j + l + 1 <= 128) {
|
||||
if (j >= 1 && j + l + 1 <= 256) {
|
||||
int l1;
|
||||
int i2;
|
||||
int j2;
|
||||
int k2;
|
||||
int l2;
|
||||
|
||||
for (l1 = j; l1 <= j + 1 + l && flag; ++l1) {
|
||||
for (int k2 = j; k2 <= j + 1 + l && flag; ++k2) {
|
||||
boolean flag1 = true;
|
||||
|
||||
if (l1 - j < i1) {
|
||||
l2 = 0;
|
||||
if (k2 - j < i1) {
|
||||
j2 = 0;
|
||||
} else {
|
||||
l2 = k1;
|
||||
j2 = k1;
|
||||
}
|
||||
|
||||
for (i2 = i - l2; i2 <= i + l2 && flag; ++i2) {
|
||||
for (j2 = k - l2; j2 <= k + l2 && flag; ++j2) {
|
||||
if (l1 >= 0 && l1 < 128) {
|
||||
k2 = world.getTypeId(i2, l1, j2);
|
||||
if (k2 != 0 && k2 != Block.LEAVES.id) {
|
||||
for (l1 = i - j2; l1 <= i + j2 && flag; ++l1) {
|
||||
for (i2 = k - j2; i2 <= k + j2 && flag; ++i2) {
|
||||
if (k2 >= 0 && k2 < 256) {
|
||||
Block block = world.getType(l1, k2, i2);
|
||||
|
||||
if (!this.a(block)) {
|
||||
flag = false;
|
||||
}
|
||||
} else {
|
||||
@@ -54,35 +55,37 @@ public class WorldGenTaiga1 extends WorldGenerator implements BlockSapling.TreeG
|
||||
if (!flag) {
|
||||
return false;
|
||||
} else {
|
||||
l1 = world.getTypeId(i, j - 1, k);
|
||||
if ((l1 == Block.GRASS.id || l1 == Block.DIRT.id) && j < 128 - l - 1) {
|
||||
this.setType(world, i, j - 1, k, Block.DIRT.id);
|
||||
l2 = 0;
|
||||
Block block1 = world.getType(i, j - 1, k);
|
||||
|
||||
for (i2 = j + l; i2 >= j + i1; --i2) {
|
||||
for (j2 = i - l2; j2 <= i + l2; ++j2) {
|
||||
k2 = j2 - i;
|
||||
if ((block1 == Blocks.GRASS || block1 == Blocks.DIRT) && j < 256 - l - 1) {
|
||||
this.setType(world, i, j - 1, k, Blocks.DIRT);
|
||||
j2 = 0;
|
||||
|
||||
for (int i3 = k - l2; i3 <= k + l2; ++i3) {
|
||||
for (l1 = j + l; l1 >= j + i1; --l1) {
|
||||
for (i2 = i - j2; i2 <= i + j2; ++i2) {
|
||||
int l2 = i2 - i;
|
||||
|
||||
for (int i3 = k - j2; i3 <= k + j2; ++i3) {
|
||||
int j3 = i3 - k;
|
||||
|
||||
if ((Math.abs(k2) != l2 || Math.abs(j3) != l2 || l2 <= 0) && !Block.t[world.getTypeId(j2, i2, i3)]) {
|
||||
this.setTypeAndData(world, j2, i2, i3, Block.LEAVES.id, 1);
|
||||
if ((Math.abs(l2) != j2 || Math.abs(j3) != j2 || j2 <= 0) && !world.getType(i2, l1, i3).j()) {
|
||||
this.setTypeAndData(world, i2, l1, i3, Blocks.LEAVES, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (l2 >= 1 && i2 == j + i1 + 1) {
|
||||
--l2;
|
||||
} else if (l2 < k1) {
|
||||
++l2;
|
||||
if (j2 >= 1 && l1 == j + i1 + 1) {
|
||||
--j2;
|
||||
} else if (j2 < k1) {
|
||||
++j2;
|
||||
}
|
||||
}
|
||||
|
||||
for (i2 = 0; i2 < l - 1; ++i2) {
|
||||
j2 = world.getTypeId(i, j + i2, k);
|
||||
if (j2 == 0 || j2 == Block.LEAVES.id) {
|
||||
this.setTypeAndData(world, i, j + i2, k, Block.LOG.id, 1);
|
||||
for (l1 = 0; l1 < l - 1; ++l1) {
|
||||
Block block2 = world.getType(i, j + l1, k);
|
||||
|
||||
if (block2.getMaterial() == Material.AIR || block2.getMaterial() == Material.LEAVES) {
|
||||
this.setTypeAndData(world, i, j + l1, k, Blocks.LOG, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user