Paper/nms-patches/BehaviorInteractDoor.patch
2019-05-14 10:00:00 +10:00

34 lines
1.7 KiB
Diff

--- a/net/minecraft/server/BehaviorInteractDoor.java
+++ b/net/minecraft/server/BehaviorInteractDoor.java
@@ -23,7 +23,7 @@
Set<BlockPosition> set = this.a(worldserver, list, list1);
int j = pathentity.f() - 1;
- this.a(worldserver, list1, set, j);
+ this.a(worldserver, list1, set, j, entityliving); // CraftBukkit - add entity
}
private Set<BlockPosition> a(WorldServer worldserver, List<GlobalPos> list, List<BlockPosition> list1) {
@@ -35,13 +35,20 @@
return (Set) stream.filter(list1::contains).collect(Collectors.toSet());
}
- private void a(WorldServer worldserver, List<BlockPosition> list, Set<BlockPosition> set, int i) {
+ private void a(WorldServer worldserver, List<BlockPosition> list, Set<BlockPosition> set, int i, EntityLiving entityliving) { // CraftBukkit - add entity
set.forEach((blockposition) -> {
int j = list.indexOf(blockposition);
IBlockData iblockdata = worldserver.getType(blockposition);
Block block = iblockdata.getBlock();
if (TagsBlock.WOODEN_DOORS.isTagged(block) && block instanceof BlockDoor) {
+ // CraftBukkit start - entities opening doors
+ org.bukkit.event.entity.EntityInteractEvent event = new org.bukkit.event.entity.EntityInteractEvent(entityliving.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(entityliving.world, blockposition));
+ entityliving.world.getServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return;
+ }
+ // CaftBukkit end
((BlockDoor) block).setDoor(worldserver, blockposition, j >= i);
}