Seriously fix natural drops. Fixes BUKKIT-1297 and fixes BUKKIT-1295

This commit is contained in:
feildmaster
2012-03-23 06:08:54 -05:00
committed by EvilSeph
parent ff22e4e341
commit 40e0962735
11 changed files with 27 additions and 35 deletions

View File

@@ -164,7 +164,7 @@ public class Block {
public final Material material;
public float frictionFactor;
private String name;
protected ArrayList<ItemStack> dropList; // CraftBukkit
protected ArrayList<ItemStack> dropList = new ArrayList<ItemStack>(); // CraftBukkit
protected Block(int i, Material material) {
this.bR = true;
@@ -339,6 +339,7 @@ public class Block {
public final void b(World world, int i, int j, int k, int l, int i1) {
this.dropNaturally(world, i, j, k, l, 1.0F, i1);
this.doActualDrop(world, i, j, k); // CraftBukkit
}
public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) {
@@ -360,15 +361,11 @@ public class Block {
protected void a(World world, int i, int j, int k, ItemStack itemstack) {
// CraftBukkit start - the logic of this function is moved into finishDrop
if (this.dropList != null) {
this.dropList.add(itemstack);
} else {
this.finishDrop(world, i, j, k, itemstack);
}
// This is such a hackish change it's rediculous.
this.dropList.add(itemstack);
}
public final void finishDrop(World world, int i, int j, int k, ItemStack itemstack) {
this.dropList = null;
// CraftBukkit end
if (!world.isStatic) {
float f = 0.7F;
@@ -542,13 +539,14 @@ public class Block {
entityhuman.a(StatisticList.C[this.id], 1);
entityhuman.c(0.025F);
// CraftBukkit start - A way to separate statistics from the logic of determining what to drop
this.doActualDrop(world, entityhuman, i, j, k, l);
this.doActualDrop(world, i, j, k);
}
public void doActualDrop(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
for (ItemStack stack : dropList) {
public void doActualDrop(World world, int i, int j, int k) {
for (ItemStack stack : this.dropList) {
finishDrop(world, i, j, k, stack);
}
this.dropList.clear();
}
public void setDrops(ArrayList<ItemStack> drops) {
@@ -556,7 +554,6 @@ public class Block {
}
public ArrayList<ItemStack> calculateDrops(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
this.dropList = new ArrayList<ItemStack>();
// CraftBukkit end
if (this.h() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman.inventory)) {
ItemStack itemstack = this.a_(l);