summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/WorldGenTaiga2.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/minecraft/server/WorldGenTaiga2.java')
-rw-r--r--src/main/java/net/minecraft/server/WorldGenTaiga2.java79
1 files changed, 40 insertions, 39 deletions
diff --git a/src/main/java/net/minecraft/server/WorldGenTaiga2.java b/src/main/java/net/minecraft/server/WorldGenTaiga2.java
index 8d9ba5e9..24fd27e1 100644
--- a/src/main/java/net/minecraft/server/WorldGenTaiga2.java
+++ b/src/main/java/net/minecraft/server/WorldGenTaiga2.java
@@ -2,9 +2,9 @@ package net.minecraft.server;
import java.util.Random;
-import org.bukkit.BlockChangeDelegate; // CraftBukkit
+import org.bukkit.craftbukkit.CraftBlockChangeDelegate; // CraftBukkit
-public class WorldGenTaiga2 extends WorldGenerator implements BlockSapling.TreeGenerator { // CraftBukkit add interface
+public class WorldGenTaiga2 extends WorldGenTreeAbstract implements BlockSapling.TreeGenerator { // CraftBukkit - add interface
public WorldGenTaiga2(boolean flag) {
super(flag);
@@ -12,10 +12,10 @@ public class WorldGenTaiga2 extends WorldGenerator implements BlockSapling.TreeG
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(4) + 6;
int i1 = 1 + random.nextInt(2);
@@ -26,23 +26,22 @@ public class WorldGenTaiga2 extends WorldGenerator implements BlockSapling.TreeG
if (j >= 1 && j + l + 1 <= 256) {
int l1;
int i2;
- int j2;
- int k2;
- for (l1 = j; l1 <= j + 1 + l && flag; ++l1) {
+ for (int j2 = j; j2 <= j + 1 + l && flag; ++j2) {
boolean flag1 = true;
- if (l1 - j < i1) {
- k2 = 0;
+ if (j2 - j < i1) {
+ i2 = 0;
} else {
- k2 = k1;
+ i2 = k1;
}
- for (i2 = i - k2; i2 <= i + k2 && flag; ++i2) {
- for (int l2 = k - k2; l2 <= k + k2 && flag; ++l2) {
- if (l1 >= 0 && l1 < 256) {
- j2 = world.getTypeId(i2, l1, l2);
- if (j2 != 0 && j2 != Block.LEAVES.id) {
+ for (l1 = i - i2; l1 <= i + i2 && flag; ++l1) {
+ for (int k2 = k - i2; k2 <= k + i2 && flag; ++k2) {
+ if (j2 >= 0 && j2 < 256) {
+ Block block = world.getType(l1, j2, k2);
+
+ if (block.getMaterial() != Material.AIR && block.getMaterial() != Material.LEAVES) {
flag = false;
}
} else {
@@ -55,49 +54,51 @@ public class WorldGenTaiga2 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 < 256 - l - 1) {
- this.setType(world, i, j - 1, k, Block.DIRT.id);
- k2 = random.nextInt(2);
- i2 = 1;
+ Block block1 = world.getType(i, j - 1, k);
+
+ if ((block1 == Blocks.GRASS || block1 == Blocks.DIRT || block1 == Blocks.SOIL) && j < 256 - l - 1) {
+ this.setType(world, i, j - 1, k, Blocks.DIRT);
+ i2 = random.nextInt(2);
+ l1 = 1;
byte b0 = 0;
+ int l2;
int i3;
- int j3;
- for (j2 = 0; j2 <= j1; ++j2) {
- j3 = j + l - j2;
+ for (i3 = 0; i3 <= j1; ++i3) {
+ l2 = j + l - i3;
- for (i3 = i - k2; i3 <= i + k2; ++i3) {
- int k3 = i3 - i;
+ for (int j3 = i - i2; j3 <= i + i2; ++j3) {
+ int k3 = j3 - i;
- for (int l3 = k - k2; l3 <= k + k2; ++l3) {
+ for (int l3 = k - i2; l3 <= k + i2; ++l3) {
int i4 = l3 - k;
- if ((Math.abs(k3) != k2 || Math.abs(i4) != k2 || k2 <= 0) && !Block.t[world.getTypeId(i3, j3, l3)]) {
- this.setTypeAndData(world, i3, j3, l3, Block.LEAVES.id, 1);
+ if ((Math.abs(k3) != i2 || Math.abs(i4) != i2 || i2 <= 0) && !world.getType(j3, l2, l3).j()) {
+ this.setTypeAndData(world, j3, l2, l3, Blocks.LEAVES, 1);
}
}
}
- if (k2 >= i2) {
- k2 = b0;
+ if (i2 >= l1) {
+ i2 = b0;
b0 = 1;
- ++i2;
- if (i2 > k1) {
- i2 = k1;
+ ++l1;
+ if (l1 > k1) {
+ l1 = k1;
}
} else {
- ++k2;
+ ++i2;
}
}
- j2 = random.nextInt(3);
+ i3 = random.nextInt(3);
+
+ for (l2 = 0; l2 < l - i3; ++l2) {
+ Block block2 = world.getType(i, j + l2, k);
- for (j3 = 0; j3 < l - j2; ++j3) {
- i3 = world.getTypeId(i, j + j3, k);
- if (i3 == 0 || i3 == Block.LEAVES.id) {
- this.setTypeAndData(world, i, j + j3, k, Block.LOG.id, 1);
+ if (block2.getMaterial() == Material.AIR || block2.getMaterial() == Material.LEAVES) {
+ this.setTypeAndData(world, i, j + l2, k, Blocks.LOG, 1);
}
}