PaperMC/paper-server/nms-patches/net/minecraft/world/level/block/BlockPressurePlateAbstract.patch
CraftBukkit/Spigot 43702a9e10 Update to Minecraft 1.18-pre5
By: md_5 <git@md-5.net>
2021-11-22 09:00:00 +11:00

31 lines
1.3 KiB
Diff

--- a/net/minecraft/world/level/block/BlockPressurePlateAbstract.java
+++ b/net/minecraft/world/level/block/BlockPressurePlateAbstract.java
@@ -18,6 +18,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
public abstract class BlockPressurePlateAbstract extends Block {
protected static final VoxelShape PRESSED_AABB = Block.box(1.0D, 0.0D, 1.0D, 15.0D, 0.5D, 15.0D);
@@ -81,6 +83,19 @@
boolean flag = i > 0;
boolean flag1 = j > 0;
+ // CraftBukkit start - Interact Pressure Plate
+ org.bukkit.World bworld = world.getWorld();
+ org.bukkit.plugin.PluginManager manager = world.getCraftServer().getPluginManager();
+
+ if (flag != flag1) {
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), i, j);
+ manager.callEvent(eventRedstone);
+
+ flag1 = eventRedstone.getNewCurrent() > 0;
+ j = eventRedstone.getNewCurrent();
+ }
+ // CraftBukkit end
+
if (i != j) {
IBlockData iblockdata1 = this.setSignalForState(iblockdata, j);