diff options
Diffstat (limited to 'src/main/java/net/minecraft/server/BlockPressurePlate.java')
-rw-r--r-- | src/main/java/net/minecraft/server/BlockPressurePlate.java | 127 |
1 files changed, 58 insertions, 69 deletions
diff --git a/src/main/java/net/minecraft/server/BlockPressurePlate.java b/src/main/java/net/minecraft/server/BlockPressurePlate.java index fcb48af8..90f0a749 100644 --- a/src/main/java/net/minecraft/server/BlockPressurePlate.java +++ b/src/main/java/net/minecraft/server/BlockPressurePlate.java @@ -20,12 +20,12 @@ public class BlockPressurePlate extends Block { private EnumMobType a; protected BlockPressurePlate(int i, int j, EnumMobType enummobtype) { - super(i, j, Material.d); - a = enummobtype; - a(true); + super(i, j, Material.STONE); + this.a = enummobtype; + this.a(true); float f = 0.0625F; - a(f, 0.0F, f, 1.0F - f, 0.03125F, 1.0F - f); + this.a(f, 0.0F, f, 1.0F - f, 0.03125F, 1.0F - f); } public int b() { @@ -52,129 +52,118 @@ public class BlockPressurePlate extends Block { if (!world.d(i, j - 1, k)) { flag = true; } + if (flag) { - a_(world, i, j, k, world.b(i, j, k)); + this.a_(world, i, j, k, world.getData(i, j, k)); world.e(i, j, k, 0); } } public void a(World world, int i, int j, int k, Random random) { - if (world.z) { - return; - } - if (world.b(i, j, k) == 0) { - return; - } else { - g(world, i, j, k); - return; + if (!world.isStatic) { + if (world.getData(i, j, k) != 0) { + this.g(world, i, j, k); + } } } public void a(World world, int i, int j, int k, Entity entity) { - if (world.z) { - return; - } - if (world.b(i, j, k) == 1) { - return; - } else { - // CraftBukkit start - Interact Pressure Plate - if (entity instanceof EntityLiving) { - CraftServer server = ((WorldServer) world).getServer(); - CraftWorld craftWorld = ((WorldServer) world).getWorld(); - Type eventType = Type.BLOCK_INTERACT; - CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k); - org.bukkit.entity.LivingEntity who = (entity == null)?null:(LivingEntity) entity.getBukkitEntity(); - - BlockInteractEvent bie = new BlockInteractEvent(eventType, block, who); - server.getPluginManager().callEvent(bie); - - if (bie.isCancelled()) { - return; + if (!world.isStatic) { + if (world.getData(i, j, k) != 1) { + + // CraftBukkit start - Interact Pressure Plate + if (entity instanceof EntityLiving) { + CraftServer server = ((WorldServer) world).getServer(); + CraftWorld craftWorld = ((WorldServer) world).getWorld(); + Type eventType = Type.BLOCK_INTERACT; + CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k); + org.bukkit.entity.LivingEntity who = (entity == null) ? null : (LivingEntity) entity.getBukkitEntity(); + + BlockInteractEvent event = new BlockInteractEvent(eventType, block, who); + server.getPluginManager().callEvent(event); + + if (event.isCancelled()) { + return; + } } - } - // CraftBukkit end + // CraftBukkit end - g(world, i, j, k); - return; + this.g(world, i, j, k); + } } } private void g(World world, int i, int j, int k) { - boolean flag = world.b(i, j, k) == 1; + boolean flag = world.getData(i, j, k) == 1; boolean flag1 = false; float f = 0.125F; List list = null; - if (a == EnumMobType.a) { - list = world.b(((Entity) (null)), AxisAlignedBB.b((float) i + f, j, (float) k + f, (float) (i + 1) - f, (double) j + 0.25D, (float) (k + 1) - f)); + if (this.a == EnumMobType.EVERYTHING) { + list = world.b((Entity) null, AxisAlignedBB.b((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) j + 0.25D, (double) ((float) (k + 1) - f))); } - if (a == EnumMobType.b) { - list = world.a(net.minecraft.server.EntityLiving.class, AxisAlignedBB.b((float) i + f, j, (float) k + f, (float) (i + 1) - f, (double) j + 0.25D, (float) (k + 1) - f)); + + if (this.a == EnumMobType.MOBS) { + list = world.a(EntityLiving.class, AxisAlignedBB.b((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) j + 0.25D, (double) ((float) (k + 1) - f))); } - if (a == EnumMobType.c) { - list = world.a(net.minecraft.server.EntityPlayer.class, AxisAlignedBB.b((float) i + f, j, (float) k + f, (float) (i + 1) - f, (double) j + 0.25D, (float) (k + 1) - f)); + + if (this.a == EnumMobType.PLAYERS) { + list = world.a(EntityHuman.class, AxisAlignedBB.b((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) j + 0.25D, (double) ((float) (k + 1) - f))); } + if (list.size() > 0) { flag1 = true; } - // Craftbukkit start - CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); - BlockRedstoneEvent bre = new BlockRedstoneEvent(block, BlockFace.SELF, flag ? 15 : 0, flag1 ? 15 : 0); - ((WorldServer) world).getServer().getPluginManager().callEvent(bre); - flag1 = bre.getNewCurrent() > 0; - // Craftbukkit end - if (flag1 && !flag) { world.c(i, j, k, 1); - world.h(i, j, k, bi); - world.h(i, j - 1, k, bi); + world.h(i, j, k, this.id); + world.h(i, j - 1, k, this.id); world.b(i, j, k, i, j, k); - world.a((double) i + 0.5D, (double) j + 0.10000000000000001D, (double) k + 0.5D, "random.click", 0.3F, 0.6F); + world.a((double) i + 0.5D, (double) j + 0.1D, (double) k + 0.5D, "random.click", 0.3F, 0.6F); } + if (!flag1 && flag) { world.c(i, j, k, 0); - world.h(i, j, k, bi); - world.h(i, j - 1, k, bi); + world.h(i, j, k, this.id); + world.h(i, j - 1, k, this.id); world.b(i, j, k, i, j, k); - world.a((double) i + 0.5D, (double) j + 0.10000000000000001D, (double) k + 0.5D, "random.click", 0.3F, 0.5F); + world.a((double) i + 0.5D, (double) j + 0.1D, (double) k + 0.5D, "random.click", 0.3F, 0.5F); } + if (flag1) { - world.i(i, j, k, bi); + world.i(i, j, k, this.id); } } public void b(World world, int i, int j, int k) { - int l = world.b(i, j, k); + int l = world.getData(i, j, k); if (l > 0) { - world.h(i, j, k, bi); - world.h(i, j - 1, k, bi); + world.h(i, j, k, this.id); + world.h(i, j - 1, k, this.id); } + super.b(world, i, j, k); } public void a(IBlockAccess iblockaccess, int i, int j, int k) { - boolean flag = iblockaccess.b(i, j, k) == 1; + boolean flag = iblockaccess.getData(i, j, k) == 1; float f = 0.0625F; if (flag) { - a(f, 0.0F, f, 1.0F - f, 0.03125F, 1.0F - f); + this.a(f, 0.0F, f, 1.0F - f, 0.03125F, 1.0F - f); } else { - a(f, 0.0F, f, 1.0F - f, 0.0625F, 1.0F - f); + this.a(f, 0.0F, f, 1.0F - f, 0.0625F, 1.0F - f); } } public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) { - return iblockaccess.b(i, j, k) > 0; + return iblockaccess.getData(i, j, k) > 0; } public boolean d(World world, int i, int j, int k, int l) { - if (world.b(i, j, k) == 0) { - return false; - } else { - return l == 1; - } + return world.getData(i, j, k) == 0 ? false : l == 1; } public boolean c() { |