summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nms-patches/EntityInsentient.patch9
-rw-r--r--nms-patches/EntityItem.patch2
-rw-r--r--nms-patches/EntityLiving.patch55
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java6
4 files changed, 40 insertions, 32 deletions
diff --git a/nms-patches/EntityInsentient.patch b/nms-patches/EntityInsentient.patch
index f29afe3e..8098e9a7 100644
--- a/nms-patches/EntityInsentient.patch
+++ b/nms-patches/EntityInsentient.patch
@@ -16,6 +16,15 @@
public abstract class EntityInsentient extends EntityLiving {
private static final DataWatcherObject<Byte> a = DataWatcher.a(EntityInsentient.class, DataWatcherRegistry.a);
+@@ -27,7 +36,7 @@
+ public float[] dropChanceHand;
+ private final NonNullList<ItemStack> by;
+ 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 +66,9 @@
this.r();
}
diff --git a/nms-patches/EntityItem.patch b/nms-patches/EntityItem.patch
index 078275d7..f34b0b89 100644
--- a/nms-patches/EntityItem.patch
+++ b/nms-patches/EntityItem.patch
@@ -88,7 +88,7 @@
+ if (this.pickupDelay <= 0 && canHold > 0) {
+ itemstack.setCount(canHold);
+ PlayerPickupItemEvent event = new PlayerPickupItemEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining);
-+ // event.setCancelled(!entityhuman.canPickUpLoot); TODO
++ event.setCancelled(!entityhuman.canPickUpLoot);
+ this.world.getServer().getPluginManager().callEvent(event);
+ itemstack.setCount(canHold + remaining);
+
diff --git a/nms-patches/EntityLiving.patch b/nms-patches/EntityLiving.patch
index e08c8599..0172fc29 100644
--- a/nms-patches/EntityLiving.patch
+++ b/nms-patches/EntityLiving.patch
@@ -25,7 +25,7 @@
public abstract class EntityLiving extends Entity {
private static final Logger a = LogManager.getLogger();
-@@ -88,6 +106,14 @@
+@@ -88,6 +106,15 @@
private BlockPosition bF;
private DamageSource bG;
private long bH;
@@ -36,11 +36,12 @@
+ ArrayList<org.bukkit.inventory.ItemStack> drops = new ArrayList<org.bukkit.inventory.ItemStack>();
+ public org.bukkit.craftbukkit.attribute.CraftAttributeMap craftAttributes;
+ public boolean collides = true;
++ public boolean canPickUpLoot;
+ // CraftBukkit end
public void killEntity() {
this.damageEntity(DamageSource.OUT_OF_WORLD, Float.MAX_VALUE);
-@@ -102,7 +128,8 @@
+@@ -102,7 +129,8 @@
this.updateEffects = true;
this.activeItem = ItemStack.a;
this.initAttributes();
@@ -50,7 +51,7 @@
this.i = true;
this.aM = (float) ((Math.random() + 1.0D) * 0.009999999776482582D);
this.setPosition(this.locX, this.locY, this.locZ);
-@@ -140,7 +167,13 @@
+@@ -140,7 +168,13 @@
double d1 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
int i = (int) (150.0D * d1);
@@ -65,7 +66,7 @@
}
}
-@@ -202,7 +235,11 @@
+@@ -202,7 +236,11 @@
this.stopRiding();
}
} else {
@@ -78,7 +79,7 @@
}
if (!this.world.isClientSide) {
-@@ -259,6 +296,18 @@
+@@ -259,6 +297,18 @@
this.world.methodProfiler.b();
}
@@ -97,7 +98,7 @@
protected void b(BlockPosition blockposition) {
int i = EnchantmentManager.a(Enchantments.j, this);
-@@ -274,19 +323,19 @@
+@@ -274,19 +324,19 @@
protected void bO() {
++this.deathTicks;
@@ -126,7 +127,7 @@
this.die();
-@@ -442,6 +491,17 @@
+@@ -442,6 +492,17 @@
}
}
@@ -144,7 +145,7 @@
if (nbttagcompound.hasKeyOfType("Health", 99)) {
this.setHealth(nbttagcompound.getFloat("Health"));
}
-@@ -464,9 +524,15 @@
+@@ -464,9 +525,15 @@
}
@@ -160,7 +161,7 @@
try {
while (iterator.hasNext()) {
MobEffectList mobeffectlist = (MobEffectList) iterator.next();
-@@ -484,6 +550,17 @@
+@@ -484,6 +551,17 @@
} catch (ConcurrentModificationException concurrentmodificationexception) {
;
}
@@ -178,7 +179,7 @@
if (this.updateEffects) {
if (!this.world.isClientSide) {
-@@ -585,6 +662,12 @@
+@@ -585,6 +663,12 @@
}
public void addEffect(MobEffect mobeffect) {
@@ -191,7 +192,7 @@
if (this.d(mobeffect)) {
MobEffect mobeffect1 = (MobEffect) this.effects.get(mobeffect.getMobEffect());
-@@ -617,6 +700,12 @@
+@@ -617,6 +701,12 @@
@Nullable
public MobEffect c(@Nullable MobEffectList mobeffectlist) {
@@ -204,7 +205,7 @@
return (MobEffect) this.effects.remove(mobeffectlist);
}
-@@ -656,20 +745,52 @@
+@@ -656,20 +746,52 @@
}
@@ -258,7 +259,7 @@
this.datawatcher.set(EntityLiving.HEALTH, Float.valueOf(MathHelper.a(f, 0.0F, this.getMaxHealth())));
}
-@@ -687,14 +808,16 @@
+@@ -687,14 +809,16 @@
} else {
float f1 = f;
@@ -278,7 +279,7 @@
this.damageShield(f);
f = 0.0F;
if (!damagesource.a()) {
-@@ -713,20 +836,39 @@
+@@ -713,20 +837,39 @@
if ((float) this.noDamageTicks > (float) this.maxNoDamageTicks / 2.0F) {
if (f <= this.lastDamage) {
@@ -320,7 +321,7 @@
this.aA = 0.0F;
Entity entity1 = damagesource.getEntity();
-@@ -833,18 +975,26 @@
+@@ -833,18 +976,26 @@
EnumHand[] aenumhand = EnumHand.values();
int i = aenumhand.length;
@@ -350,7 +351,7 @@
if (this instanceof EntityPlayer) {
EntityPlayer entityplayer = (EntityPlayer) this;
-@@ -859,7 +1009,7 @@
+@@ -859,7 +1010,7 @@
this.world.broadcastEntityEffect(this, (byte) 35);
}
@@ -359,7 +360,7 @@
}
}
-@@ -944,6 +1094,12 @@
+@@ -944,6 +1095,12 @@
boolean flag = this.lastDamageByPlayerTime > 0;
this.a(flag, i, damagesource);
@@ -372,7 +373,7 @@
}
}
-@@ -1033,8 +1189,13 @@
+@@ -1033,8 +1190,13 @@
int i = MathHelper.f((f - 3.0F - f2) * f1);
if (i > 0) {
@@ -387,7 +388,7 @@
int j = MathHelper.floor(this.locX);
int k = MathHelper.floor(this.locY - 0.20000000298023224D);
int l = MathHelper.floor(this.locZ);
-@@ -1061,7 +1222,7 @@
+@@ -1061,7 +1223,7 @@
protected float applyArmorModifier(DamageSource damagesource, float f) {
if (!damagesource.ignoresArmor()) {
@@ -396,7 +397,7 @@
f = CombatMath.a(f, (float) this.getArmorStrength(), (float) this.getAttributeInstance(GenericAttributes.i).getValue());
}
-@@ -1074,7 +1235,8 @@
+@@ -1074,7 +1236,8 @@
} else {
int i;
@@ -406,7 +407,7 @@
i = (this.getEffect(MobEffects.RESISTANCE).getAmplifier() + 1) * 5;
int j = 25 - i;
float f1 = f * (float) j;
-@@ -1095,22 +1257,142 @@
+@@ -1095,22 +1258,142 @@
}
}
@@ -559,7 +560,7 @@
}
public CombatTracker getCombatTracker() {
-@@ -1177,6 +1459,7 @@
+@@ -1177,6 +1460,7 @@
public AttributeMapBase getAttributeMap() {
if (this.attributeMap == null) {
this.attributeMap = new AttributeMapServer();
@@ -567,7 +568,7 @@
}
return this.attributeMap;
-@@ -1469,6 +1752,7 @@
+@@ -1469,6 +1753,7 @@
}
if (this.onGround && !this.world.isClientSide) {
@@ -575,7 +576,7 @@
this.setFlag(7, false);
}
} else {
-@@ -1838,6 +2122,7 @@
+@@ -1838,6 +2123,7 @@
}
if (!this.world.isClientSide) {
@@ -583,7 +584,7 @@
this.setFlag(7, flag);
}
-@@ -1931,11 +2216,11 @@
+@@ -1931,11 +2217,11 @@
}
public boolean isInteractable() {
@@ -597,7 +598,7 @@
}
protected void ax() {
-@@ -2072,7 +2357,27 @@
+@@ -2072,7 +2358,27 @@
protected void v() {
if (!this.activeItem.isEmpty() && this.isHandRaised()) {
this.b(this.activeItem, 16);
@@ -626,7 +627,7 @@
this.cN();
}
-@@ -2151,10 +2456,18 @@
+@@ -2151,10 +2457,18 @@
}
if (flag1) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 825ca934..ede2e932 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -435,13 +435,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
}
public void setCanPickupItems(boolean pickup) {
- if (getHandle() instanceof EntityInsentient) {
- ((EntityInsentient) getHandle()).canPickUpLoot = pickup;
- }
+ getHandle().canPickUpLoot = pickup;
}
public boolean getCanPickupItems() {
- return getHandle() instanceof EntityInsentient && ((EntityInsentient) getHandle()).canPickUpLoot;
+ return getHandle().canPickUpLoot;
}
@Override