SPIGOT-1816: Rework drop capture.

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2016-03-07 19:51:42 +11:00
parent 406b2d6204
commit ced78d5d27
6 changed files with 30 additions and 113 deletions

View File

@@ -28,8 +28,8 @@
+ // CraftBukkit start
+ public int expToDrop;
+ public int maxAirTicks = 300;
+ ArrayList<org.bukkit.inventory.ItemStack> drops;
+ public org.bukkit.craftbukkit.attribute.CraftAttributeMap craftAttributes;
+ ArrayList<org.bukkit.inventory.ItemStack> drops = new ArrayList<org.bukkit.inventory.ItemStack>();
+ public org.bukkit.craftbukkit.attribute.CraftAttributeMap craftAttributes;
+ // CraftBukkit end
public void Q() {
@@ -302,24 +302,20 @@
this.az = 0.0F;
Entity entity = damagesource.getEntity();
@@ -822,9 +956,16 @@
}
if (this.isDropExperience() && this.world.getGameRules().getBoolean("doMobLoot")) {
+ this.drops = new ArrayList<org.bukkit.inventory.ItemStack>(); // CraftBukkit - Setup drop capture
@@ -825,6 +959,12 @@
boolean flag = this.lastDamageByPlayerTime > 0;
this.a(flag, i, damagesource);
+ // CraftBukkit start - Call death event
+ CraftEventFactory.callEntityDeathEvent(this, this.drops);
+ this.drops = null;
+ this.drops = new ArrayList<org.bukkit.inventory.ItemStack>();
+ } else {
+ CraftEventFactory.callEntityDeathEvent(this);
+ // CraftBukkit end
}
}
@@ -912,8 +1053,13 @@
@@ -912,8 +1052,13 @@
int i = MathHelper.f((f - 3.0F - f2) * f1);
if (i > 0) {
@@ -334,7 +330,7 @@
int j = MathHelper.floor(this.locX);
int k = MathHelper.floor(this.locY - 0.20000000298023224D);
int l = MathHelper.floor(this.locZ);
@@ -940,20 +1086,20 @@
@@ -940,20 +1085,20 @@
protected float applyArmorModifier(DamageSource damagesource, float f) {
if (!damagesource.ignoresArmor()) {
@@ -358,7 +354,7 @@
i = (this.getEffect(MobEffects.RESISTANCE).getAmplifier() + 1) * 5;
int j = 25 - i;
float f1 = f * (float) j;
@@ -974,22 +1120,122 @@
@@ -974,22 +1119,122 @@
}
}
@@ -488,7 +484,7 @@
}
public CombatTracker getCombatTracker() {
@@ -1055,6 +1301,7 @@
@@ -1055,6 +1300,7 @@
public AttributeMapBase getAttributeMap() {
if (this.bp == null) {
this.bp = new AttributeMapServer();
@@ -496,7 +492,7 @@
}
return this.bp;
@@ -1702,6 +1949,13 @@
@@ -1702,6 +1948,13 @@
if (!list.isEmpty()) {
for (int i = 0; i < list.size(); ++i) {
Entity entity = (Entity) list.get(i);
@@ -510,7 +506,7 @@
this.C(entity);
}
@@ -1918,7 +2172,22 @@
@@ -1918,7 +2171,22 @@
protected void v() {
if (this.bm != null && this.cs()) {
this.a(this.bm, 16);