2015-05-25 12:37:24 +02:00
|
|
|
--- a/net/minecraft/server/BlockPressurePlateWeighted.java
|
|
|
|
+++ b/net/minecraft/server/BlockPressurePlateWeighted.java
|
2014-11-25 22:32:16 +01:00
|
|
|
@@ -1,5 +1,7 @@
|
|
|
|
package net.minecraft.server;
|
|
|
|
|
|
|
|
+import org.bukkit.event.entity.EntityInteractEvent; // CraftBukkit
|
|
|
|
+
|
|
|
|
public class BlockPressurePlateWeighted extends BlockPressurePlateAbstract {
|
|
|
|
|
2020-06-25 02:00:00 +02:00
|
|
|
public static final BlockStateInteger POWER = BlockProperties.az;
|
2019-04-23 04:00:00 +02:00
|
|
|
@@ -13,7 +15,31 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
@Override
|
2018-07-15 02:00:00 +02:00
|
|
|
protected int b(World world, BlockPosition blockposition) {
|
2016-02-29 22:32:46 +01:00
|
|
|
- int i = Math.min(world.a(Entity.class, BlockPressurePlateWeighted.c.a(blockposition)).size(), this.weight);
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // CraftBukkit start
|
2016-02-29 22:32:46 +01:00
|
|
|
+ // int i = Math.min(world.a(Entity.class, BlockPressurePlateWeighted.c.a(blockposition)).size(), this.weight);
|
2014-11-25 22:32:16 +01:00
|
|
|
+ int i = 0;
|
2016-02-29 22:32:46 +01:00
|
|
|
+ java.util.Iterator iterator = world.a(Entity.class, BlockPressurePlateWeighted.c.a(blockposition)).iterator();
|
2014-11-25 22:32:16 +01:00
|
|
|
+
|
|
|
|
+ while (iterator.hasNext()) {
|
|
|
|
+ Entity entity = (Entity) iterator.next();
|
|
|
|
+
|
|
|
|
+ org.bukkit.event.Cancellable cancellable;
|
|
|
|
+
|
|
|
|
+ if (entity instanceof EntityHuman) {
|
2016-03-04 05:24:51 +01:00
|
|
|
+ cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null, null);
|
2014-11-25 22:32:16 +01:00
|
|
|
+ } 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++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
2015-07-30 08:56:52 +02:00
|
|
|
+ i = Math.min(i, this.weight);
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // CraftBukkit end
|
|
|
|
|
|
|
|
if (i > 0) {
|
2015-07-30 08:56:52 +02:00
|
|
|
float f = (float) Math.min(this.weight, i) / (float) this.weight;
|