diff --git a/common/net/minecraftforge/event/brewing/PotionBrewedEvent.java b/common/net/minecraftforge/event/brewing/PotionBrewedEvent.java new file mode 100644 index 0000000000..3012b9726f --- /dev/null +++ b/common/net/minecraftforge/event/brewing/PotionBrewedEvent.java @@ -0,0 +1,14 @@ +package net.minecraftforge.event.brewing; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.event.Event; + +public class PotionBrewedEvent extends Event{ + /** + * The brewing stacks in the brewing stand. Each index has the possibility to be null, so make sure you check. + */ + public ItemStack[] brewingStacks; + public PotionBrewedEvent(ItemStack[] brewingStacks){ + this.brewingStacks = brewingStacks; + } +} diff --git a/patches/minecraft/net/minecraft/inventory/SlotBrewingStandPotion.java.patch b/patches/minecraft/net/minecraft/inventory/SlotBrewingStandPotion.java.patch new file mode 100644 index 0000000000..369d9ffe8e --- /dev/null +++ b/patches/minecraft/net/minecraft/inventory/SlotBrewingStandPotion.java.patch @@ -0,0 +1,27 @@ +--- ../src_base/minecraft/net/minecraft/inventory/SlotBrewingStandPotion.java ++++ ../src_work/minecraft/net/minecraft/inventory/SlotBrewingStandPotion.java +@@ -2,6 +2,7 @@ + + import net.minecraft.entity.player.EntityPlayer; + import net.minecraft.item.Item; ++import net.minecraft.item.ItemPotion; + import net.minecraft.item.ItemStack; + import net.minecraft.stats.AchievementList; + +@@ -35,7 +36,7 @@ + + public void onPickupFromSlot(EntityPlayer par1EntityPlayer, ItemStack par2ItemStack) + { +- if (par2ItemStack.itemID == Item.potion.itemID && par2ItemStack.getItemDamage() > 0) ++ if (par2ItemStack.getItem() instanceof ItemPotion && par2ItemStack.getItemDamage() > 0) + { + this.player.addStat(AchievementList.potion, 1); + } +@@ -48,6 +49,6 @@ + */ + public static boolean canHoldPotion(ItemStack par0ItemStack) + { +- return par0ItemStack != null && (par0ItemStack.itemID == Item.potion.itemID || par0ItemStack.itemID == Item.glassBottle.itemID); ++ return par0ItemStack != null && (par0ItemStack.getItem() instanceof ItemPotion || par0ItemStack.itemID == Item.glassBottle.itemID); + } + } diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch index 699bee7a4e..570091bca6 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch @@ -1,6 +1,33 @@ --- ../src_base/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java +++ ../src_work/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java -@@ -184,7 +184,7 @@ +@@ -11,6 +11,8 @@ + import net.minecraft.nbt.NBTTagCompound; + import net.minecraft.nbt.NBTTagList; + import net.minecraft.potion.PotionHelper; ++import net.minecraftforge.common.MinecraftForge; ++import net.minecraftforge.event.brewing.PotionBrewedEvent; + + public class TileEntityBrewingStand extends TileEntity implements ISidedInventory + { +@@ -122,7 +124,7 @@ + + for (int i = 0; i < 3; ++i) + { +- if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].itemID == Item.potion.itemID) ++ if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion) + { + int j = this.brewingItemStacks[i].getItemDamage(); + int k = this.getPotionResult(j, itemstack); +@@ -161,7 +163,7 @@ + + for (int i = 0; i < 3; ++i) + { +- if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].itemID == Item.potion.itemID) ++ if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion) + { + int j = this.brewingItemStacks[i].getItemDamage(); + int k = this.getPotionResult(j, itemstack); +@@ -184,7 +186,7 @@ if (Item.itemsList[itemstack.itemID].hasContainerItem()) { @@ -9,3 +36,21 @@ } else { +@@ -195,6 +197,8 @@ + this.brewingItemStacks[3] = null; + } + } ++ ++ MinecraftForge.EVENT_BUS.post(new PotionBrewedEvent(brewingItemStacks)); + } + } + +@@ -343,7 +347,7 @@ + */ + public boolean isStackValidForSlot(int par1, ItemStack par2ItemStack) + { +- return par1 == 3 ? Item.itemsList[par2ItemStack.itemID].isPotionIngredient() : par2ItemStack.itemID == Item.potion.itemID || par2ItemStack.itemID == Item.glassBottle.itemID; ++ return par1 == 3 ? Item.itemsList[par2ItemStack.itemID].isPotionIngredient() : par2ItemStack.getItem() instanceof ItemPotion || par2ItemStack.itemID == Item.glassBottle.itemID; + } + + @SideOnly(Side.CLIENT)