1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2024-12-15 03:05:39 +01:00
PaperMC/nms-patches/EntityPanda.patch
2019-07-20 09:00:00 +10:00

53 lines
2.5 KiB
Diff

--- a/net/minecraft/server/EntityPanda.java
+++ b/net/minecraft/server/EntityPanda.java
@@ -9,6 +9,8 @@
import java.util.function.Predicate;
import javax.annotation.Nullable;
+import org.bukkit.event.entity.EntityTargetEvent; // CraftBukkit
+
public class EntityPanda extends EntityAnimal {
private static final DataWatcherObject<Integer> bA = DataWatcher.a(EntityPanda.class, DataWatcherRegistry.b);
@@ -445,7 +447,7 @@
@Override
protected void a(EntityItem entityitem) {
- if (this.getEquipment(EnumItemSlot.MAINHAND).isEmpty() && EntityPanda.PICKUP_PREDICATE.test(entityitem)) {
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(this, entityitem, 0, !(this.getEquipment(EnumItemSlot.MAINHAND).isEmpty() && EntityPanda.PICKUP_PREDICATE.test(entityitem))).isCancelled()) { // CraftBukkit
ItemStack itemstack = entityitem.getItemStack();
this.setSlot(EnumItemSlot.MAINHAND, itemstack);
@@ -673,7 +675,7 @@
@Override
protected void a(EntityInsentient entityinsentient, EntityLiving entityliving) {
if (entityinsentient instanceof EntityPanda && ((EntityPanda) entityinsentient).dR()) {
- entityinsentient.setGoalTarget(entityliving);
+ entityinsentient.setGoalTarget(entityliving, EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY, true); // CraftBukkit
}
}
@@ -777,9 +779,9 @@
private final EntityPanda i;
public c(EntityPanda entitypanda, Class<T> oclass, float f, double d0, double d1) {
- Predicate predicate = IEntitySelector.f;
+ // Predicate predicate = IEntitySelector.f; // CraftBukkit - decompile error
- super(entitypanda, oclass, f, d0, d1, predicate::test);
+ super(entitypanda, oclass, f, d0, d1, IEntitySelector.f::test); // CraftBukkit - decompile error
this.i = entitypanda;
}
@@ -808,9 +810,9 @@
this.e.s(32);
this.f = this.e.ticksLived + 600;
if (this.e.df()) {
- EntityHuman entityhuman = this.b.a(EntityPanda.d.d, (EntityLiving) this.e);
+ EntityHuman entityhuman = this.b.a(d, (EntityLiving) this.e); // CraftBukkit - decompile error
- this.e.setGoalTarget(entityhuman);
+ this.e.setGoalTarget(entityhuman, EntityTargetEvent.TargetReason.CLOSEST_PLAYER, true); // CraftBukkit
}
}