Paper/nms-patches/EntityPanda.patch

42 lines
1.9 KiB
Diff
Raw Normal View History

2019-04-27 05:57:46 +02:00
--- 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 {
2020-06-25 02:00:00 +02:00
private static final DataWatcherObject<Integer> bw = DataWatcher.a(EntityPanda.class, DataWatcherRegistry.b);
@@ -445,7 +447,7 @@
@Override
2020-06-25 02:00:00 +02:00
protected void b(EntityItem entityitem) {
2019-05-27 22:30:00 +02:00
- 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
2020-06-25 02:00:00 +02:00
this.a(entityitem);
ItemStack itemstack = entityitem.getItemStack();
2020-06-25 02:00:00 +02:00
@@ -667,7 +669,7 @@
2019-04-27 05:57:46 +02:00
@Override
protected void a(EntityInsentient entityinsentient, EntityLiving entityliving) {
2020-06-25 02:00:00 +02:00
if (entityinsentient instanceof EntityPanda && ((EntityPanda) entityinsentient).isAggressive()) {
2019-04-27 05:57:46 +02:00
- entityinsentient.setGoalTarget(entityliving);
+ entityinsentient.setGoalTarget(entityliving, EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY, true); // CraftBukkit
}
}
2020-06-25 02:00:00 +02:00
@@ -771,9 +773,9 @@
2019-04-27 05:57:46 +02:00
private final EntityPanda i;
public c(EntityPanda entitypanda, Class<T> oclass, float f, double d0, double d1) {
2020-06-25 02:00:00 +02:00
- Predicate predicate = IEntitySelector.g;
+ // Predicate predicate = IEntitySelector.g; // CraftBukkit - decompile error
2019-04-27 05:57:46 +02:00
- super(entitypanda, oclass, f, d0, d1, predicate::test);
2020-06-25 02:00:00 +02:00
+ super(entitypanda, oclass, f, d0, d1, IEntitySelector.g::test); // CraftBukkit - decompile error
2019-04-27 05:57:46 +02:00
this.i = entitypanda;
}