summaryrefslogtreecommitdiffstats
path: root/nms-patches/EntityInsentient.patch
diff options
context:
space:
mode:
Diffstat (limited to 'nms-patches/EntityInsentient.patch')
-rw-r--r--nms-patches/EntityInsentient.patch41
1 files changed, 30 insertions, 11 deletions
diff --git a/nms-patches/EntityInsentient.patch b/nms-patches/EntityInsentient.patch
index 8098e9a7..ef6aadb7 100644
--- a/nms-patches/EntityInsentient.patch
+++ b/nms-patches/EntityInsentient.patch
@@ -1,12 +1,14 @@
--- a/net/minecraft/server/EntityInsentient.java
+++ b/net/minecraft/server/EntityInsentient.java
-@@ -9,6 +9,15 @@
+@@ -9,6 +9,17 @@
import java.util.UUID;
import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
++import org.bukkit.entity.LivingEntity;
++import org.bukkit.event.entity.EntityPickupItemEvent;
+import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
+import org.bukkit.event.entity.EntityTargetEvent;
+import org.bukkit.event.entity.EntityUnleashEvent;
@@ -16,7 +18,7 @@
public abstract class EntityInsentient extends EntityLiving {
private static final DataWatcherObject<Byte> a = DataWatcher.a(EntityInsentient.class, DataWatcherRegistry.a);
-@@ -27,7 +36,7 @@
+@@ -27,7 +38,7 @@
public float[] dropChanceHand;
private final NonNullList<ItemStack> by;
public float[] dropChanceArmor;
@@ -25,7 +27,7 @@
public boolean persistent;
private final Map<PathType, Float> bB;
private MinecraftKey bC;
-@@ -57,6 +66,9 @@
+@@ -57,6 +68,9 @@
this.r();
}
@@ -35,7 +37,7 @@
}
protected void r() {}
-@@ -110,7 +122,38 @@
+@@ -110,7 +124,38 @@
}
public void setGoalTarget(@Nullable EntityLiving entityliving) {
@@ -74,7 +76,7 @@
}
public boolean d(Class<? extends EntityLiving> oclass) {
-@@ -340,11 +383,20 @@
+@@ -340,11 +385,20 @@
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
@@ -97,7 +99,24 @@
NBTTagList nbttaglist;
int i;
-@@ -525,7 +577,9 @@
+@@ -508,7 +562,15 @@
+ }
+ }
+
+- if (flag && this.c(itemstack)) {
++ // CraftBukkit start
++ boolean canPickup = flag && this.c(itemstack);
++
++ EntityPickupItemEvent entityEvent = new EntityPickupItemEvent((LivingEntity) getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity(), 0);
++ entityEvent.setCancelled(!canPickup);
++ this.world.getServer().getPluginManager().callEvent(entityEvent);
++ canPickup = !entityEvent.isCancelled();
++ if (canPickup) {
++ // CraftBukkit end
+ double d0;
+
+ switch (enumitemslot.a()) {
+@@ -525,7 +587,9 @@
}
if (!itemstack1.isEmpty() && (double) (this.random.nextFloat() - 0.1F) < d0) {
@@ -107,7 +126,7 @@
}
this.setSlot(enumitemslot, itemstack);
-@@ -565,11 +619,11 @@
+@@ -565,11 +629,11 @@
double d2 = entityhuman.locZ - this.locZ;
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
@@ -121,7 +140,7 @@
this.die();
} else if (d3 < 1024.0D) {
this.ticksFarFromPlayer = 0;
-@@ -938,12 +992,24 @@
+@@ -938,12 +1002,24 @@
public final boolean b(EntityHuman entityhuman, EnumHand enumhand) {
if (this.isLeashed() && this.getLeashHolder() == entityhuman) {
@@ -146,7 +165,7 @@
this.setLeashHolder(entityhuman, true);
itemstack.subtract(1);
return true;
-@@ -964,10 +1030,12 @@
+@@ -964,10 +1040,12 @@
if (this.bE) {
if (!this.isAlive()) {
@@ -159,7 +178,7 @@
this.unleash(true, true);
}
}
-@@ -978,7 +1046,9 @@
+@@ -978,7 +1056,9 @@
this.bE = false;
this.leashHolder = null;
if (!this.world.isClientSide && flag1) {
@@ -169,7 +188,7 @@
}
if (!this.world.isClientSide && flag && this.world instanceof WorldServer) {
-@@ -1048,6 +1118,7 @@
+@@ -1048,6 +1128,7 @@
this.setLeashHolder(entityleash, true);
} else {