Skip to content

Commit

Permalink
Improved the way brewing recipes is implemented, and made it easier t…
Browse files Browse the repository at this point in the history
…o add new ones
  • Loading branch information
GirafiStudios committed May 4, 2018
1 parent 47e2841 commit dca6dda
Showing 1 changed file with 12 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
import com.teammetallurgy.aquaculture.items.AquacultureItems;
import net.minecraft.init.Items;
import net.minecraft.init.PotionTypes;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionType;
import net.minecraft.potion.PotionUtils;
import net.minecraft.util.NonNullList;
import net.minecraftforge.common.brewing.BrewingRecipeRegistry;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.OreDictionary;

import static net.minecraft.potion.PotionUtils.addPotionToItemStack;
import static net.minecraftforge.common.brewing.BrewingRecipeRegistry.addRecipe;

@Mod.EventBusSubscriber
public class AquacultureRecipes {

Expand All @@ -25,22 +25,17 @@ public static void addSmeltingRecipes() {
}

public static void addBrewingRecipes() {
addFishBrewingRecipe(Items.POTIONITEM, PotionTypes.WATER, "Jellyfish", Items.POTIONITEM, PotionTypes.MUNDANE);
addFishBrewingRecipe(Items.POTIONITEM, PotionTypes.AWKWARD, "Jellyfish", Items.POTIONITEM, PotionTypes.POISON);
addFishBrewingRecipe(Items.SPLASH_POTION, PotionTypes.AWKWARD, "Jellyfish", Items.SPLASH_POTION, PotionTypes.POISON);
addFishBrewingRecipe(Items.SPLASH_POTION, PotionTypes.WATER, "Jellyfish", Items.SPLASH_POTION, PotionTypes.MUNDANE);
addFishBrewingRecipe(Items.LINGERING_POTION, PotionTypes.WATER, "Jellyfish", Items.LINGERING_POTION, PotionTypes.MUNDANE);
addFishBrewingRecipe(Items.LINGERING_POTION, PotionTypes.AWKWARD, "Jellyfish", Items.LINGERING_POTION, PotionTypes.POISON);
addFishBrewingRecipe(Items.POTIONITEM, PotionTypes.WATER, "Leech", Items.POTIONITEM, PotionTypes.MUNDANE);
addFishBrewingRecipe(Items.POTIONITEM, PotionTypes.AWKWARD, "Leech", Items.POTIONITEM, PotionTypes.HEALING);
addFishBrewingRecipe(Items.SPLASH_POTION, PotionTypes.AWKWARD, "Leech", Items.SPLASH_POTION, PotionTypes.HEALING);
addFishBrewingRecipe(Items.SPLASH_POTION, PotionTypes.WATER, "Leech", Items.SPLASH_POTION, PotionTypes.MUNDANE);
addFishBrewingRecipe(Items.LINGERING_POTION, PotionTypes.WATER, "Leech", Items.LINGERING_POTION, PotionTypes.MUNDANE);
addFishBrewingRecipe(Items.LINGERING_POTION, PotionTypes.AWKWARD, "Leech", Items.LINGERING_POTION, PotionTypes.HEALING);
addBrewingRecipeWithSubPotions(AquacultureItems.fish.getItemStackFish("Jellyfish"), PotionTypes.POISON);
addBrewingRecipeWithSubPotions(AquacultureItems.fish.getItemStackFish("Leech"), PotionTypes.HEALING);
}

private static void addFishBrewingRecipe(Item input, PotionType potionInput, String fishType, Item potionItem, PotionType potionType) {
BrewingRecipeRegistry.addRecipe(PotionUtils.addPotionToItemStack(new ItemStack(input), potionInput), AquacultureItems.fish.getItemStackFish(fishType), PotionUtils.addPotionToItemStack(new ItemStack(potionItem), potionType));
private static void addBrewingRecipeWithSubPotions(ItemStack ingredient, PotionType potionType) {
addRecipe(addPotionToItemStack(new ItemStack(Items.POTIONITEM), PotionTypes.WATER), ingredient, addPotionToItemStack(new ItemStack(Items.POTIONITEM), PotionTypes.MUNDANE));
addRecipe(addPotionToItemStack(new ItemStack(Items.POTIONITEM), PotionTypes.AWKWARD), ingredient, addPotionToItemStack(new ItemStack(Items.POTIONITEM), potionType));
addRecipe(addPotionToItemStack(new ItemStack(Items.SPLASH_POTION), PotionTypes.AWKWARD), ingredient, addPotionToItemStack(new ItemStack(Items.SPLASH_POTION), potionType));
addRecipe(addPotionToItemStack(new ItemStack(Items.SPLASH_POTION), PotionTypes.WATER), ingredient, addPotionToItemStack(new ItemStack(Items.SPLASH_POTION), PotionTypes.MUNDANE));
addRecipe(addPotionToItemStack(new ItemStack(Items.LINGERING_POTION), PotionTypes.WATER), ingredient, addPotionToItemStack(new ItemStack(Items.LINGERING_POTION), PotionTypes.MUNDANE));
addRecipe(addPotionToItemStack(new ItemStack(Items.LINGERING_POTION), PotionTypes.AWKWARD), ingredient, addPotionToItemStack(new ItemStack(Items.LINGERING_POTION), potionType));
}

private static ItemStack getOreDict(String oreName) {
Expand Down

2 comments on commit dca6dda

@odininon
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice change 👍

@GirafiStudios
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks ^^ Figured I might as well make it easy to add a new potion ingredient in the future :)

Please sign in to comment.