ItemStack sensitive versions of Item.getPotionEffect and Item.isPotionIngredient Closes #321

This commit is contained in:
LexManos 2013-02-23 12:02:36 -08:00
parent f703dbb230
commit 0396ba2252
3 changed files with 69 additions and 2 deletions

View File

@ -0,0 +1,11 @@
--- ../src_base/minecraft/net/minecraft/inventory/SlotBrewingStandIngredient.java
+++ ../src_work/minecraft/net/minecraft/inventory/SlotBrewingStandIngredient.java
@@ -19,7 +19,7 @@
*/
public boolean isItemValid(ItemStack par1ItemStack)
{
- return par1ItemStack != null ? Item.itemsList[par1ItemStack.itemID].isPotionIngredient() : false;
+ return par1ItemStack != null ? Item.itemsList[par1ItemStack.itemID].isPotionIngredient(par1ItemStack) : false;
}
/**

View File

@ -46,7 +46,23 @@
}
/**
@@ -627,6 +638,10 @@
@@ -561,6 +572,7 @@
/**
* Returns a string representing what this item does to a potion.
+ * @Deprecated In favor of ItemStack sensitive version
*/
public String getPotionEffect()
{
@@ -569,6 +581,7 @@
/**
* Returns true if this item serves as a potion ingredient (its ingredient information is not null).
+ * @Deprecated In favor of ItemStack sensitive version
*/
public boolean isPotionIngredient()
{
@@ -627,6 +640,10 @@
float var18 = var15 * var16;
float var20 = var14 * var16;
double var21 = 5.0D;
@ -57,7 +73,7 @@
Vec3 var23 = var13.addVector((double)var18 * var21, (double)var17 * var21, (double)var20 * var21);
return par1World.rayTraceBlocks_do_do(var13, var23, par3, !par3);
}
@@ -701,4 +716,340 @@
@@ -701,4 +718,362 @@
{
StatList.initStats();
}
@ -396,5 +412,27 @@
+
+ return false;
+ }
+
+ /**
+ * ItemStack sensitive version of isPotionIngredient
+ *
+ * @param stack The item stack
+ * @return True if this stack can be used as a potion ingredient
+ */
+ public boolean isPotionIngredient(ItemStack stack)
+ {
+ return isPotionIngredient();
+ }
+
+ /**
+ * ItemStack sensitive version of getPotionEffect
+ *
+ * @param stack The item stack
+ * @return A string containing the bit manipulation to apply the the potion.
+ */
+ public String getPotionEffect(ItemStack stack)
+ {
+ return getPotionEffect();
+ }
+
}

View File

@ -12,6 +12,15 @@
{
/** The itemstacks currently placed in the slots of the brewing stand */
private ItemStack[] brewingItemStacks = new ItemStack[4];
@@ -94,7 +97,7 @@
{
ItemStack var1 = this.brewingItemStacks[3];
- if (!Item.itemsList[var1.itemID].isPotionIngredient())
+ if (!Item.itemsList[var1.itemID].isPotionIngredient(var1))
{
return false;
}
@@ -166,7 +169,7 @@
if (Item.itemsList[var1.itemID].hasContainerItem())
@ -21,6 +30,15 @@
}
else
{
@@ -185,7 +188,7 @@
*/
private int getPotionResult(int par1, ItemStack par2ItemStack)
{
- return par2ItemStack == null ? par1 : (Item.itemsList[par2ItemStack.itemID].isPotionIngredient() ? PotionHelper.applyIngredient(par1, Item.itemsList[par2ItemStack.itemID].getPotionEffect()) : par1);
+ return par2ItemStack == null ? par1 : (Item.itemsList[par2ItemStack.itemID].isPotionIngredient(par2ItemStack) ? PotionHelper.applyIngredient(par1, Item.itemsList[par2ItemStack.itemID].getPotionEffect(par2ItemStack)) : par1);
}
/**
@@ -333,4 +336,16 @@
return var1;