summaryrefslogtreecommitdiffstats
path: root/nms-patches/BlockPressurePlateWeighted.patch
diff options
context:
space:
mode:
authorThinkofdeath <thinkofdeath@spigotmc.org>2014-11-26 08:32:16 +1100
committermd_5 <git@md-5.net>2014-11-28 17:16:30 +1100
commit24557bc2b37deb6a0edf497d547471832457b1dd (patch)
treec560572889a3b0b34964a0cddb35dc87fda3c914 /nms-patches/BlockPressurePlateWeighted.patch
parenta4805dbd77da057cc1ea0bf344379bc6e53ca1f6 (diff)
downloadcraftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar
craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar.gz
craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar.lz
craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar.xz
craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.zip
Update to Minecraft 1.8
For more information please see http://www.spigotmc.org/
Diffstat (limited to 'nms-patches/BlockPressurePlateWeighted.patch')
-rw-r--r--nms-patches/BlockPressurePlateWeighted.patch43
1 files changed, 43 insertions, 0 deletions
diff --git a/nms-patches/BlockPressurePlateWeighted.patch b/nms-patches/BlockPressurePlateWeighted.patch
new file mode 100644
index 00000000..bd07b6a6
--- /dev/null
+++ b/nms-patches/BlockPressurePlateWeighted.patch
@@ -0,0 +1,43 @@
+--- ../work/decompile-bb26c12b/net/minecraft/server/BlockPressurePlateWeighted.java 2014-11-27 08:59:46.561422463 +1100
++++ src/main/java/net/minecraft/server/BlockPressurePlateWeighted.java 2014-11-27 08:42:10.160850895 +1100
+@@ -1,5 +1,7 @@
+ package net.minecraft.server;
+
++import org.bukkit.event.entity.EntityInteractEvent; // CraftBukkit
++
+ public class BlockPressurePlateWeighted extends BlockPressurePlateAbstract {
+
+ public static final BlockStateInteger POWER = BlockStateInteger.of("power", 0, 15);
+@@ -12,7 +14,31 @@
+ }
+
+ protected int e(World world, BlockPosition blockposition) {
+- int i = Math.min(world.a(Entity.class, this.a(blockposition)).size(), this.b);
++ // CraftBukkit start
++ //int i = Math.min(world.a(Entity.class, this.a(blockposition)).size(), this.b);
++ int i = 0;
++ java.util.Iterator iterator = world.a(Entity.class, this.a(blockposition)).iterator();
++
++ while (iterator.hasNext()) {
++ Entity entity = (Entity) iterator.next();
++
++ org.bukkit.event.Cancellable cancellable;
++
++ if (entity instanceof EntityHuman) {
++ cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null);
++ } else {
++ cancellable = new EntityInteractEvent(entity.getBukkitEntity(), world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
++ world.getServer().getPluginManager().callEvent((EntityInteractEvent) cancellable);
++ }
++
++ // We only want to block turning the plate on if all events are cancelled
++ if (!cancellable.isCancelled()) {
++ i++;
++ }
++ }
++
++ i = Math.min(i, this.b);
++ // CraftBukkit end
+
+ if (i > 0) {
+ float f = (float) Math.min(this.b, i) / (float) this.b;