readd dropped event in InteractWithDoor
This commit is contained in:
@@ -1,12 +1,10 @@
|
||||
--- a/net/minecraft/world/entity/ai/behavior/Behavior.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/Behavior.java
|
||||
@@ -14,6 +_,9 @@
|
||||
@@ -14,6 +_,7 @@
|
||||
private long endTimestamp;
|
||||
private final int minDuration;
|
||||
private final int maxDuration;
|
||||
+ // Paper start - configurable behavior tick rate and timings
|
||||
+ private final String configKey;
|
||||
+ // Paper end - configurable behavior tick rate and timings
|
||||
+ private final String configKey; // Paper - configurable behavior tick rate and timings
|
||||
|
||||
public Behavior(Map<MemoryModuleType<?>, MemoryStatus> entryCondition) {
|
||||
this(entryCondition, 60);
|
||||
@@ -29,12 +27,12 @@
|
||||
|
||||
@Override
|
||||
public final boolean tryStart(ServerLevel level, E owner, long gameTime) {
|
||||
+ // Paper start - configurable behavior tick rate and timings
|
||||
+ int tickRate = java.util.Objects.requireNonNullElse(level.paperConfig().tickRates.behavior.get(owner.getType(), this.configKey), -1);
|
||||
+ if (tickRate > -1 && gameTime < this.endTimestamp + tickRate) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Paper end - configurable behavior tick rate and timings
|
||||
+ // Paper start - configurable behavior tick rate and timings
|
||||
+ int tickRate = java.util.Objects.requireNonNullElse(level.paperConfig().tickRates.behavior.get(owner.getType(), this.configKey), -1);
|
||||
+ if (tickRate > -1 && gameTime < this.endTimestamp + tickRate) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Paper end - configurable behavior tick rate and timings
|
||||
if (this.hasRequiredMemories(owner) && this.checkExtraStartConditions(level, owner)) {
|
||||
this.status = Behavior.Status.RUNNING;
|
||||
int i = this.minDuration + level.getRandom().nextInt(this.maxDuration + 1 - this.minDuration);
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (!(event.getTarget() instanceof org.bukkit.craftbukkit.entity.CraftItem)) { // Paper - only erase allay memory on non-item targets
|
||||
+ if (!(event.getTarget() instanceof org.bukkit.craftbukkit.entity.CraftItem targetItem)) { // Paper - only erase allay memory on non-item targets
|
||||
+ nearestVisibleWantedItem.erase();
|
||||
+ return false; // Paper - only erase allay memory on non-item targets
|
||||
+ }
|
||||
+
|
||||
+ itemEntity = (ItemEntity) ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle();
|
||||
+ itemEntity = targetItem.getHandle();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
WalkTarget walkTarget1 = new WalkTarget(new EntityTracker(itemEntity, false), speedModifier, 0);
|
||||
|
||||
@@ -9,7 +9,20 @@
|
||||
+ if (!event.callEvent()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ // CraftBukkit end - entities opening doors
|
||||
doorBlock.setOpen(entity, level, blockState, blockPos, true);
|
||||
}
|
||||
|
||||
@@ -69,6 +_,12 @@
|
||||
if (blockState1.is(BlockTags.MOB_INTERACTABLE_DOORS, state -> state.getBlock() instanceof DoorBlock)) {
|
||||
DoorBlock doorBlock1 = (DoorBlock)blockState1.getBlock();
|
||||
if (!doorBlock1.isOpen(blockState1)) {
|
||||
+ // CraftBukkit start - entities opening doors
|
||||
+ org.bukkit.event.entity.EntityInteractEvent event = new org.bukkit.event.entity.EntityInteractEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(entity.level(), blockPos1));
|
||||
+ if (!event.callEvent()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end - entities opening doors
|
||||
doorBlock1.setOpen(entity, level, blockState1, blockPos1, true);
|
||||
optional = rememberDoorToClose(doorsToClose, optional, level, blockPos1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user