--- a/net/minecraft/world/level/block/BlockPressurePlateAbstract.java +++ b/net/minecraft/world/level/block/BlockPressurePlateAbstract.java @@ -21,6 +21,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); @@ -86,6 +88,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); @@ -140,9 +155,15 @@ } protected static int getEntityCount(World world, AxisAlignedBB axisalignedbb, Class oclass) { + // CraftBukkit start + return getEntities(world, axisalignedbb, oclass).size(); + } + + protected static java.util.List getEntities(World world, AxisAlignedBB axisalignedbb, Class oclass) { + // CraftBukkit end return world.getEntitiesOfClass(oclass, axisalignedbb, IEntitySelector.NO_SPECTATORS.and((entity) -> { return !entity.isIgnoringBlockTriggers(); - })).size(); + })); // CraftBukkit } protected abstract int getSignalStrength(World world, BlockPosition blockposition);