aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/BasePressurePlateBlock.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/BasePressurePlateBlock.java.patch')
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/BasePressurePlateBlock.java.patch59
1 files changed, 59 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/BasePressurePlateBlock.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/BasePressurePlateBlock.java.patch
new file mode 100644
index 0000000000..782819529b
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/BasePressurePlateBlock.java.patch
@@ -0,0 +1,59 @@
+--- a/net/minecraft/world/level/block/BasePressurePlateBlock.java
++++ b/net/minecraft/world/level/block/BasePressurePlateBlock.java
+@@ -20,6 +21,7 @@
+ import net.minecraft.world.phys.AABB;
+ import net.minecraft.world.phys.shapes.CollisionContext;
+ import net.minecraft.world.phys.shapes.VoxelShape;
++import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
+ public abstract class BasePressurePlateBlock extends Block {
+ protected static final VoxelShape PRESSED_AABB = Block.box(1.0, 0.0, 1.0, 15.0, 0.5, 15.0);
+@@ -83,10 +89,25 @@
+ private void checkPressed(@Nullable Entity entity, Level level, BlockPos pos, BlockState state, int currentSignal) {
+ int signalStrength = this.getSignalStrength(level, pos);
+ boolean flag = currentSignal > 0;
+- boolean flag1 = signalStrength > 0;
+- if (currentSignal != signalStrength) {
+- BlockState blockState = this.setSignalForState(state, signalStrength);
+- level.setBlock(pos, blockState, 2);
++ boolean flag1 = j > 0;
++
++ // CraftBukkit start - Interact Pressure Plate
++ org.bukkit.World bworld = level.getWorld();
++ org.bukkit.plugin.PluginManager manager = level.getCraftServer().getPluginManager();
++
++ if (flag != flag1) {
++ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bworld.getBlockAt(pos.getX(), pos.getY(), pos.getZ()), currentSignal, j);
++ manager.callEvent(eventRedstone);
++
++ flag1 = eventRedstone.getNewCurrent() > 0;
++ j = eventRedstone.getNewCurrent();
++ }
++ // CraftBukkit end
++
++ if (currentSignal != j) {
++ IBlockData iblockdata1 = this.setSignalForState(state, j);
++
++ level.setBlock(pos, iblockdata1, 2);
+ this.updateNeighbours(level, pos);
+ level.setBlocksDirty(pos, state, blockState);
+ }
+@@ -136,9 +158,17 @@
+ }
+
+ protected static int getEntityCount(Level level, AABB box, Class<? extends Entity> entityClass) {
+- return level.getEntitiesOfClass(entityClass, box, EntitySelector.NO_SPECTATORS.and(entity -> !entity.isIgnoringBlockTriggers())).size();
++ // CraftBukkit start
++ return getEntities(level, box, entityClass).size();
+ }
+
++ protected static <T extends Entity> java.util.List<T> getEntities(Level world, AABB axisalignedbb, Class<T> oclass) {
++ // CraftBukkit end
++ return world.getEntitiesOfClass(oclass, axisalignedbb, EntitySelector.NO_SPECTATORS.and((entity) -> {
++ return !entity.isIgnoringBlockTriggers();
++ })); // CraftBukkit
++ }
++
+ protected abstract int getSignalStrength(Level level, BlockPos pos);
+
+ protected abstract int getSignalForState(BlockState state);