mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 04:56:50 +01:00
[Bleeding] Fix for creeper getDrops() not reporting the music disk if it was killed by a skeleton. Addresses BUKKIT-1133
This commit is contained in:
parent
5ba8928041
commit
1c95413f49
1 changed files with 43 additions and 5 deletions
|
@ -1,11 +1,17 @@
|
||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit
|
// CraftBukkit start
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||||
|
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
public class EntityCreeper extends EntityMonster {
|
public class EntityCreeper extends EntityMonster {
|
||||||
|
|
||||||
int fuseTicks;
|
int fuseTicks;
|
||||||
int b;
|
int b;
|
||||||
|
private int record = -1; // CraftBukkit
|
||||||
|
|
||||||
public EntityCreeper(World world) {
|
public EntityCreeper(World world) {
|
||||||
super(world);
|
super(world);
|
||||||
|
@ -91,12 +97,43 @@ public class EntityCreeper extends EntityMonster {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void die(DamageSource damagesource) {
|
public void die(DamageSource damagesource) {
|
||||||
super.die(damagesource);
|
// CraftBukkit start - rearranged the method (super call to end, drop to dropDeathLoot)
|
||||||
if (damagesource.getEntity() instanceof EntitySkeleton) {
|
if (damagesource.getEntity() instanceof EntitySkeleton) {
|
||||||
this.b(Item.RECORD_1.id + this.random.nextInt(10), 1);
|
// this.b(Item.RECORD_1.id + this.random.nextInt(10), 1); // CraftBukkit
|
||||||
|
this.record = Item.RECORD_1.id + this.random.nextInt(10);
|
||||||
|
}
|
||||||
|
super.die(damagesource);
|
||||||
|
// CraftBukkit end
|
||||||
|
}
|
||||||
|
|
||||||
|
// CraftBukkit start - whole method
|
||||||
|
protected void dropDeathLoot(boolean flag, int i) {
|
||||||
|
int j = this.getLootId();
|
||||||
|
|
||||||
|
List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
|
||||||
|
|
||||||
|
if (j > 0) {
|
||||||
|
int k = this.random.nextInt(3);
|
||||||
|
|
||||||
|
if (i > 0) {
|
||||||
|
k += this.random.nextInt(i + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (k > 0) {
|
||||||
|
loot.add(new org.bukkit.inventory.ItemStack(j, k));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Drop a music disc?
|
||||||
|
if (this.record != -1) {
|
||||||
|
loot.add(new org.bukkit.inventory.ItemStack(this.record, 1));
|
||||||
|
this.record = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
CraftEventFactory.callEntityDeathEvent(this, loot); // raise event even for those times when the entity does not drop loot
|
||||||
|
}
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
public boolean a(Entity entity) {
|
public boolean a(Entity entity) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -131,8 +168,9 @@ public class EntityCreeper extends EntityMonster {
|
||||||
public void setPowered(boolean powered) {
|
public void setPowered(boolean powered) {
|
||||||
if (!powered) {
|
if (!powered) {
|
||||||
this.datawatcher.watch(17, Byte.valueOf((byte) 0));
|
this.datawatcher.watch(17, Byte.valueOf((byte) 0));
|
||||||
} else
|
} else {
|
||||||
// CraftBukkit end
|
|
||||||
this.datawatcher.watch(17, Byte.valueOf((byte) 1));
|
this.datawatcher.watch(17, Byte.valueOf((byte) 1));
|
||||||
}
|
}
|
||||||
|
// CraftBukkit end
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue