aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/PressurePlateBlock.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/PressurePlateBlock.java.patch')
-rw-r--r--patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/PressurePlateBlock.java.patch56
1 files changed, 56 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/PressurePlateBlock.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/PressurePlateBlock.java.patch
new file mode 100644
index 0000000000..6af2035dc2
--- /dev/null
+++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/PressurePlateBlock.java.patch
@@ -0,0 +1,56 @@
+--- a/net/minecraft/world/level/block/PressurePlateBlock.java
++++ b/net/minecraft/world/level/block/PressurePlateBlock.java
+@@ -12,6 +13,8 @@
+ import net.minecraft.world.level.block.state.properties.BlockSetType;
+ import net.minecraft.world.level.block.state.properties.BlockStateProperties;
+ import net.minecraft.world.level.block.state.properties.BooleanProperty;
++import org.bukkit.event.entity.EntityInteractEvent;
++// CraftBukkit end
+
+ public class PressurePlateBlock extends BasePressurePlateBlock {
+
+@@ -46,9 +46,8 @@
+ }
+
+ @Override
+- @Override
+- protected int getSignalStrength(Level level, BlockPos blockpos) {
+- Class oclass;
++ protected int getSignalStrength(Level level, BlockPos pos) {
++ Class<? extends Entity> oclass; // CraftBukkit
+
+ switch (this.type.pressurePlateSensitivity()) {
+ case EVERYTHING:
+@@ -63,7 +62,31 @@
+
+ Class<? extends Entity> oclass1 = oclass;
+
+- return getEntityCount(level, PressurePlateBlock.TOUCH_AABB.move(blockpos), oclass1) > 0 ? 15 : 0;
++ // CraftBukkit start - Call interact event when turning on a pressure plate
++ for (Entity entity : getEntities(level, PressurePlateBlock.TOUCH_AABB.move(pos), oclass)) {
++ if (this.getSignalForState(level.getBlockState(pos)) == 0) {
++ org.bukkit.World bworld = level.getWorld();
++ org.bukkit.plugin.PluginManager manager = level.getCraftServer().getPluginManager();
++ org.bukkit.event.Cancellable cancellable;
++
++ if (entity instanceof Player) {
++ cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((Player) entity, org.bukkit.event.block.Action.PHYSICAL, pos, null, null, null);
++ } else {
++ cancellable = new EntityInteractEvent(entity.getBukkitEntity(), bworld.getBlockAt(pos.getX(), pos.getY(), pos.getZ()));
++ manager.callEvent((EntityInteractEvent) cancellable);
++ }
++
++ // We only want to block turning the plate on if all events are cancelled
++ if (cancellable.isCancelled()) {
++ continue;
++ }
++ }
++
++ return 15;
++ }
++
++ return 0;
++ // CraftBukkit end
+ }
+
+ @Override