Allow itemstack sensitive damage computation for attacks. Should allow

storing data in the nbt :)
This commit is contained in:
Christian 2013-03-22 14:05:56 -04:00
parent f6a2bf28fe
commit 734f434f45
2 changed files with 25 additions and 1 deletions

View File

@ -47,7 +47,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 +730,336 @@
@@ -720,4 +730,349 @@
{
StatList.initStats();
}
@ -382,5 +382,18 @@
+ {
+ return true;
+ }
+
+ /**
+ * An itemstack sensitive version of getDamageVsEntity - allows items to handle damage based on
+ * itemstack data, like tags. Falls back to getDamageVsEntity.
+ *
+ * @param par1Entity The entity being attacked (or the attacking mob, if it's a mob - vanilla bug?)
+ * @param itemStack The itemstack
+ * @return the damage
+ */
+ public int getDamageVsEntity(Entity par1Entity, ItemStack itemStack)
+ {
+ return getDamageVsEntity(par1Entity);
+ }
+
}

View File

@ -0,0 +1,11 @@
--- ../src_base/minecraft/net/minecraft/item/ItemStack.java
+++ ../src_work/minecraft/net/minecraft/item/ItemStack.java
@@ -382,7 +382,7 @@
*/
public int getDamageVsEntity(Entity par1Entity)
{
- return Item.itemsList[this.itemID].getDamageVsEntity(par1Entity);
+ return Item.itemsList[this.itemID].getDamageVsEntity(par1Entity, this);
}
/**