diff options
author | MiniDigger | Martin <[email protected]> | 2024-01-14 11:04:49 +0100 |
---|---|---|
committer | MiniDigger | Martin <[email protected]> | 2024-01-14 11:04:49 +0100 |
commit | bee74680e607c2e29b038329f62181238911cd83 (patch) | |
tree | 708fd1a4a0227d9071243adf2a42d5e9e96cde4a /patch-remap/og/net/minecraft/world/level/block/BlockPressurePlateBinary.patch | |
parent | 0a44692ef6ff6e255d48eb3ba1bb114166eafda9 (diff) | |
download | Paper-softspoon.tar.gz Paper-softspoon.zip |
add remapped patches as a testsoftspoon
Diffstat (limited to 'patch-remap/og/net/minecraft/world/level/block/BlockPressurePlateBinary.patch')
-rw-r--r-- | patch-remap/og/net/minecraft/world/level/block/BlockPressurePlateBinary.patch | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/patch-remap/og/net/minecraft/world/level/block/BlockPressurePlateBinary.patch b/patch-remap/og/net/minecraft/world/level/block/BlockPressurePlateBinary.patch new file mode 100644 index 0000000000..43f9df9d0c --- /dev/null +++ b/patch-remap/og/net/minecraft/world/level/block/BlockPressurePlateBinary.patch @@ -0,0 +1,56 @@ +--- a/net/minecraft/world/level/block/BlockPressurePlateBinary.java ++++ b/net/minecraft/world/level/block/BlockPressurePlateBinary.java +@@ -13,6 +13,11 @@ + import net.minecraft.world.level.block.state.properties.BlockSetType; + import net.minecraft.world.level.block.state.properties.BlockStateBoolean; + ++// CraftBukkit start ++import net.minecraft.world.entity.player.EntityHuman; ++import org.bukkit.event.entity.EntityInteractEvent; ++// CraftBukkit end ++ + public class BlockPressurePlateBinary extends BlockPressurePlateAbstract { + + public static final MapCodec<BlockPressurePlateBinary> CODEC = RecordCodecBuilder.mapCodec((instance) -> { +@@ -44,7 +49,7 @@ + + @Override + protected int getSignalStrength(World world, BlockPosition blockposition) { +- Class oclass; ++ Class<? extends Entity> oclass; // CraftBukkit + + switch (this.type.pressurePlateSensitivity()) { + case EVERYTHING: +@@ -59,7 +64,31 @@ + + Class<? extends Entity> oclass1 = oclass; + +- return getEntityCount(world, BlockPressurePlateBinary.TOUCH_AABB.move(blockposition), oclass1) > 0 ? 15 : 0; ++ // CraftBukkit start - Call interact event when turning on a pressure plate ++ for (Entity entity : getEntities(world, BlockPressurePlateBinary.TOUCH_AABB.move(blockposition), oclass)) { ++ if (this.getSignalForState(world.getBlockState(blockposition)) == 0) { ++ org.bukkit.World bworld = world.getWorld(); ++ org.bukkit.plugin.PluginManager manager = world.getCraftServer().getPluginManager(); ++ org.bukkit.event.Cancellable cancellable; ++ ++ if (entity instanceof EntityHuman) { ++ cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null, null); ++ } else { ++ cancellable = new EntityInteractEvent(entity.getBukkitEntity(), bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.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 |