Paper/nms-patches/BehaviorInteractDoor.patch

23 lines
1.5 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
2019-07-20 01:00:00 +02:00
@@ -46,11 +46,18 @@
2019-04-23 04:00:00 +02:00
if (TagsBlock.WOODEN_DOORS.isTagged(block) && block instanceof BlockDoor) {
2019-07-20 01:00:00 +02:00
boolean flag = j >= i;
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;
+ }
+ // CaftBukkit end
2019-07-20 01:00:00 +02:00
((BlockDoor) block).setDoor(worldserver, blockposition, flag);
2020-06-25 02:00:00 +02:00
GlobalPos globalpos = GlobalPos.create(worldserver.getDimensionKey(), blockposition);
2019-04-23 04:00:00 +02:00
2019-07-20 01:00:00 +02:00
if (!behaviorcontroller.getMemory(MemoryModuleType.OPENED_DOORS).isPresent() && flag) {
- behaviorcontroller.setMemory(MemoryModuleType.OPENED_DOORS, (Object) Sets.newHashSet(new GlobalPos[]{globalpos}));
+ behaviorcontroller.setMemory(MemoryModuleType.OPENED_DOORS, Sets.newHashSet(new GlobalPos[]{globalpos})); // CraftBukkit - decompile error
} else {
behaviorcontroller.getMemory(MemoryModuleType.OPENED_DOORS).ifPresent((set1) -> {
if (flag) {