3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-21 05:50:05 +01:00
Paper/nms-patches/BehaviorInteractDoor.patch

34 Zeilen
1.7 KiB
Diff

2019-04-23 04:00:00 +02:00
--- a/net/minecraft/server/BehaviorInteractDoor.java
+++ b/net/minecraft/server/BehaviorInteractDoor.java
@@ -27,7 +27,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) {
@@ -39,13 +39,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);
}