warden AI

This commit is contained in:
Lulu13022002 2024-12-13 21:36:11 +01:00
parent f73e864f18
commit c6a426beda
No known key found for this signature in database
GPG key ID: 491C8F0B8ACDEB01
4 changed files with 22 additions and 33 deletions

View file

@ -0,0 +1,11 @@
--- a/net/minecraft/world/entity/ai/behavior/warden/Digging.java
+++ b/net/minecraft/world/entity/ai/behavior/warden/Digging.java
@@ -39,7 +_,7 @@
@Override
protected void stop(ServerLevel level, E entity, long gameTime) {
if (entity.getRemovalReason() == null) {
- entity.remove(Entity.RemovalReason.DISCARDED);
+ entity.remove(Entity.RemovalReason.DISCARDED, org.bukkit.event.entity.EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - Add bukkit remove cause
}
}
}

View file

@ -0,0 +1,11 @@
--- a/net/minecraft/world/entity/ai/behavior/warden/SonicBoom.java
+++ b/net/minecraft/world/entity/ai/behavior/warden/SonicBoom.java
@@ -83,7 +_,7 @@
if (livingEntity.hurtServer(level, level.damageSources().sonicBoom(owner), 10.0F)) {
double d = 0.5 * (1.0 - livingEntity.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE));
double d1 = 2.5 * (1.0 - livingEntity.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE));
- livingEntity.push(vec32.x() * d1, vec32.y() * d, vec32.z() * d1);
+ livingEntity.push(vec32.x() * d1, vec32.y() * d, vec32.z() * d1, owner); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent
}
});
}

View file

@ -1,22 +0,0 @@
--- a/net/minecraft/world/entity/ai/behavior/warden/Digging.java
+++ b/net/minecraft/world/entity/ai/behavior/warden/Digging.java
@@ -10,6 +10,10 @@
import net.minecraft.world.entity.ai.memory.MemoryStatus;
import net.minecraft.world.entity.monster.warden.Warden;
+// CraftBukkit start - imports
+import org.bukkit.event.entity.EntityRemoveEvent;
+// CraftBukkit end
+
public class Digging<E extends Warden> extends Behavior<E> {
public Digging(int duration) {
@@ -37,7 +41,7 @@
protected void stop(ServerLevel worldserver, E e0, long i) {
if (e0.getRemovalReason() == null) {
- e0.remove(Entity.RemovalReason.DISCARDED);
+ e0.remove(Entity.RemovalReason.DISCARDED, EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - Add bukkit remove cause
}
}

View file

@ -1,11 +0,0 @@
--- a/net/minecraft/world/entity/ai/behavior/warden/SonicBoom.java
+++ b/net/minecraft/world/entity/ai/behavior/warden/SonicBoom.java
@@ -83,7 +83,7 @@
if (target.hurtServer(world, world.damageSources().sonicBoom(entity), 10.0F)) {
double d = 0.5 * (1.0 - target.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE));
double e = 2.5 * (1.0 - target.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE));
- target.push(vec33.x() * e, vec33.y() * d, vec33.z() * e);
+ target.push(vec33.x() * e, vec33.y() * d, vec33.z() * e, entity); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent
}
});
}