diff options
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/TripWireBlock.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/TripWireBlock.java.patch | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/TripWireBlock.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/TripWireBlock.java.patch new file mode 100644 index 0000000000..3872e5202c --- /dev/null +++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/TripWireBlock.java.patch @@ -0,0 +1,51 @@ +--- a/net/minecraft/world/level/block/TripWireBlock.java ++++ b/net/minecraft/world/level/block/TripWireBlock.java +@@ -26,6 +26,7 @@ + import net.minecraft.world.level.gameevent.GameEvent; + import net.minecraft.world.phys.shapes.CollisionContext; + import net.minecraft.world.phys.shapes.VoxelShape; ++import org.bukkit.event.entity.EntityInteractEvent; // CraftBukkit + + public class TripWireBlock extends Block { + +@@ -175,6 +167,40 @@ + } + } + ++ // CraftBukkit start - Call interact even when triggering connected tripwire ++ if (flag != flag1 && flag1 && (Boolean)iblockdata.getValue(ATTACHED)) { ++ org.bukkit.World bworld = level.getWorld(); ++ org.bukkit.plugin.PluginManager manager = level.getCraftServer().getPluginManager(); ++ org.bukkit.block.Block block = bworld.getBlockAt(pos.getX(), pos.getY(), pos.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 Player) { ++ cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((Player) object, org.bukkit.event.block.Action.PHYSICAL, pos, 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) { + blockstate = (BlockState) blockstate.setValue(TripWireBlock.POWERED, flag1); + level.setBlock(blockpos, blockstate, 3); |