diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiBooklet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiBooklet.java index dd81aec72..a7631d010 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiBooklet.java @@ -60,6 +60,7 @@ import java.util.List; public class GuiBooklet extends GuiScreen implements IBookletGui{ public static final ResourceLocation RES_LOC = AssetUtil.getBookletGuiLocation("guiBooklet"); + public static final ResourceLocation RES_LOC_ADDON = AssetUtil.getBookletGuiLocation("guiBookletAddon"); public static final ResourceLocation RES_LOC_HALLOWEEN = AssetUtil.getBookletGuiLocation("guiBookletHalloween"); public static final ResourceLocation RES_LOC_CHRISTMAS = AssetUtil.getBookletGuiLocation("guiBookletChristmas"); public static final ResourceLocation RES_LOC_VALENTINE = AssetUtil.getBookletGuiLocation("guiBookletValentinesDay"); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java index a4e2f1b64..22fae77c5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/InitBooklet.java @@ -28,6 +28,7 @@ import de.ellpeck.actuallyadditions.mod.items.lens.LensDisenchanting; import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler; import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods; import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; +import de.ellpeck.actuallyadditions.mod.recipe.EmpowererHandler; import de.ellpeck.actuallyadditions.mod.tile.*; import de.ellpeck.actuallyadditions.mod.util.Util; import net.minecraft.init.Blocks; @@ -70,6 +71,12 @@ public final class InitBooklet{ } new BookletChapter("crystals", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockAtomicReconstructor), crystalPages.toArray(new BookletPage[crystalPages.size()])).setSpecial(); new BookletChapter("coalGen", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockCoalGenerator), new PageCrafting(1, BlockCrafting.recipeCoalGen).addTextReplacement("", TileEntityCoalGenerator.PRODUCE).setPageStacksWildcard()); + ArrayList empowererPages = new ArrayList(); + empowererPages.addAll(Arrays.asList(new PageTextOnly(1), new PagePicture(2, "pageEmpowerer", 137), new PageCrafting(3, BlockCrafting.recipeEmpowerer).setNoText(), new PageCrafting(4, BlockCrafting.recipeDisplayStand), new PageCrafting(5, MiscCrafting.RECIPES_EMPOWERED_CRYSTALS).setNoText(), new PageCrafting(6, MiscCrafting.RECIPES_EMPOWERED_CRYSTAL_BLOCKS).setNoText())); + for(int i = 0; i < EmpowererHandler.MAIN_PAGE_RECIPES.size(); i++){ + empowererPages.add(new PageEmpowerer(7+i, EmpowererHandler.MAIN_PAGE_RECIPES.get(i)).setNoText()); + } + new BookletChapter("empowerer", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitBlocks.blockEmpowerer), empowererPages.toArray(new BookletPage[empowererPages.size()])).setSpecial(); new BookletChapter("craftingIngs", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeCoil).setNoText(), new PageCrafting(3, ItemCrafting.recipeCoilAdvanced).setNoText(), new PageCrafting(4, BlockCrafting.recipeCase).setNoText(), new PageCrafting(5, BlockCrafting.recipeEnderPearlBlock).setNoText(), new PageCrafting(6, BlockCrafting.recipeEnderCase).setNoText(), new PageCrafting(7, ItemCrafting.recipeRing).setNoText(), new PageCrafting(8, ItemCrafting.recipeKnifeHandle).setNoText(), new PageCrafting(9, ItemCrafting.recipeKnifeBlade).setNoText(), new PageCrafting(10, ItemCrafting.recipeKnife).setNoText(), new PageCrafting(11, ItemCrafting.recipeDough).setNoText(), new PageCrafting(12, ItemCrafting.recipeRiceDough).setNoText(), new PageCrafting(13, BlockCrafting.recipeIronCase).setNoText(), new PageCrafting(14, ItemCrafting.recipeLens).setNoText()).setImportant(); new BookletChapter("rf", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(Items.REDSTONE), new PageTextOnly(1)); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageEmpowerer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageEmpowerer.java new file mode 100644 index 000000000..cc8b9a10e --- /dev/null +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageEmpowerer.java @@ -0,0 +1,154 @@ +/* + * This file ("PageEmpowerer.java") is part of the Actually Additions mod for Minecraft. + * It is created and owned by Ellpeck and distributed + * under the Actually Additions License to be found at + * http://ellpeck.de/actaddlicense + * View the source code at https://github.com/Ellpeck/ActuallyAdditions + * + * © 2015-2016 Ellpeck + */ + +package de.ellpeck.actuallyadditions.mod.booklet.page; + +import de.ellpeck.actuallyadditions.api.internal.IBookletGui; +import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe; +import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe; +import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; +import de.ellpeck.actuallyadditions.mod.booklet.GuiBooklet; +import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy; +import de.ellpeck.actuallyadditions.mod.util.*; +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemStack; +import net.minecraft.util.text.TextFormatting; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +import java.util.ArrayList; +import java.util.List; + +public class PageEmpowerer extends BookletPageAA{ + + private final EmpowererRecipe[] recipes; + private int recipePos; + + public PageEmpowerer(int id, ArrayList recipes){ + this(id, recipes.toArray(new EmpowererRecipe[recipes.size()])); + } + + public PageEmpowerer(int id, EmpowererRecipe... recipes){ + super(id); + this.recipes = recipes; + this.addToPagesWithItemStackData(); + } + + @Override + @SideOnly(Side.CLIENT) + public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){ + if(this.recipes[this.recipePos] != null){ + Minecraft.getMinecraft().getTextureManager().bindTexture(GuiBooklet.RES_LOC_ADDON); + gui.drawRect(gui.getGuiLeft()+22, gui.getGuiTop()+20, 0, 0, 94, 58); + } + } + + @Override + @SideOnly(Side.CLIENT) + public void render(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){ + EmpowererRecipe recipe = this.recipes[this.recipePos]; + if(recipe == null){ + StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, TextFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID+".recipeDisabled"), gui.getGuiLeft()+14, gui.getGuiTop()+15, 115, 0, false); + } + else{ + String strg = "Empowerer"; + Minecraft.getMinecraft().fontRendererObj.drawString(strg, gui.getGuiLeft()+gui.getXSize()/2-Minecraft.getMinecraft().fontRendererObj.getStringWidth(strg)/2, gui.getGuiTop()+10, 0); + } + + String text = gui.getCurrentEntrySet().getCurrentPage().getText(); + if(text != null && !text.isEmpty()){ + StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, text, gui.getGuiLeft()+14, gui.getGuiTop()+100, 115, 0, false); + } + + if(recipe != null){ + for(int i = 0; i < 2; i++){ + for(int count = 0; count < 6; count++){ + ItemStack stack; + int x; + int y; + switch(count){ + case 0: + stack = recipe.input; + x =21; + y = 21; + break; + case 1: + stack = recipe.modifier1; + x = 21; + y = 1; + break; + case 2: + stack = recipe.modifier2; + x = 41; + y = 21; + break; + case 3: + stack = recipe.modifier3; + x = 21; + y = 41; + break; + case 4: + stack = recipe.modifier4; + x = 1; + y = 21; + break; + default: + stack = recipe.output; + x = 77; + y = 21; + break; + } + + if(stack.getItemDamage() == Util.WILDCARD){ + stack.setItemDamage(0); + } + + int xShow = gui.getGuiLeft()+22+x; + int yShow = gui.getGuiTop()+20+y; + if(i != 1){ + AssetUtil.renderStackToGui(stack, xShow, yShow, 1.0F); + } + else{ + if(mouseX >= xShow && mouseX <= xShow+16 && mouseY >= yShow && mouseY <= yShow+16){ + gui.renderTooltipAndTransferButton(this, stack, mouseX, mouseY, x != 5, mousePressed); + } + } + } + } + } + } + + @Override + @SideOnly(Side.CLIENT) + public void updateScreen(int ticksElapsed){ + if(ticksElapsed%15 == 0){ + if(this.recipePos+1 >= this.recipes.length){ + this.recipePos = 0; + } + else{ + this.recipePos++; + } + } + } + + @Override + public ItemStack[] getItemStacksForPage(){ + if(this.recipes != null){ + ArrayList stacks = new ArrayList(); + for(EmpowererRecipe recipe : this.recipes){ + if(recipe != null){ + stacks.add(recipe.output); + } + } + return stacks.toArray(new ItemStack[stacks.size()]); + } + return null; + } +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigCrafting.java index 80a2de3b4..63204fd3b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigCrafting.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/config/values/ConfigCrafting.java @@ -172,7 +172,8 @@ public enum ConfigCrafting{ TINY_COAL("Tiny Coal", ConfigCategories.ITEMS_CRAFTING), BAG("Bag", ConfigCategories.ITEMS_CRAFTING), - VOID_BAG("Void Bag", ConfigCategories.ITEMS_CRAFTING); + VOID_BAG("Void Bag", ConfigCategories.ITEMS_CRAFTING), + EMPOWERER("Empowerer", ConfigCategories.BLOCKS_CRAFTING); public final String name; public final String category; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/BlockCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/BlockCrafting.java index 32ab1162c..afd9c3811 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/BlockCrafting.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/crafting/BlockCrafting.java @@ -93,10 +93,22 @@ public final class BlockCrafting{ public static IRecipe recipePlayerInterface; public static IRecipe recipeDisplayStand; public static IRecipe recipeShockSuppressor; + public static IRecipe recipeEmpowerer; public static IRecipe[] recipesTinyTorch = new IRecipe[2]; public static void init(){ + //Empowerer + if(ConfigCrafting.EMPOWERER.isEnabled()){ + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockEmpowerer), + " R ", " B ", "CDC", + 'R', new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), + 'B', new ItemStack(InitItems.itemBatteryDouble, 1, Util.WILDCARD), + 'C', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.IRON_CASING.ordinal()), + 'D', new ItemStack(InitBlocks.blockDisplayStand))); + recipeEmpowerer = RecipeUtil.lastIRecipe(); + } + //Tiny Torch GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockTinyTorch, 2), "C", diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/EmpowererHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/EmpowererHandler.java index 957ac084f..da2630cd8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/EmpowererHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/EmpowererHandler.java @@ -11,20 +11,29 @@ package de.ellpeck.actuallyadditions.mod.recipe; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; +import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe; +import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe; import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals; import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; +import de.ellpeck.actuallyadditions.mod.util.RecipeUtil; import net.minecraft.item.ItemStack; +import java.util.ArrayList; + public final class EmpowererHandler{ + public static final ArrayList MAIN_PAGE_RECIPES = new ArrayList(); + public static void init(){ ItemStack m = new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()); for(int i = 0; i < TheCrystals.values().length; i++){ float[] color = TheCrystals.values()[i].conversionColorParticles; ActuallyAdditionsAPI.addEmpowererRecipe(new ItemStack(InitItems.itemCrystal, 1, i), new ItemStack(InitItems.itemCrystalEmpowered, 1, i), m, m, m, m, 50000, 200, color); + MAIN_PAGE_RECIPES.add(RecipeUtil.lastEmpowererRecipe()); ActuallyAdditionsAPI.addEmpowererRecipe(new ItemStack(InitBlocks.blockCrystal, 1, i), new ItemStack(InitBlocks.blockCrystalEmpowered, 1, i), m, m, m, m, 500000, 2000, color); + MAIN_PAGE_RECIPES.add(RecipeUtil.lastEmpowererRecipe()); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/RecipeUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/RecipeUtil.java index d71a1c804..df35031f9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/RecipeUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/RecipeUtil.java @@ -15,6 +15,7 @@ import de.ellpeck.actuallyadditions.api.lens.LensConversion; import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe; import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe; import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe; +import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.IRecipe; @@ -42,6 +43,11 @@ public final class RecipeUtil{ return recipe instanceof IRecipe ? (IRecipe)recipe : null; } + public static EmpowererRecipe lastEmpowererRecipe(){ + List list = ActuallyAdditionsAPI.EMPOWERER_RECIPES; + return list.get(list.size()-1); + } + public static List getCrusherRecipeOutputOnes(CrusherRecipe recipe){ return doRecipeOrWhatever(recipe.outputOneStack, recipe.outputOne, recipe.outputOneAmount); } diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index fd28b7070..66eaf6e44 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -981,4 +981,9 @@ booklet.actuallyadditions.chapter.worms.text.1=The Worms are a pretty u booklet.actuallyadditions.chapter.worms.text.2=A worm at work booklet.actuallyadditions.chapter.bags.name=Bag and Void Bag -booklet.actuallyadditions.chapter.bags.text.1=Bags are an easy way to transport items around, however, they have some additional functions. First of all, in their GUI that is accessed by right-clicking, they can be set to automatically suck up items on the ground. Also, they have a couple of filter slots where you can configure what can actually go into the bags. Void Bags have the same functionality as normal bags, however, they remove items from the world instead of storing them. \ No newline at end of file +booklet.actuallyadditions.chapter.bags.text.1=Bags are an easy way to transport items around, however, they have some additional functions. First of all, in their GUI that is accessed by right-clicking, they can be set to automatically suck up items on the ground. Also, they have a couple of filter slots where you can configure what can actually go into the bags. Void Bags have the same functionality as normal bags, however, they remove items from the world instead of storing them. + +booklet.actuallyadditions.chapter.empowerer.name=Empowerer +booklet.actuallyadditions.chapter.empowerer.text.1=The Empowerer is a mid-tier block that can be used to empower crystals and other items. To use it, items that should be empowered can be right-clicked onto the Empowerer, and empowering items need to be placed on Display Stands that are two blocks away, like seen in the picture on the next page. To then activate the process, every Display Stand needs to be powered with a lot of RF that is then drained to empower the item on the Empowerer. +booklet.actuallyadditions.chapter.empowerer.text.2=The placement of the Display Stands +booklet.actuallyadditions.chapter.empowerer.text.4=The Display Stand can also be used for other things! See the Blocks that use RF section for more info about it! \ No newline at end of file diff --git a/src/main/resources/assets/actuallyadditions/textures/gui/booklet/guiBooklet.png b/src/main/resources/assets/actuallyadditions/textures/gui/booklet/guiBooklet.png index 7f2c5572f..a9b9449eb 100644 Binary files a/src/main/resources/assets/actuallyadditions/textures/gui/booklet/guiBooklet.png and b/src/main/resources/assets/actuallyadditions/textures/gui/booklet/guiBooklet.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/gui/booklet/guiBookletAddon.png b/src/main/resources/assets/actuallyadditions/textures/gui/booklet/guiBookletAddon.png new file mode 100644 index 000000000..551768e31 Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/gui/booklet/guiBookletAddon.png differ diff --git a/src/main/resources/assets/actuallyadditions/textures/gui/booklet/pageEmpowerer.png b/src/main/resources/assets/actuallyadditions/textures/gui/booklet/pageEmpowerer.png new file mode 100644 index 000000000..d69447fc1 Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/gui/booklet/pageEmpowerer.png differ