Paper/nms-patches/EntityDolphin.patch

51 lines
2.3 KiB
Diff

--- a/net/minecraft/server/EntityDolphin.java
+++ b/net/minecraft/server/EntityDolphin.java
@@ -107,7 +107,7 @@
this.goalSelector.a(8, new EntityDolphin.d());
this.goalSelector.a(8, new PathfinderGoalFollowBoat(this));
this.goalSelector.a(9, new PathfinderGoalAvoidTarget<>(this, EntityGuardian.class, 8.0F, 1.0D, 1.0D));
- this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityGuardian.class})).a());
+ this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityGuardian.class})).a(new Class[0])); // CraftBukkit - decompile error
}
@Override
@@ -179,6 +179,11 @@
ItemStack itemstack = entityitem.getItemStack();
if (this.g(itemstack)) {
+ // CraftBukkit start - call EntityPickupItemEvent
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(this, entityitem, 0, false).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
this.setSlot(EnumItemSlot.MAINHAND, itemstack);
this.dropChanceHand[EnumItemSlot.MAINHAND.b()] = 2.0F;
this.receive(entityitem, itemstack.getCount());
@@ -317,7 +322,7 @@
@Override
public boolean a() {
- return this.a.eq() && this.a.getAirTicks() >= 100;
+ return this.a.eq() && this.a.getAirTicks() >= 100 && this.a.world.getWorld().canGenerateStructures(); // MC-151364, SPIGOT-5494: hangs if generate-structures=false
}
@Override
@@ -425,7 +430,7 @@
@Override
public void c() {
- this.c.addEffect(new MobEffect(MobEffects.DOLPHINS_GRACE, 100));
+ this.c.addEffect(new MobEffect(MobEffects.DOLPHINS_GRACE, 100), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.DOLPHIN); // CraftBukkit
}
@Override
@@ -444,7 +449,7 @@
}
if (this.c.isSwimming() && this.c.world.random.nextInt(6) == 0) {
- this.c.addEffect(new MobEffect(MobEffects.DOLPHINS_GRACE, 100));
+ this.c.addEffect(new MobEffect(MobEffects.DOLPHINS_GRACE, 100), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.DOLPHIN); // CraftBukkit
}
}