mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-12 20:26:46 +01:00
49 lines
3.0 KiB
Diff
49 lines
3.0 KiB
Diff
--- a/net/minecraft/server/BehaviorInteractDoor.java
|
|
+++ b/net/minecraft/server/BehaviorInteractDoor.java
|
|
@@ -52,6 +52,13 @@
|
|
BlockDoor blockdoor = (BlockDoor) iblockdata.getBlock();
|
|
|
|
if (!blockdoor.h(iblockdata)) {
|
|
+ // 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
|
|
blockdoor.setDoor(worldserver, iblockdata, blockposition, true);
|
|
}
|
|
|
|
@@ -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
|
|
}
|
|
|
|
}
|