From 1a94240b0fa230d2a7043ec050d4ce7d0d17e1d5 Mon Sep 17 00:00:00 2001 From: Lizbeth Rika Date: Sun, 2 Nov 2014 19:04:59 +0000 Subject: [PATCH] Recipe/docs and stuff for the brewery. Now it's time to add 5 million more brews /o/ --- .../botania/common/block/BlockBrewery.java | 20 +++- .../common/crafting/ModCrafingRecipes.java | 24 ++++ .../botania/common/lexicon/BLexiconEntry.java | 13 +- .../botania/common/lexicon/LexiconData.java | 11 ++ .../botania/common/lexicon/page/PageBrew.java | 111 ++++++++++++++++++ .../vazkii/botania/common/lib/LibLexicon.java | 2 + resources/assets/botania/lang/en_US.lang | 21 +++- 7 files changed, 193 insertions(+), 9 deletions(-) create mode 100644 MODSRC/vazkii/botania/common/lexicon/page/PageBrew.java diff --git a/MODSRC/vazkii/botania/common/block/BlockBrewery.java b/MODSRC/vazkii/botania/common/block/BlockBrewery.java index 1d97e53f5..e632b2dd4 100644 --- a/MODSRC/vazkii/botania/common/block/BlockBrewery.java +++ b/MODSRC/vazkii/botania/common/block/BlockBrewery.java @@ -13,11 +13,6 @@ package vazkii.botania.common.block; import java.util.Random; -import vazkii.botania.client.lib.LibRenderIDs; -import vazkii.botania.common.block.tile.TileBrewery; -import vazkii.botania.common.block.tile.TileRuneAltar; -import vazkii.botania.common.block.tile.TileSimpleInventory; -import vazkii.botania.common.lib.LibBlockNames; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -27,8 +22,16 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; +import vazkii.botania.api.lexicon.ILexiconable; +import vazkii.botania.api.lexicon.LexiconEntry; +import vazkii.botania.client.lib.LibRenderIDs; +import vazkii.botania.common.block.tile.TileBrewery; +import vazkii.botania.common.block.tile.TileRuneAltar; +import vazkii.botania.common.block.tile.TileSimpleInventory; +import vazkii.botania.common.lexicon.LexiconData; +import vazkii.botania.common.lib.LibBlockNames; -public class BlockBrewery extends BlockModContainer { +public class BlockBrewery extends BlockModContainer implements ILexiconable { Random random; @@ -138,6 +141,11 @@ public class BlockBrewery extends BlockModContainer { @Override public TileEntity createNewTileEntity(World world, int meta) { return new TileBrewery(); + } + + @Override + public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) { + return LexiconData.brewery; } } diff --git a/MODSRC/vazkii/botania/common/crafting/ModCrafingRecipes.java b/MODSRC/vazkii/botania/common/crafting/ModCrafingRecipes.java index 5aedd5060..823a3c6ad 100644 --- a/MODSRC/vazkii/botania/common/crafting/ModCrafingRecipes.java +++ b/MODSRC/vazkii/botania/common/crafting/ModCrafingRecipes.java @@ -197,6 +197,9 @@ public final class ModCrafingRecipes { public static IRecipe recipeRegenIvy; public static IRecipe recipeUltraSpreader; public static IRecipe recipeHelmetOfRevealing; + public static IRecipe recipeVial; + public static IRecipe recipeFlask; + public static IRecipe recipeBrewery; public static void init() { // Lexicon Recipe @@ -1241,6 +1244,27 @@ public final class ModCrafingRecipes { 'R', new ItemStack(Blocks.redstone_block)); recipeRFGenerator = BotaniaAPI.getLatestAddedRecipe(); + // Vial Recipe + GameRegistry.addRecipe(new ItemStack(ModItems.vial, 3, 0), + "G G", " G ", + 'G', new ItemStack(ModBlocks.manaGlass)); + recipeVial = BotaniaAPI.getLatestAddedRecipe(); + + // Flask Recipe + GameRegistry.addRecipe(new ItemStack(ModItems.vial, 3, 1), + "G G", " G ", + 'G', new ItemStack(ModBlocks.elfGlass)); + recipeFlask = BotaniaAPI.getLatestAddedRecipe(); + + // Botanical Brewery Recipe + addOreDictRecipe(new ItemStack(ModBlocks.brewery), + "RSR", "RAR", "RMR", + 'R', LibOreDict.LIVING_ROCK, + 'S', new ItemStack(Items.brewing_stand), + 'A', LibOreDict.RUNE[8], + 'M', new ItemStack(ModBlocks.storage)); + recipeBrewery = BotaniaAPI.getLatestAddedRecipe(); + // Mana and Terrasteel Block Recipes addOreDictRecipe(new ItemStack(ModBlocks.storage, 1, 0), "III", "III", "III", diff --git a/MODSRC/vazkii/botania/common/lexicon/BLexiconEntry.java b/MODSRC/vazkii/botania/common/lexicon/BLexiconEntry.java index 276a17db4..c5e8b40aa 100644 --- a/MODSRC/vazkii/botania/common/lexicon/BLexiconEntry.java +++ b/MODSRC/vazkii/botania/common/lexicon/BLexiconEntry.java @@ -25,8 +25,13 @@ public class BLexiconEntry extends LexiconEntry { @Override public LexiconEntry setLexiconPages(LexiconPage... pages) { - for(LexiconPage page : pages) + for(LexiconPage page : pages) { page.unlocalizedName = "botania.page." + getLazyUnlocalizedName() + page.unlocalizedName; + if(page instanceof IDoubleUnlocalizedName) { + IDoubleUnlocalizedName dou = (IDoubleUnlocalizedName) page; + dou.setSecondUnlocalizedName("botania.page." + getLazyUnlocalizedName() + dou.getSecondUnlocalizedName()); + } + } return super.setLexiconPages(pages); } @@ -39,5 +44,9 @@ public class BLexiconEntry extends LexiconEntry { public String getLazyUnlocalizedName() { return super.getUnlocalizedName(); } - + + public static interface IDoubleUnlocalizedName { + public void setSecondUnlocalizedName(String name); + public String getSecondUnlocalizedName(); + } } diff --git a/MODSRC/vazkii/botania/common/lexicon/LexiconData.java b/MODSRC/vazkii/botania/common/lexicon/LexiconData.java index a8b528934..70be8e9d2 100644 --- a/MODSRC/vazkii/botania/common/lexicon/LexiconData.java +++ b/MODSRC/vazkii/botania/common/lexicon/LexiconData.java @@ -21,6 +21,7 @@ import vazkii.botania.common.Botania; import vazkii.botania.common.block.ModBlocks; import vazkii.botania.common.core.handler.ConfigHandler; import vazkii.botania.common.core.handler.SheddingHandler; +import vazkii.botania.common.crafting.ModBrewRecipes; import vazkii.botania.common.crafting.ModCrafingRecipes; import vazkii.botania.common.crafting.ModElvenTradeRecipes; import vazkii.botania.common.crafting.ModManaAlchemyRecipes; @@ -29,6 +30,7 @@ import vazkii.botania.common.crafting.ModManaInfusionRecipes; import vazkii.botania.common.crafting.ModPetalRecipes; import vazkii.botania.common.crafting.ModRuneRecipes; import vazkii.botania.common.item.ModItems; +import vazkii.botania.common.lexicon.page.PageBrew; import vazkii.botania.common.lexicon.page.PageCraftingRecipe; import vazkii.botania.common.lexicon.page.PageElvenRecipe; import vazkii.botania.common.lexicon.page.PageGuide; @@ -125,6 +127,8 @@ public final class LexiconData { public static LexiconEntry spawnerClaw; public static LexiconEntry craftCrate; public static LexiconEntry enderEyeBlock; + public static LexiconEntry brewery; + public static LexiconEntry flasks; public static LexiconEntry manaBlaster; public static LexiconEntry grassSeeds; @@ -450,6 +454,13 @@ public final class LexiconData { enderEyeBlock = new BLexiconEntry(LibLexicon.DEVICE_ENDER_EYE_BLOCK, categoryDevices); enderEyeBlock.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeEnderEyeBlock)); + brewery = new BLexiconEntry(LibLexicon.DEVICE_BREWERY, categoryDevices); + brewery.setLexiconPages(new PageText("0"), new PageText("1"), new PageCraftingRecipe("2", ModCrafingRecipes.recipeBrewery), new PageCraftingRecipe("3", ModCrafingRecipes.recipeVial), new PageText("4"), + new PageBrew(ModBrewRecipes.speedBrew, "5a", "5b"), new PageBrew(ModBrewRecipes.strengthBrew, "6a", "6b")); + + flasks = new ALexiconEntry(LibLexicon.DEVICE_FLASKS, categoryDevices); + flasks.setLexiconPages(new PageText("0"), new PageText("1"), new PageCraftingRecipe("2", ModCrafingRecipes.recipeFlask)); + // TOOLS ENTRIES manaBlaster = new BLexiconEntry(LibLexicon.TOOL_MANA_BLASTER, categoryTools); manaBlaster.setLexiconPages(new PageText("0"), new PageText("1"), new PageText("2"), new PageCraftingRecipe("3", ModCrafingRecipes.recipeManaBlaster)); diff --git a/MODSRC/vazkii/botania/common/lexicon/page/PageBrew.java b/MODSRC/vazkii/botania/common/lexicon/page/PageBrew.java new file mode 100644 index 000000000..fb38f6f06 --- /dev/null +++ b/MODSRC/vazkii/botania/common/lexicon/page/PageBrew.java @@ -0,0 +1,111 @@ +/** + * 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 @ [Nov 2, 2014, 5:17:46 PM (GMT)] + */ +package vazkii.botania.common.lexicon.page; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; +import net.minecraftforge.oredict.OreDictionary; +import vazkii.botania.api.BotaniaAPI; +import vazkii.botania.api.brew.Brew; +import vazkii.botania.api.internal.IGuiLexiconEntry; +import vazkii.botania.api.lexicon.ILexicon; +import vazkii.botania.api.recipe.RecipeBrew; +import vazkii.botania.common.item.ModItems; +import vazkii.botania.common.lexicon.BLexiconEntry.IDoubleUnlocalizedName; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class PageBrew extends PageRecipe implements IDoubleUnlocalizedName { + + RecipeBrew recipe; + String text; + + public PageBrew(RecipeBrew recipe, String unlocalizedName, String bottomText) { + super(bottomText); + this.recipe = recipe; + this.text = unlocalizedName; + } + + @Override + public void renderRecipe(IGuiLexiconEntry gui, int mx, int my) { + int width = gui.getWidth() - 30; + int height = gui.getHeight(); + int x = gui.getLeft() + 16; + int y = gui.getTop() + 12; + + Brew brew = recipe.getBrew(); + FontRenderer renderer = Minecraft.getMinecraft().fontRenderer; + boolean unicode = renderer.getUnicodeFlag(); + renderer.setUnicodeFlag(true); + String s = EnumChatFormatting.BOLD + String.format(StatCollector.translateToLocal("botaniamisc.brewOf"), StatCollector.translateToLocal(brew.getUnlocalizedName())); + renderer.drawString(s, gui.getLeft() + gui.getWidth() / 2 - renderer.getStringWidth(s) / 2, y, 0x222222); + renderer.setUnicodeFlag(unicode); + PageText.renderText(x, y + 22, width, height, text); + + ItemStack book = Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem(); + if(book != null && book.getItem() instanceof ILexicon && ((ILexicon) book.getItem()).isKnowledgeUnlocked(book, BotaniaAPI.elvenKnowledge)) { + renderItemAtLinePos(gui, 20, 2, y + 12, recipe.getOutput(new ItemStack(ModItems.vial))); + renderItemAtLinePos(gui, 20, 3, y + 12, recipe.getOutput(new ItemStack(ModItems.vial, 1, 1))); + } else renderItemAtLinePos(gui, 0, -1, y + 12, recipe.getOutput(new ItemStack(ModItems.vial))); + + int i = 0; + y = gui.getTop() + gui.getHeight() - 54; + List inputs = new ArrayList(recipe.getInputs()); + + int offset = gui.getWidth() / 2 - inputs.size() * 9; + for(Object input : inputs) { + if(input instanceof String) + input = OreDictionary.getOres((String) input).get(0); + + renderItemAtLinePos(gui, offset, i, y, (ItemStack) input); + i++; + } + + super.renderRecipe(gui, mx, my); + } + + @SideOnly(Side.CLIENT) + public void renderItemAtLinePos(IGuiLexiconEntry gui, int offset, int pos, int yPos, ItemStack stack) { + if(stack == null || stack.getItem() == null) + return; + stack = stack.copy(); + + if(stack.getItemDamage() == Short.MAX_VALUE) + stack.setItemDamage(0); + + int xPos = gui.getLeft() + (pos == -1 ? gui.getWidth() / 2 - 8 : pos * 18) + offset; + + ItemStack stack1 = stack.copy(); + if(stack1.getItemDamage() == -1) + stack1.setItemDamage(0); + + renderItem(gui, xPos, yPos, stack1, false); + } + + @Override + public void setSecondUnlocalizedName(String name) { + text = name; + } + + @Override + public String getSecondUnlocalizedName() { + return text; + } + +} diff --git a/MODSRC/vazkii/botania/common/lib/LibLexicon.java b/MODSRC/vazkii/botania/common/lib/LibLexicon.java index 1c25c8b3d..3eea9aa98 100644 --- a/MODSRC/vazkii/botania/common/lib/LibLexicon.java +++ b/MODSRC/vazkii/botania/common/lib/LibLexicon.java @@ -99,6 +99,8 @@ public final class LibLexicon { public static final String DEVICE_SPAWNER_CLAW = "spawnerClaw"; public static final String DEVICE_CRAFT_CRATE = "craftCrate"; public static final String DEVICE_ENDER_EYE_BLOCK = "enderEyeBlock"; + public static final String DEVICE_BREWERY = "brewery"; + public static final String DEVICE_FLASKS = "flasks"; public static final String TOOL_MANA_BLASTER = "manaBlaster"; public static final String TOOL_GRASS_SEEDS = "grassSeeds"; diff --git a/resources/assets/botania/lang/en_US.lang b/resources/assets/botania/lang/en_US.lang index 851bdf293..c11c1844a 100644 --- a/resources/assets/botania/lang/en_US.lang +++ b/resources/assets/botania/lang/en_US.lang @@ -63,6 +63,7 @@ botaniamisc.dropTip1=CTRL-%key% will drop a full stack botaniamisc.wandMode.bind=Bind Mode botaniamisc.wandMode.function=Function Mode botaniamisc.playVideo=Play Video +botaniamisc.brewOf=Brew of %s # NEI INTEGRATION botania.nei.elvenTrade=Elven Trade @@ -1221,7 +1222,7 @@ botania.entry.turntable=Spreader Turntable botania.page.turntable0=The &1Spreader Turntable&0, as its name implies, can turn &1Mana Spreaders&0 around and around. Placing a spreader above the turntable will rotate it, given that a redstone signal isn't applied.
To change the speed of the turntable, right click with a &1Wand of the Forest&0, shift-right clicking will invert the movement. botania.page.turntable1=You spin me right round -# -- BOTANICAL ALCHEMY +# -- ALCHEMISING WITH MANA botania.entry.manaAlchemy=Alchemising with Mana botania.page.manaAlchemy0=&4Mana&0 is an extremely volatile substance, to a point that its complete properties and abilities are unknown.
One of them is known, though, by attaching an &1Alchemy Catalyst&0, created with a mixture of otherworldly materials to the bottom of a &1Mana Pool&0, it enables the pool to perform &4Alchemy&0. botania.page.manaAlchemy1=Creating the &1Catalyst&0 @@ -1247,6 +1248,24 @@ botania.page.manaAlchemy20=Breaking &1Cobblestone&0 into &1Sand&0 botania.page.manaAlchemy21=Breaking &1Hardened Clay&0 into &1Red Sand&0 botania.page.manaAlchemy22=Making &1Coarse Dirt&0 +# -- BOTANICAL BREWERY +botania.entry.brewery=Brewing (I - Basics) +botania.page.brewery0=Given the versatility of &4Mana&0, the fact that it can be used to conjure some sort of &4Potions&0 comes to nobody's surprise. &4Brews&0 are a variant of &4Potions&0, to put it simply. They're created using &4Mana&0 and a set of ingedients.
Unlike &4Potions&0, &4Brews&0 have defined recipes, and each vial contains multiple doses. +botania.page.brewery1=In order to create &4Brews&0 one would require a &1Botanical Brewery&0, &1Vials&0 and of course, the reagents defined in the recipe.
The &4Mana&0 functions as the both the solvent and energy source and is given through &4Mana Bursts&0, simply pointing a &1Mana Spreader&0 at the &1Brewery&0 will work just fine. +botania.page.brewery2=Crafting the &1Botanical Brewery&0 +botania.page.brewery3=Crafting &1Vials&0 +botania.page.brewery4=Working the &1Botanical Brewery&0 is rather simple. First off, to add an item, right click with it on the block or toss it.
Start off by adding the &1Vial&0, which will get set on the top of the brewery. Proceed by adding all the required ingredients. Once a &4Brew&0 can be created with the ingredients in the brewery, &4Mana&0 will start flowing, just wait a bit after that. +botania.page.brewery5a=A simple brew, it mimics a &1Potion of Swiftness&0, when taken, it has a similar effect, giving the individual a &4Speed II&0 effect. +botania.page.brewery5b=Gotta go fast +botania.page.brewery6a=A simple brew, it mimics a &1Potion of Strength&0, when taken, it has a similar effect, giving the individual a &4Strength II&0 effect. +botania.page.brewery6b=Hodor + +# -- BREWING FLASKS +botania.entry.flasks=Brewing Flasks +botania.page.flasks0=&1Alfglass&0 seems to be more maleable than the typical &1Managlass&0 used for &1Vials&0. A &1Flask&0, made with &1Alfglass&0 is the typical elven container for &4Brews&0, and can contain 6 doses of one, rather than the 4 a &1Vial&0 does. +botania.page.flasks1=While the ingredient cost to brew something in a &1Flask&0 is smaller, the &4Mana&0 cost is double that of a regular &1Vial&0.
Lastly, given that the bottleneck of a &1Flask&0 is larger than that of a &1Vial&0, the contents can be consumed faster. +botania.page.flasks2=Get one under the bridge + # -- EYE OF THE ANCIENTS botania.entry.forestEye=Eye of the Ancients botania.page.forestEye0=As the Ancients who used to watch over the world always looked for the living beings on it, this block, the &1Eye of the Ancients&0, will do just that.
By attaching a &1Comparator&0 next to it, it'll send out a redstone signal equivalent to the amount of animals it can find.