From 04c149fa1175df96a1f46362b6decc81aa430cab Mon Sep 17 00:00:00 2001 From: LexManos Date: Sat, 15 Sep 2012 19:39:54 -0700 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- .../minecraft/src/ItemBucketMilk.java.patch | 18 ++++ .../net/minecraft/src/PotionEffect.java.patch | 100 ++++++++++++++++++ 2 files changed, 118 insertions(+) create mode 100644 patches/common/net/minecraft/src/ItemBucketMilk.java.patch create mode 100644 patches/common/net/minecraft/src/PotionEffect.java.patch diff --git a/patches/common/net/minecraft/src/ItemBucketMilk.java.patch b/patches/common/net/minecraft/src/ItemBucketMilk.java.patch new file mode 100644 index 000000000..80b78a34a --- /dev/null +++ b/patches/common/net/minecraft/src/ItemBucketMilk.java.patch @@ -0,0 +1,18 @@ +--- ../src_base/common/net/minecraft/src/ItemBucketMilk.java ++++ ../src_work/common/net/minecraft/src/ItemBucketMilk.java +@@ -1,4 +1,6 @@ + package net.minecraft.src; ++ ++import java.util.HashMap; + + public class ItemBucketMilk extends Item + { +@@ -18,7 +20,7 @@ + + if (!par2World.isRemote) + { +- par3EntityPlayer.clearActivePotions(); ++ par3EntityPlayer.curePotionEffects(par1ItemStack); + } + + return par1ItemStack.stackSize <= 0 ? new ItemStack(Item.bucketEmpty) : par1ItemStack; diff --git a/patches/common/net/minecraft/src/PotionEffect.java.patch b/patches/common/net/minecraft/src/PotionEffect.java.patch new file mode 100644 index 000000000..a5f3dc969 --- /dev/null +++ b/patches/common/net/minecraft/src/PotionEffect.java.patch @@ -0,0 +1,100 @@ +--- ../src_base/common/net/minecraft/src/PotionEffect.java ++++ ../src_work/common/net/minecraft/src/PotionEffect.java +@@ -1,4 +1,7 @@ + package net.minecraft.src; ++ ++import java.util.ArrayList; ++import java.util.List; + + public class PotionEffect + { +@@ -10,12 +13,17 @@ + + /** The amplifier of the potion effect */ + private int amplifier; ++ ++ /** List of ItemStack that can cure the potion effect **/ ++ private List curativeItems; + + public PotionEffect(int par1, int par2, int par3) + { + this.potionID = par1; + this.duration = par2; + this.amplifier = par3; ++ this.curativeItems = new ArrayList(); ++ this.curativeItems.add(new ItemStack(Item.bucketMilk)); + } + + public PotionEffect(PotionEffect par1PotionEffect) +@@ -23,6 +31,7 @@ + this.potionID = par1PotionEffect.potionID; + this.duration = par1PotionEffect.duration; + this.amplifier = par1PotionEffect.amplifier; ++ this.curativeItems = par1PotionEffect.getCurativeItems(); + } + + /** +@@ -63,6 +72,63 @@ + public int getAmplifier() + { + return this.amplifier; ++ } ++ ++ /*** ++ * Returns a list of curative items for the potion effect ++ * @return The list (ItemStack) of curative items for the potion effect ++ */ ++ public List 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(ItemStack stack) ++ { ++ boolean found = false; ++ for (ItemStack curativeItem : this.curativeItems) ++ { ++ if (curativeItem.isItemEqual(stack)) ++ { ++ found = true; ++ } ++ } ++ ++ return found; ++ } ++ ++ /*** ++ * 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(List 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(ItemStack stack) ++ { ++ boolean found = false; ++ for (ItemStack curativeItem : this.curativeItems) ++ { ++ if (curativeItem.isItemEqual(stack)) ++ { ++ found = true; ++ } ++ } ++ if (!found) ++ { ++ this.curativeItems.add(stack); ++ } + } + + public boolean onUpdate(EntityLiving par1EntityLiving)