Refactor code to be more efficient.

This commit is contained in:
feildmaster
2012-03-25 18:06:43 -05:00
committed by Warren Loo
parent c30e339af6
commit 80db22b643
9 changed files with 25 additions and 30 deletions

View File

@@ -164,7 +164,7 @@ public class Block {
public final Material material;
public float frictionFactor;
private String name;
public ArrayList<ItemStack> dropList = new ArrayList<ItemStack>(1); // CraftBukkit
public final ArrayList<ItemStack> dropList = new ArrayList<ItemStack>(1); // CraftBukkit
protected Block(int i, Material material) {
this.bR = true;
@@ -362,7 +362,7 @@ 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
// This is such a hackish change it's rediculous.
// This is such a hackish change it's ridiculous.
this.dropList.add(itemstack);
}
@@ -550,6 +550,7 @@ public class Block {
this.dropList.clear();
}
// Blocks that have different drops in certain situations need to override this. IE: Sheers on BlockLeaves
public ArrayList<ItemStack> calculateDrops(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
// CraftBukkit end
if (this.h() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman.inventory)) {
@@ -563,7 +564,8 @@ public class Block {
this.dropNaturally(world, i, j, k, l, 1.0F, i1); // CraftBukkit
}
return this.dropList; // CraftBukkit
return this.dropList;
}
protected boolean h() {