Paper/nms-patches/BehaviorInteractDoor.patch

49 lines
3.0 KiB
Diff
Raw Normal View History

2019-04-23 04:00:00 +02:00
--- a/net/minecraft/server/BehaviorInteractDoor.java
+++ b/net/minecraft/server/BehaviorInteractDoor.java
2020-08-11 23:00:00 +02:00
@@ -52,6 +52,13 @@
BlockDoor blockdoor = (BlockDoor) iblockdata.getBlock();
2019-07-20 01:00:00 +02:00
2020-08-11 23:00:00 +02:00
if (!blockdoor.h(iblockdata)) {
2019-04-23 04:00:00 +02:00
+ // 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;
+ }
2020-08-11 23:00:00 +02:00
+ // CraftBukkit end
blockdoor.setDoor(worldserver, iblockdata, blockposition, true);
}
2019-04-23 04:00:00 +02:00
2020-08-11 23:00:00 +02:00
@@ -65,6 +72,13 @@
BlockDoor blockdoor1 = (BlockDoor) iblockdata1.getBlock();
if (!blockdoor1.h(iblockdata1)) {
+ // 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;
+ }
+ // CraftBukkit end
blockdoor1.setDoor(worldserver, iblockdata1, blockposition1, true);
this.c(worldserver, entityliving, blockposition1);
}
@@ -113,7 +127,7 @@
private static boolean a(WorldServer worldserver, EntityLiving entityliving, BlockPosition blockposition) {
BehaviorController<?> behaviorcontroller = entityliving.getBehaviorController();
- return !behaviorcontroller.hasMemory(MemoryModuleType.MOBS) ? false : ((List) behaviorcontroller.getMemory(MemoryModuleType.MOBS).get()).stream().filter((entityliving1) -> {
+ return !behaviorcontroller.hasMemory(MemoryModuleType.MOBS) ? false : (behaviorcontroller.getMemory(MemoryModuleType.MOBS).get()).stream().filter((entityliving1) -> { // CraftBukkit - decompile error
return entityliving1.getEntityType() == entityliving.getEntityType();
}).filter((entityliving1) -> {
return blockposition.a((IPosition) entityliving1.getPositionVector(), 2.0D);
@@ -155,7 +169,7 @@
if (behaviorcontroller.getMemory(MemoryModuleType.DOORS_TO_CLOSE).isPresent()) {
((Set) behaviorcontroller.getMemory(MemoryModuleType.DOORS_TO_CLOSE).get()).add(globalpos);
} else {
- behaviorcontroller.setMemory(MemoryModuleType.DOORS_TO_CLOSE, (Object) Sets.newHashSet(new GlobalPos[]{globalpos}));
+ behaviorcontroller.setMemory(MemoryModuleType.DOORS_TO_CLOSE, Sets.newHashSet(new GlobalPos[]{globalpos})); // CraftBukkit - decompile error
}
}