diff options
Diffstat (limited to 'patch-remap/og/net/minecraft/world/level/block/BlockTripwire.patch')
-rw-r--r-- | patch-remap/og/net/minecraft/world/level/block/BlockTripwire.patch | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/patch-remap/og/net/minecraft/world/level/block/BlockTripwire.patch b/patch-remap/og/net/minecraft/world/level/block/BlockTripwire.patch new file mode 100644 index 0000000000..168a220143 --- /dev/null +++ b/patch-remap/og/net/minecraft/world/level/block/BlockTripwire.patch @@ -0,0 +1,52 @@ +--- a/net/minecraft/world/level/block/BlockTripwire.java ++++ b/net/minecraft/world/level/block/BlockTripwire.java +@@ -27,6 +27,8 @@ + import net.minecraft.world.phys.shapes.VoxelShape; + import net.minecraft.world.phys.shapes.VoxelShapeCollision; + ++import org.bukkit.event.entity.EntityInteractEvent; // CraftBukkit ++ + public class BlockTripwire extends Block { + + public static final MapCodec<BlockTripwire> CODEC = RecordCodecBuilder.mapCodec((instance) -> { +@@ -166,6 +168,40 @@ + } + } + ++ // CraftBukkit start - Call interact even when triggering connected tripwire ++ if (flag != flag1 && flag1 && (Boolean)iblockdata.getValue(ATTACHED)) { ++ org.bukkit.World bworld = world.getWorld(); ++ org.bukkit.plugin.PluginManager manager = world.getCraftServer().getPluginManager(); ++ org.bukkit.block.Block block = bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); ++ boolean allowed = false; ++ ++ // If all of the events are cancelled block the tripwire trigger, else allow ++ for (Object object : list) { ++ if (object != null) { ++ org.bukkit.event.Cancellable cancellable; ++ ++ if (object instanceof EntityHuman) { ++ cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) object, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null, null); ++ } else if (object instanceof Entity) { ++ cancellable = new EntityInteractEvent(((Entity) object).getBukkitEntity(), block); ++ manager.callEvent((EntityInteractEvent) cancellable); ++ } else { ++ continue; ++ } ++ ++ if (!cancellable.isCancelled()) { ++ allowed = true; ++ break; ++ } ++ } ++ } ++ ++ if (!allowed) { ++ return; ++ } ++ } ++ // CraftBukkit end ++ + if (flag1 != flag) { + iblockdata = (IBlockData) iblockdata.setValue(BlockTripwire.POWERED, flag1); + world.setBlock(blockposition, iblockdata, 3); |