From 595420fac6da4d4712a3b292c6fac24ef102d6b6 Mon Sep 17 00:00:00 2001 From: Vasco Lavos Date: Wed, 23 Jul 2014 16:24:10 +0100 Subject: [PATCH] You gotta getcha getcha getcha getcha head in the game. --- .../common/crafting/ModRuneRecipes.java | 6 ++ .../common/crafting/recipe/HeadRecipe.java | 58 +++++++++++++++++++ .../botania/common/lexicon/LexiconData.java | 4 ++ .../vazkii/botania/common/lib/LibLexicon.java | 1 + resources/assets/botania/lang/en_US.lang | 7 ++- 5 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 MODSRC/vazkii/botania/common/crafting/recipe/HeadRecipe.java diff --git a/MODSRC/vazkii/botania/common/crafting/ModRuneRecipes.java b/MODSRC/vazkii/botania/common/crafting/ModRuneRecipes.java index 72d70017d..2ed4ff886 100644 --- a/MODSRC/vazkii/botania/common/crafting/ModRuneRecipes.java +++ b/MODSRC/vazkii/botania/common/crafting/ModRuneRecipes.java @@ -20,6 +20,7 @@ import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import vazkii.botania.api.BotaniaAPI; import vazkii.botania.api.recipe.RecipeRuneAltar; +import vazkii.botania.common.crafting.recipe.HeadRecipe; import vazkii.botania.common.item.ModItems; import vazkii.botania.common.lib.LibOreDict; @@ -42,6 +43,8 @@ public final class ModRuneRecipes { public static RecipeRuneAltar recipeEnvyRune; public static RecipeRuneAltar recipePrideRune; + public static RecipeRuneAltar recipeHead; + public static void init() { final int costTier1 = 2500; final int costTier2 = 4000; @@ -75,5 +78,8 @@ public final class ModRuneRecipes { recipeWrathRune = BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 2, 13), costTier3, LibOreDict.MANA_DIAMOND, LibOreDict.MANA_DIAMOND, LibOreDict.RUNE[7], LibOreDict.RUNE[2]); recipeEnvyRune = BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 2, 14), costTier3, LibOreDict.MANA_DIAMOND, LibOreDict.MANA_DIAMOND, LibOreDict.RUNE[7], LibOreDict.RUNE[0]); recipePrideRune = BotaniaAPI.registerRuneAltarRecipe(new ItemStack(ModItems.rune, 2, 15), costTier3, LibOreDict.MANA_DIAMOND, LibOreDict.MANA_DIAMOND, LibOreDict.RUNE[5], LibOreDict.RUNE[1]); + + recipeHead = new HeadRecipe(new ItemStack(Items.skull, 1, 3), 22500, new ItemStack(Items.skull), LibOreDict.PIXIE_DUST, LibOreDict.PRISMARINE_SHARD, new ItemStack(Items.name_tag), new ItemStack(Items.golden_apple)); + BotaniaAPI.runeAltarRecipes.add(recipeHead); } } diff --git a/MODSRC/vazkii/botania/common/crafting/recipe/HeadRecipe.java b/MODSRC/vazkii/botania/common/crafting/recipe/HeadRecipe.java new file mode 100644 index 000000000..a71274e9f --- /dev/null +++ b/MODSRC/vazkii/botania/common/crafting/recipe/HeadRecipe.java @@ -0,0 +1,58 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under a + * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License + * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) + * + * File Created @ [Jul 23, 2014, 3:02:17 PM (GMT)] + */ +package vazkii.botania.common.crafting.recipe; + +import net.minecraft.init.Items; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; +import vazkii.botania.api.recipe.RecipeRuneAltar; +import vazkii.botania.common.core.helper.ItemNBTHelper; + +public class HeadRecipe extends RecipeRuneAltar { + + String name = ""; + + public HeadRecipe(ItemStack output, int mana, Object... inputs) { + super(output, mana, inputs); + } + + @Override + public boolean matches(IInventory inv) { + boolean matches = super.matches(inv); + + if(matches) { + for(int i = 0; i < inv.getSizeInventory(); i++) { + ItemStack stack = inv.getStackInSlot(i); + if(stack == null) + break; + + if(stack.getItem() == Items.name_tag) { + name = stack.getDisplayName(); + if(name.equals(StatCollector.translateToLocal("item.nameTag.name"))) + return false; + } + } + } + + return matches; + } + + @Override + public ItemStack getOutput() { + ItemStack stack = new ItemStack(Items.skull, 1, 3); + if(!name.isEmpty()) + ItemNBTHelper.setString(stack, "SkullOwner", name); + return stack; + } + +} diff --git a/MODSRC/vazkii/botania/common/lexicon/LexiconData.java b/MODSRC/vazkii/botania/common/lexicon/LexiconData.java index 576c1ba22..b77ef87ad 100644 --- a/MODSRC/vazkii/botania/common/lexicon/LexiconData.java +++ b/MODSRC/vazkii/botania/common/lexicon/LexiconData.java @@ -167,6 +167,7 @@ public final class LexiconData { public static LexiconEntry prismarine; public static LexiconEntry shedding; public static LexiconEntry tinyPotato; + public static LexiconEntry headCreating; public static void init() { BotaniaAPI.addCategory(categoryBasics = new LexiconCategory(LibLexicon.CATEGORY_BASICS)); @@ -561,5 +562,8 @@ public final class LexiconData { tinyPotato = new BLexiconEntry(LibLexicon.MISC_TINY_POTATO, categoryMisc); tinyPotato.setLexiconPages(new PageText("0"), new PageManaInfusionRecipe("1", ModManaInfusionRecipes.tinyPotatoRecipe)); + + headCreating = new ALexiconEntry(LibLexicon.MISC_HEAD_CREATING, categoryMisc); + headCreating.setLexiconPages(new PageText("0"), new PageRuneRecipe("1", ModRuneRecipes.recipeHead)); } } diff --git a/MODSRC/vazkii/botania/common/lib/LibLexicon.java b/MODSRC/vazkii/botania/common/lib/LibLexicon.java index cbea18491..49b23fee5 100644 --- a/MODSRC/vazkii/botania/common/lib/LibLexicon.java +++ b/MODSRC/vazkii/botania/common/lib/LibLexicon.java @@ -144,5 +144,6 @@ public final class LibLexicon { public static final String MISC_PRISMARINE = "prismarine"; public static final String MISC_SHEDDING = "shedding"; public static final String MISC_TINY_POTATO = "tinyPotato"; + public static final String MISC_HEAD_CREATING = "headCreating"; } diff --git a/resources/assets/botania/lang/en_US.lang b/resources/assets/botania/lang/en_US.lang index ffd9531e7..8015add67 100644 --- a/resources/assets/botania/lang/en_US.lang +++ b/resources/assets/botania/lang/en_US.lang @@ -1417,4 +1417,9 @@ botania.page.shedding0=The living beings that inhabit our lands don't live in a # -- TINY POTATO botania.entry.tinyPotato=Tiny Potato botania.page.tinyPotato0=It's a tiny potato, it believes in you, you can do the thing.
No really, that's it, by tossing a &1Potato&0 in a &1Mana Pool&0, the potato gains a little lively essence and happy feeling. It's a lively one, giving it a right click will make it even more so! -botania.page.tinyPotato1=Put it on Kickstarter, it'll work \ No newline at end of file +botania.page.tinyPotato1=Put it on Kickstarter, it'll work + +# -- HEAD CREATION +botania.entry.headCreating=Head Creation +botania.page.headCreating0=A typical incantation of the Elves, combining a few resources and a &1Name Tag&0 allows for the creation of a replica of sorts of the head of the person described in the tag. How it works isn't really known, but it seems to be possible to replicate it with a &1Runic Altar&0. +botania.page.headCreating1=Get your head in the game \ No newline at end of file