Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
at develop 73 lines 2.2 kB view raw
1package net.minecraft.server; 2 3import com.legacyminecraft.poseidon.PoseidonConfig; 4import uk.betacraft.uberbukkit.UberbukkitConfig; 5 6public class BlockFence extends Block { 7 private boolean modernFencingBounding = false; 8 9 public BlockFence(int i, int j) { 10 super(i, j, Material.WOOD); 11 modernFencingBounding = (boolean) PoseidonConfig.getInstance().getConfigOption("world-settings.use-modern-fence-bounding-boxes", false); 12 } 13 14 public boolean canPlace(World world, int i, int j, int k) { 15 return world.getTypeId(i, j - 1, k) == this.id ? 16 // uberbukkit 17 UberbukkitConfig.getInstance().getBoolean("mechanics.allow_1_7_fence_placement", true) : (!world.getMaterial(i, j - 1, k).isBuildable() ? false : super.canPlace(world, i, j, k)); 18 } 19 20 public AxisAlignedBB e(World world, int i, int j, int k) { 21 if (!modernFencingBounding) { 22 return AxisAlignedBB.b((double) i, (double) j, (double) k, (double) (i + 1), (double) ((float) j + 1.5F), (double) (k + 1)); 23 } 24 25 boolean flag = this.b(world, i, j, k - 1); 26 boolean flag1 = this.b(world, i, j, k + 1); 27 boolean flag2 = this.b(world, i - 1, j, k); 28 boolean flag3 = this.b(world, i + 1, j, k); 29 float f = 0.375F; 30 float f1 = 0.625F; 31 float f2 = 0.375F; 32 float f3 = 0.625F; 33 34 if (flag) { 35 f2 = 0.0F; 36 } 37 38 if (flag1) { 39 f3 = 1.0F; 40 } 41 42 if (flag2) { 43 f = 0.0F; 44 } 45 46 if (flag3) { 47 f1 = 1.0F; 48 } 49 50 return AxisAlignedBB.b((double) ((float) i + f), (double) j, (double) ((float) k + f2), (double) ((float) i + f1), (double) ((float) j + 1.5F), (double) ((float) k + f3)); 51 } 52 53 public boolean b(IBlockAccess iblockaccess, int i, int j, int k) { 54 int l = iblockaccess.getTypeId(i, j, k); 55 56 if (l != this.id) { 57 Block block = Block.byId[l]; 58 59 return block != null && block.material.h() && block.b() ? block.material != Material.PUMPKIN : false; 60 } else { 61 return true; 62 } 63 } 64 65 66 public boolean a() { 67 return false; 68 } 69 70 public boolean b() { 71 return false; 72 } 73}