From e7a42b9dfe1212f6b1d9415c7dae0e41ad580b23 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 22 Sep 2015 23:22:33 +0200 Subject: [PATCH] Made "Get Booklet..." info togglable in the config, removed unnecessary crusher & furnace recipe pages --- .../booklet/BookletChapterCrusher.java | 36 ------------------ .../booklet/BookletChapterFurnace.java | 37 ------------------- .../booklet/InitBooklet.java | 4 +- .../config/values/ConfigBoolValues.java | 1 + .../actuallyadditions/event/TooltipEvent.java | 5 ++- 5 files changed, 6 insertions(+), 77 deletions(-) delete mode 100644 src/main/java/ellpeck/actuallyadditions/booklet/BookletChapterCrusher.java delete mode 100644 src/main/java/ellpeck/actuallyadditions/booklet/BookletChapterFurnace.java diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/BookletChapterCrusher.java b/src/main/java/ellpeck/actuallyadditions/booklet/BookletChapterCrusher.java deleted file mode 100644 index 71e7ccab1..000000000 --- a/src/main/java/ellpeck/actuallyadditions/booklet/BookletChapterCrusher.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * This file ("BookletChapterCrusher.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://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md - * View the source code at https://github.com/Ellpeck/ActuallyAdditions - * - * © 2015 Ellpeck - */ - -package ellpeck.actuallyadditions.booklet; - -import ellpeck.actuallyadditions.booklet.page.BookletPage; -import ellpeck.actuallyadditions.booklet.page.PageCrusherRecipe; -import ellpeck.actuallyadditions.recipe.CrusherRecipeManualRegistry; -import net.minecraft.item.ItemStack; - -import java.util.ArrayList; -import java.util.Arrays; - -public class BookletChapterCrusher extends BookletChapter{ - - public BookletChapterCrusher(String unlocalizedName, BookletIndexEntry entry, ItemStack displayStack, BookletPage... pages){ - super(unlocalizedName, entry, displayStack, getAllPages(pages)); - } - - @SuppressWarnings("unchecked") - private static BookletPage[] getAllPages(BookletPage... pages){ - ArrayList list = new ArrayList(); - list.addAll(Arrays.asList(pages)); - for(CrusherRecipeManualRegistry.CrusherRecipe rec : CrusherRecipeManualRegistry.recipes){ - list.add(new PageCrusherRecipe(list.size()+1, rec).setNoText()); - } - return list.toArray(new BookletPage[list.size()]); - } -} diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/BookletChapterFurnace.java b/src/main/java/ellpeck/actuallyadditions/booklet/BookletChapterFurnace.java deleted file mode 100644 index e703a8f29..000000000 --- a/src/main/java/ellpeck/actuallyadditions/booklet/BookletChapterFurnace.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * This file ("BookletChapterFurnace.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://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md - * View the source code at https://github.com/Ellpeck/ActuallyAdditions - * - * © 2015 Ellpeck - */ - -package ellpeck.actuallyadditions.booklet; - -import ellpeck.actuallyadditions.booklet.page.BookletPage; -import ellpeck.actuallyadditions.booklet.page.PageFurnace; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.FurnaceRecipes; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Map; - -public class BookletChapterFurnace extends BookletChapter{ - - public BookletChapterFurnace(String unlocalizedName, BookletIndexEntry entry, ItemStack displayStack, BookletPage... pages){ - super(unlocalizedName, entry, displayStack, getAllPages(pages)); - } - - @SuppressWarnings("unchecked") - private static BookletPage[] getAllPages(BookletPage... pages){ - ArrayList list = new ArrayList(); - list.addAll(Arrays.asList(pages)); - for(Object o : FurnaceRecipes.smelting().getSmeltingList().entrySet()){ - list.add(new PageFurnace(list.size()+1, (ItemStack)((Map.Entry)o).getKey(), (ItemStack)((Map.Entry)o).getValue()).setNoText()); - } - return list.toArray(new BookletPage[list.size()]); - } -} diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/InitBooklet.java b/src/main/java/ellpeck/actuallyadditions/booklet/InitBooklet.java index 90dfd431e..2ad7bb01e 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/InitBooklet.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/InitBooklet.java @@ -78,8 +78,8 @@ public class InitBooklet{ //RF Using Blocks new BookletChapter("coffeeMachine", entryFunctionalRF, new ItemStack(InitBlocks.blockCoffeeMachine), new PageTextOnly(1).setStack(new ItemStack(InitItems.itemCoffeeBean)).addTextReplacement("", ConfigIntValues.COFFEE_MACHINE_ENERGY_USED.getValue()).addTextReplacement("", ConfigIntValues.COFFEE_CACHE_USED_PER_ITEM.getValue()).addTextReplacement("", ConfigIntValues.COFFEE_MACHINE_WATER_USED.getValue()), new PageTextOnly(2).setStack(new ItemStack(InitItems.itemCoffee)), new PageTextOnly(3), new PageCrafting(4, BlockCrafting.recipeCoffeeMachine).setNoText(), new PageCrafting(5, ItemCrafting.recipeCup).setNoText()); - new BookletChapterCrusher("crusher", entryFunctionalRF, new ItemStack(InitBlocks.blockGrinderDouble), new PageTextOnly(1).addTextReplacement("", ConfigIntValues.GRINDER_ENERGY_USED.getValue()).addTextReplacement("", ConfigIntValues.GRINDER_DOUBLE_ENERGY_USED.getValue()), new PageCrafting(2, BlockCrafting.recipeCrusher).setNoText(), new PageCrafting(3, BlockCrafting.recipeDoubleCrusher).setNoText()); - new BookletChapterFurnace("furnaceDouble", entryFunctionalRF, new ItemStack(InitBlocks.blockFurnaceDouble), new PageCrafting(1, BlockCrafting.recipeFurnace).addTextReplacement("", ConfigIntValues.FURNACE_ENERGY_USED.getValue())); + new BookletChapter("crusher", entryFunctionalRF, new ItemStack(InitBlocks.blockGrinderDouble), new PageTextOnly(1).addTextReplacement("", ConfigIntValues.GRINDER_ENERGY_USED.getValue()).addTextReplacement("", ConfigIntValues.GRINDER_DOUBLE_ENERGY_USED.getValue()), new PageCrafting(2, BlockCrafting.recipeCrusher).setNoText(), new PageCrafting(3, BlockCrafting.recipeDoubleCrusher).setNoText()); + new BookletChapter("furnaceDouble", entryFunctionalRF, new ItemStack(InitBlocks.blockFurnaceDouble), new PageCrafting(1, BlockCrafting.recipeFurnace).addTextReplacement("", ConfigIntValues.FURNACE_ENERGY_USED.getValue())); new BookletChapter("miner", entryFunctionalRF, new ItemStack(InitBlocks.blockOreMagnet), new PageTextOnly(1).addTextReplacement("", ConfigIntValues.ORE_MAGNET_ENERGY_USE.getValue()).addTextReplacement("", ConfigIntValues.ORE_MAGNET_OIL_USE.getValue()).addTextReplacement("", ConfigIntValues.ORE_MAGNET_RANGE.getValue()), new PageCrafting(2, BlockCrafting.recipeMiner).setNoText(), new PageCrafting(3, BlockCrafting.recipeCasing).setNoText()); new BookletChapter("lavaFactory", entryFunctionalRF, new ItemStack(InitBlocks.blockLavaFactoryController), new PageTextOnly(1).addTextReplacement("", ConfigIntValues.LAVA_FACTORY_ENERGY_USED.getValue()), new PageCrafting(2, BlockCrafting.recipeLavaFactory).setNoText()); new BookletChapter("energizer", entryFunctionalRF, new ItemStack(InitBlocks.blockEnergizer), new PageCrafting(1, BlockCrafting.recipeEnergizer), new PageCrafting(2, BlockCrafting.recipeEnervator)); diff --git a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigBoolValues.java b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigBoolValues.java index b9e41c581..03ea9f2dc 100644 --- a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigBoolValues.java +++ b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigBoolValues.java @@ -57,6 +57,7 @@ public enum ConfigBoolValues{ CTRL_INFO_FOR_EXTRA_INFO("Advanced Info Tooltips", ConfigCategories.OTHER, true, "Show the 'Press Control for more Info'-Text on Item Tooltips"), NEED_BOOKLET_FOR_KEYBIND_INFO("Booklet Quick Opening", ConfigCategories.TOOL_VALUES, true, "If the booklet should have to be inside the player's inventory to be able to hover over an item and press a keybind to quickly access the item's page"), + SHOW_NEED_BOOKLET_FOR_KEYBIND_INFO("Booklet Quick Opening Info", ConfigCategories.TOOL_VALUES, true, "If the 'Press key for more information'-button should show when the item has a page in the booklet"), GIVE_BOOKLET_ON_FIRST_CRAFT("Give Booklet on First Craft", ConfigCategories.OTHER, true, "If the booklet should be given to the player when he first crafts something from the Mod (Reduces Packet Traffic a bit when turned off!)"); public final String name; diff --git a/src/main/java/ellpeck/actuallyadditions/event/TooltipEvent.java b/src/main/java/ellpeck/actuallyadditions/event/TooltipEvent.java index 315bf66be..3638063b9 100644 --- a/src/main/java/ellpeck/actuallyadditions/event/TooltipEvent.java +++ b/src/main/java/ellpeck/actuallyadditions/event/TooltipEvent.java @@ -66,7 +66,6 @@ public class TooltipEvent{ if(!ConfigBoolValues.NEED_BOOKLET_FOR_KEYBIND_INFO.isEnabled() || Minecraft.getMinecraft().thePlayer.inventory.hasItem(InitItems.itemLexicon)){ event.toolTip.add(EnumChatFormatting.GOLD+StringUtil.localizeFormatted("booklet."+ModUtil.MOD_ID_LOWER+".keyToSeeRecipe", keyCode > 0 && keyCode < Keyboard.KEYBOARD_SIZE ? "'"+Keyboard.getKeyName(keyCode)+"'" : "[NONE]")); - //TODO Find a better method to do this eventually if(Keyboard.isKeyDown(KeyBinds.keybindOpenBooklet.getKeyCode())){ GuiBooklet book = new GuiBooklet(); Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); @@ -76,7 +75,9 @@ public class TooltipEvent{ } } else{ - event.toolTip.addAll(Minecraft.getMinecraft().fontRenderer.listFormattedStringToWidth(EnumChatFormatting.DARK_RED+StringUtil.localizeFormatted("booklet."+ModUtil.MOD_ID_LOWER+".noBookletInInventory"), GuiBooklet.TOOLTIP_SPLIT_LENGTH)); + if(ConfigBoolValues.SHOW_NEED_BOOKLET_FOR_KEYBIND_INFO.isEnabled()){ + event.toolTip.addAll(Minecraft.getMinecraft().fontRenderer.listFormattedStringToWidth(EnumChatFormatting.DARK_RED+StringUtil.localizeFormatted("booklet."+ModUtil.MOD_ID_LOWER+".noBookletInInventory"), GuiBooklet.TOOLTIP_SPLIT_LENGTH)); + } } break; }