summaryrefslogtreecommitdiffstats
path: root/nms-patches/EntityInsentient.patch
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2018-07-15 10:00:00 +1000
committermd_5 <git@md-5.net>2018-07-15 10:00:00 +1000
commit421c1728c81e2f729dff88da2ac96535d2b8e5e8 (patch)
tree6c51d93e811d1eb86b68461a42fc5cf03b168b0c /nms-patches/EntityInsentient.patch
parent57ab4cfc6f4ff526d44319d9b8c79f6848db2de7 (diff)
downloadcraftbukkit-421c1728c81e2f729dff88da2ac96535d2b8e5e8.tar
craftbukkit-421c1728c81e2f729dff88da2ac96535d2b8e5e8.tar.gz
craftbukkit-421c1728c81e2f729dff88da2ac96535d2b8e5e8.tar.lz
craftbukkit-421c1728c81e2f729dff88da2ac96535d2b8e5e8.tar.xz
craftbukkit-421c1728c81e2f729dff88da2ac96535d2b8e5e8.zip
Update to Minecraft 1.13-pre7
Diffstat (limited to 'nms-patches/EntityInsentient.patch')
-rw-r--r--nms-patches/EntityInsentient.patch77
1 files changed, 45 insertions, 32 deletions
diff --git a/nms-patches/EntityInsentient.patch b/nms-patches/EntityInsentient.patch
index ef6aadb7..a93da205 100644
--- a/nms-patches/EntityInsentient.patch
+++ b/nms-patches/EntityInsentient.patch
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityInsentient.java
+++ b/net/minecraft/server/EntityInsentient.java
-@@ -9,6 +9,17 @@
+@@ -9,6 +9,18 @@
import java.util.UUID;
import javax.annotation.Nullable;
@@ -8,6 +8,7 @@
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
+import org.bukkit.entity.LivingEntity;
++import org.bukkit.event.entity.EntityCombustByEntityEvent;
+import org.bukkit.event.entity.EntityPickupItemEvent;
+import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
+import org.bukkit.event.entity.EntityTargetEvent;
@@ -18,17 +19,17 @@
public abstract class EntityInsentient extends EntityLiving {
private static final DataWatcherObject<Byte> a = DataWatcher.a(EntityInsentient.class, DataWatcherRegistry.a);
-@@ -27,7 +38,7 @@
+@@ -27,7 +39,7 @@
public float[] dropChanceHand;
- private final NonNullList<ItemStack> by;
+ private final NonNullList<ItemStack> bE;
public float[] dropChanceArmor;
- public boolean canPickUpLoot;
+ // public boolean canPickUpLoot; // CraftBukkit - moved up to EntityLiving
public boolean persistent;
- private final Map<PathType, Float> bB;
- private MinecraftKey bC;
-@@ -57,6 +68,9 @@
- this.r();
+ private final Map<PathType, Float> bH;
+ private MinecraftKey bI;
+@@ -57,6 +69,9 @@
+ this.n();
}
+ // CraftBukkit start - default persistance to type's persistance value
@@ -36,8 +37,8 @@
+ // CraftBukkit end
}
- protected void r() {}
-@@ -110,7 +124,38 @@
+ protected void n() {}
+@@ -110,7 +125,38 @@
}
public void setGoalTarget(@Nullable EntityLiving entityliving) {
@@ -75,18 +76,18 @@
+ // CraftBukkit end
}
- public boolean d(Class<? extends EntityLiving> oclass) {
-@@ -340,11 +385,20 @@
+ public boolean b(Class<? extends EntityLiving> oclass) {
+@@ -336,11 +382,20 @@
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
+
+ // CraftBukkit start - If looting or persistence is false only use it if it was set after we started using it
if (nbttagcompound.hasKeyOfType("CanPickUpLoot", 1)) {
-- this.m(nbttagcompound.getBoolean("CanPickUpLoot"));
+- this.p(nbttagcompound.getBoolean("CanPickUpLoot"));
+ boolean data = nbttagcompound.getBoolean("CanPickUpLoot");
+ if (isLevelAtLeast(nbttagcompound, 1) || data) {
-+ this.m(data);
++ this.p(data);
+ }
}
@@ -99,13 +100,13 @@
NBTTagList nbttaglist;
int i;
-@@ -508,7 +562,15 @@
- }
- }
+@@ -470,11 +525,21 @@
+ ItemStack itemstack1 = this.getEquipment(enumitemslot);
+ boolean flag = this.a(itemstack, itemstack1, enumitemslot);
-- if (flag && this.c(itemstack)) {
+- if (flag && this.d(itemstack)) {
+ // CraftBukkit start
-+ boolean canPickup = flag && this.c(itemstack);
++ boolean canPickup = flag && this.d(itemstack);
+
+ EntityPickupItemEvent entityEvent = new EntityPickupItemEvent((LivingEntity) getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity(), 0);
+ entityEvent.setCancelled(!canPickup);
@@ -113,20 +114,16 @@
+ canPickup = !entityEvent.isCancelled();
+ if (canPickup) {
+ // CraftBukkit end
- double d0;
-
- switch (enumitemslot.a()) {
-@@ -525,7 +587,9 @@
- }
+ double d0 = this.c(enumitemslot);
if (!itemstack1.isEmpty() && (double) (this.random.nextFloat() - 0.1F) < d0) {
+ this.forceDrops = true; // CraftBukkit
- this.a(itemstack1, 0.0F);
+ this.a_(itemstack1);
+ this.forceDrops = false; // CraftBukkit
}
this.setSlot(enumitemslot, itemstack);
-@@ -565,11 +629,11 @@
+@@ -554,11 +619,11 @@
double d2 = entityhuman.locZ - this.locZ;
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
@@ -140,7 +137,7 @@
this.die();
} else if (d3 < 1024.0D) {
this.ticksFarFromPlayer = 0;
-@@ -938,12 +1002,24 @@
+@@ -946,12 +1011,24 @@
public final boolean b(EntityHuman entityhuman, EnumHand enumhand) {
if (this.isLeashed() && this.getLeashHolder() == entityhuman) {
@@ -165,9 +162,9 @@
this.setLeashHolder(entityhuman, true);
itemstack.subtract(1);
return true;
-@@ -964,10 +1040,12 @@
+@@ -972,10 +1049,12 @@
- if (this.bE) {
+ if (this.bK) {
if (!this.isAlive()) {
+ this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.PLAYER_UNLEASH)); // CraftBukkit
this.unleash(true, true);
@@ -178,17 +175,17 @@
this.unleash(true, true);
}
}
-@@ -978,7 +1056,9 @@
- this.bE = false;
+@@ -986,7 +1065,9 @@
+ this.bK = false;
this.leashHolder = null;
if (!this.world.isClientSide && flag1) {
+ this.forceDrops = true; // CraftBukkit
- this.a(Items.LEAD, 1);
+ this.a((IMaterial) Items.LEAD);
+ this.forceDrops = false; // CraftBukkit
}
if (!this.world.isClientSide && flag && this.world instanceof WorldServer) {
-@@ -1048,6 +1128,7 @@
+@@ -1056,6 +1137,7 @@
this.setLeashHolder(entityleash, true);
} else {
@@ -196,3 +193,19 @@
this.unleash(false, true);
}
}
+@@ -1151,7 +1233,14 @@
+ int j = EnchantmentManager.getFireAspectEnchantmentLevel(this);
+
+ if (j > 0) {
+- entity.setOnFire(j * 4);
++ // CraftBukkit start - Call a combust event when somebody hits with a fire enchanted item
++ EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), j * 4);
++ org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
++
++ if (!combustEvent.isCancelled()) {
++ entity.setOnFire(combustEvent.getDuration());
++ }
++ // CraftBukkit end
+ }
+
+ if (entity instanceof EntityHuman) {