Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
at develop 69 lines 2.2 kB view raw
1package net.minecraft.server; 2 3import org.bukkit.event.block.BlockRedstoneEvent; 4 5import uk.betacraft.uberbukkit.UberbukkitConfig; 6 7public class BlockPumpkin extends Block { 8 9 private boolean a; 10 11 protected BlockPumpkin(int i, int j, boolean flag) { 12 super(i, Material.PUMPKIN); 13 this.textureId = j; 14 this.a(true); 15 this.a = flag; 16 } 17 18 public int a(int i, int j) { 19 if (i == 1) { 20 return this.textureId; 21 } else if (i == 0) { 22 return this.textureId; 23 } else { 24 int k = this.textureId + 1 + 16; 25 26 if (this.a) { 27 ++k; 28 } 29 30 return j == 2 && i == 2 ? k : (j == 3 && i == 5 ? k : (j == 0 && i == 3 ? k : (j == 1 && i == 4 ? k : this.textureId + 16))); 31 } 32 } 33 34 public int a(int i) { 35 return i == 1 ? this.textureId : (i == 0 ? this.textureId : (i == 3 ? this.textureId + 1 + 16 : this.textureId + 16)); 36 } 37 38 public void c(World world, int i, int j, int k) { 39 super.c(world, i, j, k); 40 } 41 42 public boolean canPlace(World world, int i, int j, int k) { 43 int l = world.getTypeId(i, j, k); 44 45 return (l == 0 || Block.byId[l].material.isReplacable()) && world.e(i, j - 1, k); 46 } 47 48 public void postPlace(World world, int i, int j, int k, EntityLiving entityliving) { 49 double dt = 2.5D; 50 if (UberbukkitConfig.getInstance().getBoolean("mechanics.pre_b1_5_pumpkins", false)) { 51 dt = 0.5D; 52 } 53 int l = MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + dt) & 3; 54 55 world.setData(i, j, k, l); 56 } 57 58 // CraftBukkit start 59 public void doPhysics(World world, int i, int j, int k, int l) { 60 if (net.minecraft.server.Block.byId[l] != null && net.minecraft.server.Block.byId[l].isPowerSource()) { 61 org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k); 62 int power = block.getBlockPower(); 63 64 BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, power, power); 65 world.getServer().getPluginManager().callEvent(eventRedstone); 66 } 67 } 68 // CraftBukkit end 69}