Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
at develop 120 lines 3.2 kB view raw
1package net.minecraft.server; 2 3import org.bukkit.event.block.BlockRedstoneEvent; 4 5import java.util.Random; 6 7public class BlockSign extends BlockContainer { 8 9 private Class a; 10 private boolean b; 11 12 protected BlockSign(int i, Class oclass, boolean flag) { 13 super(i, Material.WOOD); 14 this.b = flag; 15 this.textureId = 4; 16 this.a = oclass; 17 float f = 0.25F; 18 float f1 = 1.0F; 19 20 this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f); 21 } 22 23 public AxisAlignedBB e(World world, int i, int j, int k) { 24 return null; 25 } 26 27 public void a(IBlockAccess iblockaccess, int i, int j, int k) { 28 if (!this.b) { 29 int l = iblockaccess.getData(i, j, k); 30 float f = 0.28125F; 31 float f1 = 0.78125F; 32 float f2 = 0.0F; 33 float f3 = 1.0F; 34 float f4 = 0.125F; 35 36 this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); 37 if (l == 2) { 38 this.a(f2, f, 1.0F - f4, f3, f1, 1.0F); 39 } 40 41 if (l == 3) { 42 this.a(f2, f, 0.0F, f3, f1, f4); 43 } 44 45 if (l == 4) { 46 this.a(1.0F - f4, f, f2, 1.0F, f1, f3); 47 } 48 49 if (l == 5) { 50 this.a(0.0F, f, f2, f4, f1, f3); 51 } 52 } 53 } 54 55 public boolean b() { 56 return false; 57 } 58 59 public boolean a() { 60 return false; 61 } 62 63 protected TileEntity a_() { 64 try { 65 return (TileEntity) this.a.newInstance(); 66 } catch (Exception exception) { 67 throw new RuntimeException(exception); 68 } 69 } 70 71 public int a(int i, Random random) { 72 return Item.SIGN.id; 73 } 74 75 public void doPhysics(World world, int i, int j, int k, int l) { 76 boolean flag = false; 77 78 if (this.b) { 79 if (!world.getMaterial(i, j - 1, k).isBuildable()) { 80 flag = true; 81 } 82 } else { 83 int i1 = world.getData(i, j, k); 84 85 flag = true; 86 if (i1 == 2 && world.getMaterial(i, j, k + 1).isBuildable()) { 87 flag = false; 88 } 89 90 if (i1 == 3 && world.getMaterial(i, j, k - 1).isBuildable()) { 91 flag = false; 92 } 93 94 if (i1 == 4 && world.getMaterial(i + 1, j, k).isBuildable()) { 95 flag = false; 96 } 97 98 if (i1 == 5 && world.getMaterial(i - 1, j, k).isBuildable()) { 99 flag = false; 100 } 101 } 102 103 if (flag) { 104 this.g(world, i, j, k, world.getData(i, j, k)); 105 world.setTypeId(i, j, k, 0); 106 } 107 108 super.doPhysics(world, i, j, k, l); 109 110 // CraftBukkit start 111 if (net.minecraft.server.Block.byId[l] != null && net.minecraft.server.Block.byId[l].isPowerSource()) { 112 org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k); 113 int power = block.getBlockPower(); 114 115 BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, power, power); 116 world.getServer().getPluginManager().callEvent(eventRedstone); 117 } 118 // CraftBukkit end 119 } 120}