Files
MinecraftForge/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch
T
LexManos 2ed4f39a13 Merge pull request #2268 from minzmann/master
[1.8.8] Minor Fixes to PotionEffect.java.patch
2015-12-12 19:48:23 -08:00

92 lines
3.2 KiB
Diff

--- ../src-base/minecraft/net/minecraft/potion/PotionEffect.java
+++ ../src-work/minecraft/net/minecraft/potion/PotionEffect.java
@@ -18,6 +18,8 @@
@SideOnly(Side.CLIENT)
private boolean field_100013_f;
private boolean field_180156_h;
+ /** List of ItemStack that can cure the potion effect **/
+ private java.util.List<net.minecraft.item.ItemStack> curativeItems;
public PotionEffect(int p_i1574_1_, int p_i1574_2_)
{
@@ -36,6 +38,8 @@
this.field_76461_c = p_i45896_3_;
this.field_82724_e = p_i45896_4_;
this.field_180156_h = p_i45896_5_;
+ this.curativeItems = new java.util.ArrayList<net.minecraft.item.ItemStack>();
+ this.curativeItems.add(new net.minecraft.item.ItemStack(net.minecraft.init.Items.field_151117_aB));
}
public PotionEffect(PotionEffect p_i1577_1_)
@@ -45,6 +49,7 @@
this.field_76461_c = p_i1577_1_.field_76461_c;
this.field_82724_e = p_i1577_1_.field_82724_e;
this.field_180156_h = p_i1577_1_.field_180156_h;
+ this.curativeItems = p_i1577_1_.curativeItems;
}
public void func_76452_a(PotionEffect p_76452_1_)
@@ -190,7 +195,7 @@
public static PotionEffect func_82722_b(NBTTagCompound p_82722_0_)
{
- int i = p_82722_0_.func_74771_c("Id");
+ int i = p_82722_0_.func_74771_c("Id") & 0xff;
if (i >= 0 && i < Potion.field_76425_a.length && Potion.field_76425_a[i] != null)
{
@@ -223,4 +228,62 @@
{
return this.field_100013_f;
}
+
+ /* ======================================== FORGE START =====================================*/
+ /***
+ * Returns a list of curative items for the potion effect
+ * @return The list (ItemStack) of curative items for the potion effect
+ */
+ public java.util.List<net.minecraft.item.ItemStack> getCurativeItems()
+ {
+ return this.curativeItems;
+ }
+
+ /***
+ * Checks the given ItemStack to see if it is in the list of curative items for the potion effect
+ * @param stack The ItemStack being checked against the list of curative items for the potion effect
+ * @return true if the given ItemStack is in the list of curative items for the potion effect, false otherwise
+ */
+ public boolean isCurativeItem(net.minecraft.item.ItemStack stack)
+ {
+ for (net.minecraft.item.ItemStack curativeItem : this.curativeItems)
+ {
+ if (curativeItem.func_77969_a(stack))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /***
+ * Sets the array of curative items for the potion effect
+ * @param curativeItems The list of ItemStacks being set to the potion effect
+ */
+ public void setCurativeItems(java.util.List<net.minecraft.item.ItemStack> curativeItems)
+ {
+ this.curativeItems = curativeItems;
+ }
+
+ /***
+ * Adds the given stack to list of curative items for the potion effect
+ * @param stack The ItemStack being added to the curative item list
+ */
+ public void addCurativeItem(net.minecraft.item.ItemStack stack)
+ {
+ if (!this.isCurativeItem(stack))
+ {
+ this.curativeItems.add(stack);
+ }
+ }
}