Merge pull request #542 from KingLemming/master

OreDictionary additions + ItemStack maxDamage hook
This commit is contained in:
cpw 2013-04-25 18:46:06 -07:00
commit cb14e29cdb
3 changed files with 27 additions and 1 deletions

View file

@ -49,6 +49,12 @@ public class OreDictionary
registerOre("stickWood", Item.stick);
registerOre("treeSapling", new ItemStack(Block.sapling, 1, WILDCARD_VALUE));
registerOre("treeLeaves", new ItemStack(Block.leaves, 1, WILDCARD_VALUE));
registerOre("oreGold", Block.oreGold);
registerOre("oreIron", Block.oreIron);
registerOre("oreLapis", Block.oreLapis);
registerOre("oreDiamond", Block.oreDiamond);
registerOre("oreRedstone", Block.oreRedstone);
registerOre("oreEmerald", Block.oreEmerald);
}
// Build our list of items to replace with ore tags

View file

@ -60,7 +60,7 @@
Vec3 vec31 = vec3.addVector((double)f7 * d3, (double)f6 * d3, (double)f8 * d3);
return par1World.rayTraceBlocks_do_do(vec3, vec31, par3, !par3);
}
@@ -720,4 +736,480 @@
@@ -720,4 +736,491 @@
{
StatList.initStats();
}
@ -515,6 +515,17 @@
+ {
+ return stack.itemDamage;
+ }
+
+ /**
+ * Return the maxDamage for this ItemStack. Defaults to the maxDamage field in this item, but can be overridden here for other sources such as NBT.
+ *
+ * @param stack The itemstack that is damaged
+ * @return the damage value
+ */
+ public int getItemMaxDamageFromStack(ItemStack stack)
+ {
+ return maxDamage;
+ }
+
+ /**
+ * Return if this itemstack is damaged. Note only called if {@link #isDamageable()} is true.

View file

@ -41,6 +41,15 @@
}
/**
@@ -286,7 +281,7 @@
*/
public int getMaxDamage()
{
- return Item.itemsList[this.itemID].getMaxDamage();
+ return this.getItem().getItemMaxDamageFromStack(this);
}
public boolean func_96631_a(int par1, Random par2Random)
@@ -382,7 +377,7 @@
*/
public int getDamageVsEntity(Entity par1Entity)