SPIGOT-758: Capture head drops from charged creeper kills

This commit is contained in:
Thinkofdeath 2015-04-13 11:47:47 +01:00
parent 889a5eca6e
commit 85cf593df9
4 changed files with 99 additions and 19 deletions

View File

@ -1,5 +1,5 @@
--- /home/matt/mc-dev-private//net/minecraft/server/EntityCreeper.java 2015-02-26 22:40:22.499608140 +0000
+++ src/main/java/net/minecraft/server/EntityCreeper.java 2015-02-26 22:40:22.499608140 +0000
--- /home/matt/mc-dev-private//net/minecraft/server/EntityCreeper.java 2015-04-13 11:47:18.827986881 +0100
+++ src/main/java/net/minecraft/server/EntityCreeper.java 2015-04-13 11:47:18.831986881 +0100
@@ -1,5 +1,10 @@
package net.minecraft.server;
@ -19,7 +19,7 @@
public EntityCreeper(World world) {
super(world);
@@ -110,19 +116,36 @@
@@ -110,19 +116,39 @@
}
public void die(DamageSource damagesource) {
@ -37,7 +37,11 @@
+ // CraftBukkit end
} else if (damagesource.getEntity() instanceof EntityCreeper && damagesource.getEntity() != this && ((EntityCreeper) damagesource.getEntity()).isPowered() && ((EntityCreeper) damagesource.getEntity()).cp()) {
((EntityCreeper) damagesource.getEntity()).cq();
this.a(new ItemStack(Items.SKULL, 1, 4), 0.0F);
- this.a(new ItemStack(Items.SKULL, 1, 4), 0.0F);
+ // CraftBukkit start
+ // this.a(new ItemStack(Items.SKULL, 1, 4), 0.0F);
+ headDrop = new ItemStack(Items.SKULL, 1, 4);
+ // CraftBukkit end
}
+
+ super.die(damagesource); // CraftBukkit - Moved from above
@ -58,7 +62,7 @@
public boolean r(Entity entity) {
return true;
@@ -146,7 +169,21 @@
@@ -146,7 +172,21 @@
public void onLightningStrike(EntityLightning entitylightning) {
super.onLightningStrike(entitylightning);
@ -81,7 +85,7 @@
}
protected boolean a(EntityHuman entityhuman) {
@@ -170,8 +207,15 @@
@@ -170,8 +210,15 @@
boolean flag = this.world.getGameRules().getBoolean("mobGriefing");
float f = this.isPowered() ? 2.0F : 1.0F;

View File

@ -1,5 +1,5 @@
--- /home/matt/mc-dev-private//net/minecraft/server/EntityInsentient.java 2015-02-26 22:40:22.575608140 +0000
+++ src/main/java/net/minecraft/server/EntityInsentient.java 2015-02-26 22:40:22.579608139 +0000
--- /home/matt/mc-dev-private//net/minecraft/server/EntityInsentient.java 2015-04-13 11:47:18.931986879 +0100
+++ src/main/java/net/minecraft/server/EntityInsentient.java 2015-04-13 11:47:18.935986879 +0100
@@ -4,6 +4,15 @@
import java.util.List;
import java.util.UUID;
@ -84,7 +84,28 @@
}
public boolean a(Class<? extends EntityLiving> oclass) {
@@ -235,11 +277,20 @@
@@ -168,6 +210,7 @@
return null;
}
+ protected ItemStack headDrop = null; // CraftBukkit
protected void dropDeathLoot(boolean flag, int i) {
Item item = this.getLoot();
@@ -183,6 +226,12 @@
}
}
+ // CraftBukkit start
+ if (headDrop != null) {
+ this.a(headDrop, 0.0F);
+ headDrop = null;
+ }
+ // CraftBukkit end
}
public void b(NBTTagCompound nbttagcompound) {
@@ -235,11 +284,20 @@
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
@ -107,7 +128,7 @@
NBTTagList nbttaglist;
int i;
@@ -380,11 +431,11 @@
@@ -380,11 +438,11 @@
double d2 = entityhuman.locZ - this.locZ;
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
@ -121,7 +142,7 @@
this.die();
} else if (d3 < 1024.0D) {
this.ticksFarFromPlayer = 0;
@@ -707,6 +758,12 @@
@@ -707,6 +765,12 @@
public final boolean e(EntityHuman entityhuman) {
if (this.cc() && this.getLeashHolder() == entityhuman) {
@ -134,7 +155,7 @@
this.unleash(true, !entityhuman.abilities.canInstantlyBuild);
return true;
} else {
@@ -714,12 +771,24 @@
@@ -714,12 +778,24 @@
if (itemstack != null && itemstack.getItem() == Items.LEAD && this.cb()) {
if (!(this instanceof EntityTameableAnimal) || !((EntityTameableAnimal) this).isTamed()) {
@ -159,7 +180,7 @@
this.setLeashHolder(entityhuman, true);
--itemstack.count;
return true;
@@ -741,10 +810,12 @@
@@ -741,10 +817,12 @@
if (this.bo) {
if (!this.isAlive()) {
@ -172,7 +193,7 @@
this.unleash(true, true);
}
}
@@ -811,6 +882,7 @@
@@ -811,6 +889,7 @@
this.bp = entityleash;
} else {

View File

@ -1,5 +1,5 @@
--- /home/matt/mc-dev-private//net/minecraft/server/EntitySkeleton.java 2015-02-26 22:40:22.683608138 +0000
+++ src/main/java/net/minecraft/server/EntitySkeleton.java 2015-02-26 22:40:22.687608138 +0000
--- /home/matt/mc-dev-private//net/minecraft/server/EntitySkeleton.java 2015-04-13 11:47:19.083986875 +0100
+++ src/main/java/net/minecraft/server/EntitySkeleton.java 2015-04-13 11:47:19.083986875 +0100
@@ -2,6 +2,8 @@
import java.util.Calendar;
@ -25,7 +25,43 @@
}
}
}
@@ -224,11 +233,30 @@
@@ -112,7 +121,7 @@
}
public void die(DamageSource damagesource) {
- super.die(damagesource);
+ // super.die(damagesource); // CraftBukkit
if (damagesource.i() instanceof EntityArrow && damagesource.getEntity() instanceof EntityHuman) {
EntityHuman entityhuman = (EntityHuman) damagesource.getEntity();
double d0 = entityhuman.locX - this.locX;
@@ -123,16 +132,25 @@
}
} else if (damagesource.getEntity() instanceof EntityCreeper && ((EntityCreeper) damagesource.getEntity()).isPowered() && ((EntityCreeper) damagesource.getEntity()).cp()) {
((EntityCreeper) damagesource.getEntity()).cq();
- this.a(new ItemStack(Items.SKULL, 1, this.getSkeletonType() == 1 ? 1 : 0), 0.0F);
+ // CraftBukkit start
+ // this.a(new ItemStack(Items.SKULL, 1, this.getSkeletonType() == 1 ? 1 : 0), 0.0F);
+ headDrop = new ItemStack(Items.SKULL, 1, this.getSkeletonType() == 1 ? 1 : 0);
+ // CraftBukkit end
+
}
+ super.die(damagesource); // CraftBukkit - moved from above
+
}
+ /* CraftBukkit start
protected Item getLoot() {
return Items.ARROW;
}
+ // CraftBukkit end */
protected void dropDeathLoot(boolean flag, int i) {
+ super.dropDeathLoot(flag, i); // CraftBukkit
int j;
int k;
@@ -224,11 +242,30 @@
}
if (EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_FIRE.id, this.bA()) > 0 || this.getSkeletonType() == 1) {

View File

@ -1,5 +1,5 @@
--- /home/matt/mc-dev-private//net/minecraft/server/EntityZombie.java 2015-02-26 22:40:22.739608138 +0000
+++ src/main/java/net/minecraft/server/EntityZombie.java 2015-02-26 22:40:22.739608138 +0000
--- /home/matt/mc-dev-private//net/minecraft/server/EntityZombie.java 2015-04-13 11:47:19.167986873 +0100
+++ src/main/java/net/minecraft/server/EntityZombie.java 2015-04-13 11:47:19.167986873 +0100
@@ -4,6 +4,14 @@
import java.util.List;
import java.util.UUID;
@ -115,3 +115,22 @@
boolean flag = this.bp > 0.0F && this.bq > 0.0F;
this.bp = f;
@@ -520,12 +549,16 @@
}
public void die(DamageSource damagesource) {
- super.die(damagesource);
+ // super.die(damagesource); // CraftBukkit
if (damagesource.getEntity() instanceof EntityCreeper && !(this instanceof EntityPigZombie) && ((EntityCreeper) damagesource.getEntity()).isPowered() && ((EntityCreeper) damagesource.getEntity()).cp()) {
((EntityCreeper) damagesource.getEntity()).cq();
- this.a(new ItemStack(Items.SKULL, 1, 2), 0.0F);
+ // CraftBukkit start
+ // this.a(new ItemStack(Items.SKULL, 1, 2), 0.0F);
+ headDrop = new ItemStack(Items.SKULL, 1, 2);
+ // CraftBukkit end
}
+ super.die(damagesource); // CraftBukkit - moved from above
}
static class SyntheticClass_1 { }