diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java index 657e798cf..86c524f6e 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java @@ -24,6 +24,7 @@ import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipe; import net.minecraftforge.common.IPlantable; import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.ShapedOreRecipe; @@ -31,6 +32,8 @@ import net.minecraftforge.oredict.ShapelessOreRecipe; public class ItemCrafting{ + public static IRecipe recipePhantomConnector; + public static void init(){ //Rice Stuff @@ -49,30 +52,33 @@ public class ItemCrafting{ } //Leaf Blower - if(ConfigCrafting.LEAF_BLOWER.isEnabled()) + if(ConfigCrafting.LEAF_BLOWER.isEnabled()){ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemLeafBlower), " F", "IP", "IC", 'F', new ItemStack(Items.flint), 'I', "ingotIron", 'P', new ItemStack(Blocks.piston), 'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()))); + } //Drill - if(ConfigCrafting.DRILL.isEnabled()) + if(ConfigCrafting.DRILL.isEnabled()){ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrill), "DDD", "CRC", "III", 'D', "gemDiamond", 'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()), 'R', "dustRedstone", 'I', "blockIron")); + } //Tele Staff - if(ConfigCrafting.TELE_STAFF.isEnabled()) + if(ConfigCrafting.TELE_STAFF.isEnabled()){ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemTeleStaff), " E", " S ", "SB ", 'E', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ENDERPEARL_BLOCK.ordinal()), 'S', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ENDER_CASING.ordinal()), 'B', new ItemStack(InitItems.itemBattery, 1, Util.WILDCARD))); + } //Drill Speed if(ConfigCrafting.DRILL_SPEED.isEnabled()){ @@ -126,126 +132,142 @@ public class ItemCrafting{ } //Drill Silk Touch - if(ConfigCrafting.DRILL_SILK_TOUCH.isEnabled()) + if(ConfigCrafting.DRILL_SILK_TOUCH.isEnabled()){ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrillUpgradeSilkTouch), "DSD", "SCS", "DSD", 'D', "gemEmerald", 'S', "gemDiamond", 'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()))); + } //Drill Placing - if(ConfigCrafting.DRILL_PLACING.isEnabled()) + if(ConfigCrafting.DRILL_PLACING.isEnabled()){ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrillUpgradeBlockPlacing), "CEC", "RAR", "CEC", 'C', "cobblestone", 'E', Items.ender_pearl, 'A', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()), 'R', "ingotIron")); + } //Battery - if(ConfigCrafting.BATTERY.isEnabled()) + if(ConfigCrafting.BATTERY.isEnabled()){ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemBattery), " R ", "ICI", "III", 'R', "dustRedstone", 'I', "ingotIron", 'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()))); + } //Double Battery - if(ConfigCrafting.DOUBLE_BATTERY.isEnabled()) + if(ConfigCrafting.DOUBLE_BATTERY.isEnabled()){ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemBatteryDouble), " R ", "ICI", "III", 'R', new ItemStack(InitItems.itemBattery), 'I', "ingotIron", 'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()))); + } //Magnet Ring - if(ConfigCrafting.MAGNET_RING.isEnabled()) + if(ConfigCrafting.MAGNET_RING.isEnabled()){ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemMagnetRing), "RIB", "IOI", "BIR", 'R', "dustRedstone", 'I', "ingotIron", 'B', new ItemStack(Items.dye, 1, 4), 'O', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.RING.ordinal()))); + } //Growth Ring - if(ConfigCrafting.GROWTH_RING.isEnabled()) + if(ConfigCrafting.GROWTH_RING.isEnabled()){ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemGrowthRing), "SIS", "IOI", "SIS", 'S', new ItemStack(Items.wheat_seeds), 'I', "ingotIron", 'O', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.RING.ordinal()))); + } //Water Ring - if(ConfigCrafting.WATER_RING.isEnabled()) + if(ConfigCrafting.WATER_RING.isEnabled()){ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemWaterRemovalRing), "BIB", "IOI", "BIB", 'B', new ItemStack(Items.water_bucket), 'I', "ingotIron", 'O', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.RING.ordinal()))); + } //Triple Battery - if(ConfigCrafting.TRIPLE_BATTERY.isEnabled()) + if(ConfigCrafting.TRIPLE_BATTERY.isEnabled()){ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemBatteryTriple), " R ", "ICI", "III", 'R', new ItemStack(InitItems.itemBatteryDouble), 'I', "ingotIron", 'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()))); + } //Quadruple Battery - if(ConfigCrafting.QUADRUPLE_BATTERY.isEnabled()) + if(ConfigCrafting.QUADRUPLE_BATTERY.isEnabled()){ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemBatteryQuadruple), " R ", "ICI", "III", 'R', new ItemStack(InitItems.itemBatteryTriple), 'I', "ingotIron", 'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()))); + } //Quintuple Battery - if(ConfigCrafting.QUINTUPLE_BATTERY.isEnabled()) + if(ConfigCrafting.QUINTUPLE_BATTERY.isEnabled()){ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemBatteryQuintuple), " R ", "ICI", "III", 'R', new ItemStack(InitItems.itemBatteryQuadruple), 'I', "ingotIron", 'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()))); + } //Bat Wings - if(ConfigCrafting.BAT_WINGS.isEnabled()) + if(ConfigCrafting.BAT_WINGS.isEnabled()){ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemWingsOfTheBats), "WNW", "WDW", "WNW", 'W', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.BAT_WING.ordinal()), 'N', "blockDiamond", 'D', new ItemStack(Items.nether_star))); + } //Quartz - if(ConfigCrafting.QUARTZ.isEnabled()) + if(ConfigCrafting.QUARTZ.isEnabled()){ GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), new ItemStack(Items.coal), new ItemStack(Items.quartz))); + } //Coil - if(ConfigCrafting.COIL.isEnabled()) + if(ConfigCrafting.COIL.isEnabled()){ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()), " R ", "RIR", " R ", 'I', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), 'R', "dustRedstone")); + } //Cup - if(ConfigCrafting.CUP.isEnabled()) + if(ConfigCrafting.CUP.isEnabled()){ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CUP.ordinal()), "S S", "SCS", "SSS", 'S', "stone", 'C', InitItems.itemCoffeeBean)); + } //Resonant Rice - if(ConfigCrafting.RESONANT_RICE.isEnabled() && !OreDictionary.getOres("nuggetEnderium", false).isEmpty()) + if(ConfigCrafting.RESONANT_RICE.isEnabled() && !OreDictionary.getOres("nuggetEnderium", false).isEmpty()){ GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemResonantRice), new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE.ordinal()), "nuggetEnderium", Items.gunpowder)); + } //Advanced Coil - if(ConfigCrafting.ADV_COIL.isEnabled()) + if(ConfigCrafting.ADV_COIL.isEnabled()){ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()), " G ", "GCG", " G ", 'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()), 'G', "ingotGold")); + } //Ender Pearl GameRegistry.addRecipe(new ItemStack(Items.ender_pearl), @@ -258,37 +280,42 @@ public class ItemCrafting{ 'X', new ItemStack(InitItems.itemSpecialDrop, 1, TheSpecialDrops.EMERALD_SHARD.ordinal())); //Advanced Leaf Blower - if(ConfigCrafting.LEAF_BLOWER_ADVANCED.isEnabled()) + if(ConfigCrafting.LEAF_BLOWER_ADVANCED.isEnabled()){ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemLeafBlowerAdvanced), " F", "DP", "DC", 'F', new ItemStack(Items.flint), 'D', "gemDiamond", 'P', new ItemStack(Blocks.piston), 'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()))); + } //Phantom Connector - if(ConfigCrafting.PHANTOM_CONNECTOR.isEnabled()) + if(ConfigCrafting.PHANTOM_CONNECTOR.isEnabled()){ GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemPhantomConnector), "YE", "EY", "S ", 'Y', Items.ender_eye, 'E', Items.ender_pearl, 'S', "stickWood")); + recipePhantomConnector = Util.lastIRecipe(); + } //Quartz GameRegistry.addSmelting(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ORE_QUARTZ.ordinal()), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), 1F); //Knife - if(ConfigCrafting.KNIFE.isEnabled()) + if(ConfigCrafting.KNIFE.isEnabled()){ GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemKnife), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_BLADE.ordinal()), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_HANDLE.ordinal()))); + } //Crafter on a Stick - if(ConfigCrafting.STICK_CRAFTER.isEnabled()) + if(ConfigCrafting.STICK_CRAFTER.isEnabled()){ GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemCrafterOnAStick), new ItemStack(Blocks.crafting_table), new ItemStack(Items.sign))); + } //Tiny Coal GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemMisc, 8, TheMiscItems.TINY_COAL.ordinal()), @@ -334,16 +361,36 @@ public class ItemCrafting{ 'I', "ingotIron", 'D', "dustGlowstone")); - if(ConfigCrafting.RING_SPEED.isEnabled()) addRingRecipeWithStack(ThePotionRings.SPEED.craftingItem, ThePotionRings.SPEED.ordinal()); - if(ConfigCrafting.RING_HASTE.isEnabled()) addRingRecipeWithStack(ThePotionRings.HASTE.craftingItem, ThePotionRings.HASTE.ordinal()); - if(ConfigCrafting.RING_STRENGTH.isEnabled()) addRingRecipeWithStack(ThePotionRings.STRENGTH.craftingItem, ThePotionRings.STRENGTH.ordinal()); - if(ConfigCrafting.RING_JUMP_BOOST.isEnabled()) addRingRecipeWithStack(ThePotionRings.JUMP_BOOST.craftingItem, ThePotionRings.JUMP_BOOST.ordinal()); - if(ConfigCrafting.RING_REGEN.isEnabled()) addRingRecipeWithStack(ThePotionRings.REGEN.craftingItem, ThePotionRings.REGEN.ordinal()); - if(ConfigCrafting.RING_RESISTANCE.isEnabled()) addRingRecipeWithStack(ThePotionRings.RESISTANCE.craftingItem, ThePotionRings.RESISTANCE.ordinal()); - if(ConfigCrafting.RING_FIRE_RESISTANCE.isEnabled()) addRingRecipeWithStack(ThePotionRings.FIRE_RESISTANCE.craftingItem, ThePotionRings.FIRE_RESISTANCE.ordinal()); - if(ConfigCrafting.RING_WATER_BREATHING.isEnabled()) addRingRecipeWithStack(ThePotionRings.WATER_BREATHING.craftingItem, ThePotionRings.WATER_BREATHING.ordinal()); - if(ConfigCrafting.RING_INVISIBILITY.isEnabled()) addRingRecipeWithStack(ThePotionRings.INVISIBILITY.craftingItem, ThePotionRings.INVISIBILITY.ordinal()); - if(ConfigCrafting.RING_NIGHT_VISION.isEnabled()) addRingRecipeWithStack(ThePotionRings.NIGHT_VISION.craftingItem, ThePotionRings.NIGHT_VISION.ordinal()); + if(ConfigCrafting.RING_SPEED.isEnabled()){ + addRingRecipeWithStack(ThePotionRings.SPEED.craftingItem, ThePotionRings.SPEED.ordinal()); + } + if(ConfigCrafting.RING_HASTE.isEnabled()){ + addRingRecipeWithStack(ThePotionRings.HASTE.craftingItem, ThePotionRings.HASTE.ordinal()); + } + if(ConfigCrafting.RING_STRENGTH.isEnabled()){ + addRingRecipeWithStack(ThePotionRings.STRENGTH.craftingItem, ThePotionRings.STRENGTH.ordinal()); + } + if(ConfigCrafting.RING_JUMP_BOOST.isEnabled()){ + addRingRecipeWithStack(ThePotionRings.JUMP_BOOST.craftingItem, ThePotionRings.JUMP_BOOST.ordinal()); + } + if(ConfigCrafting.RING_REGEN.isEnabled()){ + addRingRecipeWithStack(ThePotionRings.REGEN.craftingItem, ThePotionRings.REGEN.ordinal()); + } + if(ConfigCrafting.RING_RESISTANCE.isEnabled()){ + addRingRecipeWithStack(ThePotionRings.RESISTANCE.craftingItem, ThePotionRings.RESISTANCE.ordinal()); + } + if(ConfigCrafting.RING_FIRE_RESISTANCE.isEnabled()){ + addRingRecipeWithStack(ThePotionRings.FIRE_RESISTANCE.craftingItem, ThePotionRings.FIRE_RESISTANCE.ordinal()); + } + if(ConfigCrafting.RING_WATER_BREATHING.isEnabled()){ + addRingRecipeWithStack(ThePotionRings.WATER_BREATHING.craftingItem, ThePotionRings.WATER_BREATHING.ordinal()); + } + if(ConfigCrafting.RING_INVISIBILITY.isEnabled()){ + addRingRecipeWithStack(ThePotionRings.INVISIBILITY.craftingItem, ThePotionRings.INVISIBILITY.ordinal()); + } + if(ConfigCrafting.RING_NIGHT_VISION.isEnabled()){ + addRingRecipeWithStack(ThePotionRings.NIGHT_VISION.craftingItem, ThePotionRings.NIGHT_VISION.ordinal()); + } } public static void addRingRecipeWithStack(ItemStack mainStack, int meta){ diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/booklet/BookletEntryAllSearch.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/booklet/BookletEntryAllSearch.java new file mode 100644 index 000000000..63507ec15 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/booklet/BookletEntryAllSearch.java @@ -0,0 +1,29 @@ +/* + * This file ("BookletEntryAllSearch.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.inventory.gui.booklet; + +import java.util.ArrayList; + +public class BookletEntryAllSearch extends BookletIndexEntry{ + + public ArrayList allChapters = new ArrayList(); + + public BookletEntryAllSearch(String unlocalizedName){ + super(unlocalizedName); + } + + @SuppressWarnings("unchecked") + @Override + public void addChapter(BookletChapter chapter){ + this.allChapters.add(chapter); + this.chapters = (ArrayList)this.allChapters.clone(); + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/booklet/GuiBooklet.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/booklet/GuiBooklet.java index 54936e32b..02b73a5ae 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/gui/booklet/GuiBooklet.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/booklet/GuiBooklet.java @@ -20,11 +20,13 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; +import java.util.ArrayList; import java.util.Collections; @SideOnly(Side.CLIENT) @@ -44,6 +46,8 @@ public class GuiBooklet extends GuiScreen{ public int pageOpenInIndex; public int indexPageAmount; + private GuiTextField searchField; + private static final int BUTTON_ACHIEVEMENTS_ID = -2; private static final int BUTTON_CONFIG_ID = -1; private static final int BUTTON_FORWARD_ID = 0; @@ -56,6 +60,46 @@ public class GuiBooklet extends GuiScreen{ this.ySize = 180; } + @Override + public void updateScreen(){ + super.updateScreen(); + this.searchField.updateCursorCounter(); + } + + @SuppressWarnings("unchecked") + @Override + public void keyTyped(char theChar, int key){ + if(key != 1 && this.searchField.isFocused()){ + this.searchField.textboxKeyTyped(theChar, key); + + if(this.currentIndexEntry == InitBooklet.allAndSearch){ + BookletEntryAllSearch currentEntry = (BookletEntryAllSearch)this.currentIndexEntry; + if(this.searchField.getText() != null && !this.searchField.getText().isEmpty()){ + currentEntry.chapters.clear(); + + for(BookletChapter chapter : currentEntry.allChapters){ + if(chapter.getLocalizedName().toLowerCase().contains(this.searchField.getText().toLowerCase())){ + currentEntry.chapters.add(chapter); + } + } + } + else{ + currentEntry.chapters = (ArrayList)currentEntry.allChapters.clone(); + } + this.openIndexEntry(this.currentIndexEntry, this.pageOpenInIndex, false); + } + } + else{ + super.keyTyped(theChar, key); + } + } + + @Override + protected void mouseClicked(int par1, int par2, int par3){ + this.searchField.mouseClicked(par1, par2, par3); + super.mouseClicked(par1, par2, par3); + } + @SuppressWarnings("unchecked") @Override public void initGui(){ @@ -75,10 +119,16 @@ public class GuiBooklet extends GuiScreen{ this.buttonList.add(new TexturedButton(BUTTON_ACHIEVEMENTS_ID, this.guiLeft+138, this.guiTop, 205, 0, 8, 8)); this.buttonList.add(new TexturedButton(BUTTON_CONFIG_ID, this.guiLeft+138, this.guiTop+10, 197, 0, 8, 8)); + this.searchField = new GuiTextField(this.unicodeRenderer, guiLeft+148, guiTop+162, 66, 10); + this.searchField.setMaxStringLength(30); + this.searchField.setEnableBackgroundDrawing(false); + this.searchField.setVisible(false); + this.currentPage = null; this.currentChapter = null; this.currentIndexEntry = null; - this.openIndexEntry(null, 1); + + this.openIndexEntry(null, 1, true); } private GuiButton getButton(int id){ @@ -96,6 +146,10 @@ public class GuiBooklet extends GuiScreen{ this.mc.getTextureManager().bindTexture(resLoc); this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize); + if(this.currentIndexEntry == InitBooklet.allAndSearch && this.currentChapter == null){ + this.drawTexturedModalRect(this.guiLeft+146, this.guiTop+160, 146, 80, 70, 14); + } + if(this.currentIndexEntry != null){ if(this.currentChapter == null){ this.drawCenteredString(this.fontRendererObj, this.currentIndexEntry.getLocalizedName(), this.guiLeft+this.xSize/2, this.guiTop-8, StringUtil.DECIMAL_COLOR_WHITE); @@ -119,6 +173,7 @@ public class GuiBooklet extends GuiScreen{ } super.drawScreen(x, y, f); + this.searchField.drawTextBox(); //Achievements Hover Text if(x >= this.guiLeft+138 && x <= this.guiLeft+138+7 && y >= this.guiTop && y <= this.guiTop+7){ @@ -171,7 +226,7 @@ public class GuiBooklet extends GuiScreen{ if(page != null) this.currentPage = page; } else{ - this.openIndexEntry(this.currentIndexEntry, this.pageOpenInIndex+1); + this.openIndexEntry(this.currentIndexEntry, this.pageOpenInIndex+1, true); } } } @@ -182,16 +237,16 @@ public class GuiBooklet extends GuiScreen{ if(page != null) this.currentPage = page; } else{ - this.openIndexEntry(this.currentIndexEntry, this.pageOpenInIndex-1); + this.openIndexEntry(this.currentIndexEntry, this.pageOpenInIndex-1, true); } } } else if(button.id == BUTTON_RETURN_ID){ if(this.currentChapter != null){ - this.openIndexEntry(this.currentIndexEntry, this.pageOpenInIndex); + this.openIndexEntry(this.currentIndexEntry, this.pageOpenInIndex, true); } else{ - this.openIndexEntry(null, 1); + this.openIndexEntry(null, 1, true); } } else if(button.id >= CHAPTER_BUTTONS_START){ @@ -205,7 +260,7 @@ public class GuiBooklet extends GuiScreen{ } else{ if(actualButton < InitBooklet.entries.size()){ - this.openIndexEntry(InitBooklet.entries.get(actualButton), 1); + this.openIndexEntry(InitBooklet.entries.get(actualButton), 1, true); } } } @@ -220,7 +275,17 @@ public class GuiBooklet extends GuiScreen{ } } - private void openIndexEntry(BookletIndexEntry entry, int page){ + @SuppressWarnings("unchecked") + private void openIndexEntry(BookletIndexEntry entry, int page, boolean resetTextField){ + if(resetTextField){ + this.searchField.setVisible(entry == InitBooklet.allAndSearch); + this.searchField.setFocused(entry == InitBooklet.allAndSearch); + this.searchField.setText(""); + if(entry == InitBooklet.allAndSearch){ + entry.chapters = (ArrayList)((BookletEntryAllSearch)entry).allChapters.clone(); + } + } + this.currentPage = null; this.currentChapter = null; @@ -244,7 +309,9 @@ public class GuiBooklet extends GuiScreen{ else{ boolean entryExists = entry.chapters.size() > i+(12*this.pageOpenInIndex-12); button.visible = entryExists; - if(entryExists) button.displayString = entry.chapters.get(i+(12*this.pageOpenInIndex-12)).getLocalizedName(); + if(entryExists){ + button.displayString = entry.chapters.get(i+(12*this.pageOpenInIndex-12)).getLocalizedName(); + } } } } @@ -252,6 +319,10 @@ public class GuiBooklet extends GuiScreen{ private void openChapter(BookletChapter chapter){ if(chapter == null) return; + this.searchField.setVisible(false); + this.searchField.setFocused(false); + this.searchField.setText(""); + this.currentChapter = chapter; this.currentPage = currentChapter.pages[0]; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/booklet/InitBooklet.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/booklet/InitBooklet.java index 648262213..95518c8c7 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/gui/booklet/InitBooklet.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/booklet/InitBooklet.java @@ -12,6 +12,7 @@ package ellpeck.actuallyadditions.inventory.gui.booklet; import ellpeck.actuallyadditions.crafting.BlockCrafting; import ellpeck.actuallyadditions.crafting.FoodCrafting; +import ellpeck.actuallyadditions.crafting.ItemCrafting; import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.metalists.TheFoods; import net.minecraft.item.ItemStack; @@ -24,12 +25,12 @@ public class InitBooklet{ public static BookletIndexEntry entryFunctionalNonRF = new BookletIndexEntry("functionalNoRF"); public static BookletIndexEntry entryMisc = new BookletIndexEntry("misc"); - public static BookletIndexEntry allAndSearch = new BookletIndexEntry("allAndSearch"); + public static BookletEntryAllSearch allAndSearch = new BookletEntryAllSearch("allAndSearch"); static{ new BookletChapter("breaker", entryFunctionalNonRF, new PageCrafting(1, BlockCrafting.recipeBreaker), new PageCrafting(2, BlockCrafting.recipePlacer), new PageCrafting(3, BlockCrafting.recipeLiquidPlacer), new PageCrafting(4, BlockCrafting.recipeLiquidCollector)); - new BookletChapter("phantomfaces", entryFunctionalNonRF, new PageText(1), new PageCrafting(2, BlockCrafting.recipePhantomface), new PageCrafting(3, BlockCrafting.recipeLiquiface), new PageCrafting(4, BlockCrafting.recipeEnergyface)); - new BookletChapter("phantomBreaker", entryFunctionalNonRF, new PageText(1), new PageCrafting(2, BlockCrafting.recipePhantomPlacer), new PageCrafting(3, BlockCrafting.recipePhantomBreaker)); + new BookletChapter("phantomfaces", entryFunctionalNonRF, new PageText(1), new PageCrafting(2, BlockCrafting.recipePhantomface), new PageCrafting(3, BlockCrafting.recipeLiquiface), new PageCrafting(4, BlockCrafting.recipeEnergyface), new PageCrafting(5, ItemCrafting.recipePhantomConnector)); + new BookletChapter("phantomBreaker", entryFunctionalNonRF, new PageText(1), new PageCrafting(2, BlockCrafting.recipePhantomPlacer), new PageCrafting(3, BlockCrafting.recipePhantomBreaker), new PageCrafting(4, ItemCrafting.recipePhantomConnector)); new BookletChapter("cloud", entryMisc, new PageText(1), new PageCrafting(2, BlockCrafting.recipeSmileyCloud)); new BookletChapter("foods", entryMisc, new PageCrafting(1, FoodCrafting.recipePizza), new PageFurnace(2, new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE_BREAD.ordinal())), new PageCrafting(3, FoodCrafting.recipeHamburger), new PageCrafting(4, FoodCrafting.recipeBigCookie), new PageCrafting(5, FoodCrafting.recipeSubSandwich), new PageCrafting(6, FoodCrafting.recipeFrenchFry), new PageCrafting(7, FoodCrafting.recipeFrenchFries), new PageCrafting(8, FoodCrafting.recipeFishNChips), new PageCrafting(9, FoodCrafting.recipeCheese), new PageCrafting(10, FoodCrafting.recipePumpkinStew), new PageCrafting(11, FoodCrafting.recipeCarrotJuice), new PageCrafting(12, FoodCrafting.recipeSpaghetti), new PageCrafting(13, FoodCrafting.recipeNoodle), new PageCrafting(14, FoodCrafting.recipeChocolate), new PageCrafting(15, FoodCrafting.recipeChocolateCake), new PageCrafting(16, FoodCrafting.recipeToast), new PageFurnace(17, new ItemStack(InitItems.itemFoods, 1, TheFoods.BAGUETTE.ordinal()))); diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index eedc693b5..e590ad0a5 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -364,7 +364,7 @@ achievement.actuallyadditions.openTreasureChest.desc=Open a Treasure Chest under booklet.actuallyadditions.indexEntry.misc.name=Miscellaneous booklet.actuallyadditions.indexEntry.functionalNoRF.name=Functional Blocks (No RF use) -booklet.actuallyadditions.indexEntry.allAndSearch.name=All Items (Search not implemented) +booklet.actuallyadditions.indexEntry.allAndSearch.name=All Items and Search booklet.actuallyadditions.recipeDisabled=The crafting recipe for this item is disabled in the Config File! If you're on a server, ask the server author to enable it in the config. If you're on a client, press the 'Open Config'-Button on the top right and enable the recipe! @@ -396,11 +396,13 @@ booklet.actuallyadditions.chapter.phantomfaces.text.1=A Phantomface is a block t booklet.actuallyadditions.chapter.phantomfaces.text.2=The normal Phantomface can connect to inventories like chests and furnaces, transfering Items into and out of them. booklet.actuallyadditions.chapter.phantomfaces.text.3=The Phantom Liquiface can connect to tanks and such, allowing all types of liquids to be pumped through. Giving it a Redstone Signal will cause it to auto-output. booklet.actuallyadditions.chapter.phantomfaces.text.4=The Phantom Energyface can connect to things like generators and crushers, allowing for RF to flow through them into and out of machines. +booklet.actuallyadditions.chapter.phantomfaces.text.5=Shift-Right-Click this onto any inventory and then on the Phantom Device to connect the two. booklet.actuallyadditions.chapter.phantomBreaker.name=Phantom Breakers & Placers booklet.actuallyadditions.chapter.phantomBreaker.text.1=Phantom Breakers and Placers have very similar mechanics to Phantomfaces: They can be connected to Blocks via Phantom Connectors and interact with the environment. Phantom Breakers and Placers only have a range of 3 blocks, however, in which they can destroy and place blocks in connected places. Shift-right-clicking will supply you with information about the connection, right-clicking normally will open its interface. booklet.actuallyadditions.chapter.phantomBreaker.text.2=The Phantom Placer places Blocks that you supply it with. booklet.actuallyadditions.chapter.phantomBreaker.text.3=The Phantom Placer breaks blocks and stores them in its internal inventory. +booklet.actuallyadditions.chapter.phantomBreaker.text.4=Shift-Right-Click this onto any inventory and then on the Phantom Device to connect the two. booklet.actuallyadditions.chapter.breaker.name=(Fluid) Placers & Breakers booklet.actuallyadditions.chapter.breaker.text.1=The Breaker breaks Blocks in front of it and stores them in its internal inventory. That's it. diff --git a/src/main/resources/assets/actuallyadditions/textures/gui/guiBooklet.png b/src/main/resources/assets/actuallyadditions/textures/gui/guiBooklet.png index 6a20f70d1..9f238aef9 100644 Binary files a/src/main/resources/assets/actuallyadditions/textures/gui/guiBooklet.png and b/src/main/resources/assets/actuallyadditions/textures/gui/guiBooklet.png differ