Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
at develop 96 lines 3.0 kB view raw
1package net.minecraft.server; 2 3import org.bukkit.BlockChangeDelegate; 4 5import uk.betacraft.uberbukkit.UberbukkitConfig; 6 7import java.util.Random; 8 9public class BlockSapling extends BlockFlower { 10 11 protected BlockSapling(int i, int j) { 12 super(i, j); 13 float f = 0.4F; 14 15 this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f); 16 } 17 18 public void a(World world, int i, int j, int k, Random random) { 19 if (!world.isStatic) { 20 super.a(world, i, j, k, random); 21 if (world.getLightLevel(i, j + 1, k) >= 9 && random.nextInt(30) == 0) { 22 int l = world.getData(i, j, k); 23 24 if ((l & 8) == 0) { 25 world.setData(i, j, k, l | 8); 26 } else { 27 this.b(world, i, j, k, random); 28 } 29 } 30 } 31 } 32 33 public int a(int i, int j) { 34 j &= 3; 35 return j == 1 ? 63 : (j == 2 ? 79 : super.a(i, j)); 36 } 37 38 public void b(World world, int i, int j, int k, Random random) { 39 int l = world.getData(i, j, k) & 3; 40 41 world.setRawTypeId(i, j, k, 0); 42 43 // CraftBukkit start - fixes client updates on recently grown trees 44 boolean grownTree; 45 BlockChangeWithNotify delegate = new BlockChangeWithNotify(world); 46 47 // uberbukkit 48 if (l == 1 && UberbukkitConfig.getInstance().getBoolean("worldgen.biomes.generate_spruces", true)) { 49 grownTree = new WorldGenTaiga2().generate(delegate, random, i, j, k); 50 } else if (l == 2 && UberbukkitConfig.getInstance().getBoolean("worldgen.biomes.generate_birches", true)) { 51 grownTree = new WorldGenForest().generate(delegate, random, i, j, k); 52 } else { 53 if (random.nextInt(10) == 0) { 54 grownTree = new WorldGenBigTree().generate(delegate, random, i, j, k); 55 } else { 56 grownTree = new WorldGenTrees().generate(delegate, random, i, j, k); 57 } 58 } 59 60 if (!grownTree) { 61 world.setRawTypeIdAndData(i, j, k, this.id, l); 62 } 63 // CraftBukkit end 64 } 65 66 protected int a_(int i) { 67 // uberbukkit 68 if (!UberbukkitConfig.getInstance().getBoolean("mechanics.drop_saplings_of_leaf_type", true)) { 69 return 0; 70 } else { 71 return i & 3; 72 } 73 } 74 75 // CraftBukkit start 76 private class BlockChangeWithNotify implements BlockChangeDelegate { 77 World world; 78 79 BlockChangeWithNotify(World world) { 80 this.world = world; 81 } 82 83 public boolean setRawTypeId(int x, int y, int z, int type) { 84 return this.world.setTypeId(x, y, z, type); 85 } 86 87 public boolean setRawTypeIdAndData(int x, int y, int z, int type, int data) { 88 return this.world.setTypeIdAndData(x, y, z, type, data); 89 } 90 91 public int getTypeId(int x, int y, int z) { 92 return this.world.getTypeId(x, y, z); 93 } 94 } 95 // CraftBukkit end 96}