fix: finished util classes and removed booklet

This commit is contained in:
Michael Hillcox 2021-11-13 18:30:58 +00:00
parent 9b93760445
commit f19fa61229
33 changed files with 3486 additions and 3492 deletions

View file

@ -1,300 +1,300 @@
/* ///*
* This file ("InitBooklet.java") is part of the Actually Additions mod for Minecraft. // * This file ("InitBooklet.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed // * It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at // * under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense // * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* // *
* © 2015-2017 Ellpeck // * © 2015-2017 Ellpeck
*/ // */
//
package de.ellpeck.actuallyadditions.mod.booklet; //package de.ellpeck.actuallyadditions.mod.booklet;
//
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; //import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; //import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry; //import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; //import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe; //import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; //import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; //import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheColoredLampColors; //import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheColoredLampColors;
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks; //import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapter; //import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapter;
import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapterCoffee; //import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapterCoffee;
import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapterCrusher; //import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapterCrusher;
import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapterTrials; //import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapterTrials;
import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntry; //import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntry;
import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryAllItems; //import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryAllItems;
import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryTrials; //import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryTrials;
import de.ellpeck.actuallyadditions.mod.booklet.page.*; //import de.ellpeck.actuallyadditions.mod.booklet.page.*;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; //import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
import de.ellpeck.actuallyadditions.mod.crafting.*; //import de.ellpeck.actuallyadditions.mod.crafting.*;
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; //import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; //import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import de.ellpeck.actuallyadditions.mod.items.ItemWingsOfTheBats; //import de.ellpeck.actuallyadditions.mod.items.ItemWingsOfTheBats;
import de.ellpeck.actuallyadditions.mod.items.lens.LensDisenchanting; //import de.ellpeck.actuallyadditions.mod.items.lens.LensDisenchanting;
import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler; //import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods; //import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods;
import de.ellpeck.actuallyadditions.mod.tile.*; //import de.ellpeck.actuallyadditions.mod.tile.*;
import de.ellpeck.actuallyadditions.mod.update.UpdateChecker; //import de.ellpeck.actuallyadditions.mod.update.UpdateChecker;
import de.ellpeck.actuallyadditions.mod.util.Util; //import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.block.Blocks; //import net.minecraft.block.Blocks;
import net.minecraft.fluid.Fluid; //import net.minecraft.fluid.Fluid;
import net.minecraft.item.ItemStack; //import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; //import net.minecraft.item.Items;
import net.minecraft.item.crafting.IRecipe; //import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.Ingredient; //import net.minecraft.item.crafting.Ingredient;
import net.minecraftforge.fluids.FluidAttributes; //import net.minecraftforge.fluids.FluidAttributes;
import net.minecraftforge.fluids.FluidStack; //import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidUtil; //import net.minecraftforge.fluids.FluidUtil;
//
import java.util.ArrayList; //import java.util.ArrayList;
import java.util.Arrays; //import java.util.Arrays;
import java.util.Collections; //import java.util.Collections;
import java.util.List; //import java.util.List;
//
public final class InitBooklet { //public final class InitBooklet {
//
public static BookletChapter[] chaptersIntroduction = new BookletChapter[11]; // public static BookletChapter[] chaptersIntroduction = new BookletChapter[11];
//
public static void init() { // public static void init() {
ActuallyAdditionsAPI.entryAllAndSearch = new BookletEntryAllItems("allAndSearch").setImportant(); // ActuallyAdditionsAPI.entryAllAndSearch = new BookletEntryAllItems("allAndSearch").setImportant();
ActuallyAdditionsAPI.entryTrials = new BookletEntryTrials("trials"); // ActuallyAdditionsAPI.entryTrials = new BookletEntryTrials("trials");
//
ActuallyAdditionsAPI.entryGettingStarted = new BookletEntry("gettingStarted").setImportant(); // ActuallyAdditionsAPI.entryGettingStarted = new BookletEntry("gettingStarted").setImportant();
ActuallyAdditionsAPI.entryReconstruction = new BookletEntry("reconstruction"); // ActuallyAdditionsAPI.entryReconstruction = new BookletEntry("reconstruction");
ActuallyAdditionsAPI.entryLaserRelays = new BookletEntry("laserRelays").setSpecial(); // ActuallyAdditionsAPI.entryLaserRelays = new BookletEntry("laserRelays").setSpecial();
ActuallyAdditionsAPI.entryFunctionalNonRF = new BookletEntry("functionalNoRF"); // ActuallyAdditionsAPI.entryFunctionalNonRF = new BookletEntry("functionalNoRF");
ActuallyAdditionsAPI.entryFunctionalRF = new BookletEntry("functionalRF"); // ActuallyAdditionsAPI.entryFunctionalRF = new BookletEntry("functionalRF");
ActuallyAdditionsAPI.entryGeneratingRF = new BookletEntry("generatingRF"); // ActuallyAdditionsAPI.entryGeneratingRF = new BookletEntry("generatingRF");
ActuallyAdditionsAPI.entryItemsNonRF = new BookletEntry("itemsNoRF"); // ActuallyAdditionsAPI.entryItemsNonRF = new BookletEntry("itemsNoRF");
ActuallyAdditionsAPI.entryItemsRF = new BookletEntry("itemsRF"); // ActuallyAdditionsAPI.entryItemsRF = new BookletEntry("itemsRF");
ActuallyAdditionsAPI.entryMisc = new BookletEntry("misc"); // ActuallyAdditionsAPI.entryMisc = new BookletEntry("misc");
ActuallyAdditionsAPI.entryUpdatesAndInfos = new BookletEntry("updatesAndInfos").setSpecial(); // ActuallyAdditionsAPI.entryUpdatesAndInfos = new BookletEntry("updatesAndInfos").setSpecial();
//
initChapters(); // initChapters();
//
int chapCount = 0; // int chapCount = 0;
int pageCount = 0; // int pageCount = 0;
int infoCount = 0; // int infoCount = 0;
for (IBookletEntry entry : ActuallyAdditionsAPI.BOOKLET_ENTRIES) { // for (IBookletEntry entry : ActuallyAdditionsAPI.BOOKLET_ENTRIES) {
for (IBookletChapter chapter : entry.getAllChapters()) { // for (IBookletChapter chapter : entry.getAllChapters()) {
if (!ActuallyAdditionsAPI.ALL_CHAPTERS.contains(chapter)) { // if (!ActuallyAdditionsAPI.ALL_CHAPTERS.contains(chapter)) {
ActuallyAdditionsAPI.ALL_CHAPTERS.add(chapter); // ActuallyAdditionsAPI.ALL_CHAPTERS.add(chapter);
chapCount++; // chapCount++;
//
for (IBookletPage page : chapter.getAllPages()) { // for (IBookletPage page : chapter.getAllPages()) {
pageCount++; // pageCount++;
//
List<ItemStack> items = new ArrayList<>(); // List<ItemStack> items = new ArrayList<>();
page.getItemStacksForPage(items); // page.getItemStacksForPage(items);
List<FluidStack> fluids = new ArrayList<>(); // List<FluidStack> fluids = new ArrayList<>();
page.getFluidStacksForPage(fluids); // page.getFluidStacksForPage(fluids);
//
if (items != null && !items.isEmpty() || fluids != null && !fluids.isEmpty()) { // if (items != null && !items.isEmpty() || fluids != null && !fluids.isEmpty()) {
if (!ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA.contains(page)) { // if (!ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA.contains(page)) {
ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA.add(page); // ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA.add(page);
infoCount++; // infoCount++;
} // }
} // }
} // }
} // }
} // }
} // }
//
Collections.sort(ActuallyAdditionsAPI.BOOKLET_ENTRIES, (entry1, entry2) -> { // Collections.sort(ActuallyAdditionsAPI.BOOKLET_ENTRIES, (entry1, entry2) -> {
Integer prio1 = entry1.getSortingPriority(); // Integer prio1 = entry1.getSortingPriority();
Integer prio2 = entry2.getSortingPriority(); // Integer prio2 = entry2.getSortingPriority();
return prio2.compareTo(prio1); // return prio2.compareTo(prio1);
}); // });
Collections.sort(ActuallyAdditionsAPI.ALL_CHAPTERS, (chapter1, chapter2) -> { // Collections.sort(ActuallyAdditionsAPI.ALL_CHAPTERS, (chapter1, chapter2) -> {
Integer prio1 = chapter1.getSortingPriority(); // Integer prio1 = chapter1.getSortingPriority();
Integer prio2 = chapter2.getSortingPriority(); // Integer prio2 = chapter2.getSortingPriority();
return prio2.compareTo(prio1); // return prio2.compareTo(prio1);
}); // });
Collections.sort(ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA, (page1, page2) -> { // Collections.sort(ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA, (page1, page2) -> {
Integer prio1 = page1.getSortingPriority(); // Integer prio1 = page1.getSortingPriority();
Integer prio2 = page2.getSortingPriority(); // Integer prio2 = page2.getSortingPriority();
return prio2.compareTo(prio1); // return prio2.compareTo(prio1);
}); // });
//
ActuallyAdditions.LOGGER.info("Registered a total of " + chapCount + " booklet chapters, where " + infoCount + " out of " + pageCount + " booklet pages contain information about items or fluids!"); // ActuallyAdditions.LOGGER.info("Registered a total of " + chapCount + " booklet chapters, where " + infoCount + " out of " + pageCount + " booklet pages contain information about items or fluids!");
} // }
//
private static void initChapters() { // private static void initChapters() {
/* // /*
//Getting Started // //Getting Started
chaptersIntroduction[0] = new BookletChapter("bookTutorial", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(ActuallyItems.ITEM_BOOKLET.get()), new PageTextOnly(1), new PageTextOnly(2), new PageTextOnly(3), new PageCrafting(4, ItemCrafting.recipeBook).setNoText()); // chaptersIntroduction[0] = new BookletChapter("bookTutorial", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(ActuallyItems.ITEM_BOOKLET.get()), new PageTextOnly(1), new PageTextOnly(2), new PageTextOnly(3), new PageCrafting(4, ItemCrafting.recipeBook).setNoText());
// chaptersIntroduction[1] = new BookletChapter("videoGuide", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemMisc.get(), 1, TheMiscItems.YOUTUBE_ICON.ordinal()), new PageLinkButton(1, "https://www.youtube.com/watch?v=fhjz0Ew56pM"), new PageLinkButton(2, "https://www.youtube.com/playlist?list=PLJeFZ64pT89MrTRZYzD_rtHFajPVlt6cF")).setImportant(); // // chaptersIntroduction[1] = new BookletChapter("videoGuide", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(InitItems.itemMisc.get(), 1, TheMiscItems.YOUTUBE_ICON.ordinal()), new PageLinkButton(1, "https://www.youtube.com/watch?v=fhjz0Ew56pM"), new PageLinkButton(2, "https://www.youtube.com/playlist?list=PLJeFZ64pT89MrTRZYzD_rtHFajPVlt6cF")).setImportant();
new BookletChapter("intro", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(ActuallyItems.ITEM_BOOKLET.get()), new PageTextOnly(1), new PageTextOnly(2), new PageTextOnly(3)); // new BookletChapter("intro", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(ActuallyItems.ITEM_BOOKLET.get()), new PageTextOnly(1), new PageTextOnly(2), new PageTextOnly(3));
ArrayList<BookletPage> crystalPages = new ArrayList<>(); // ArrayList<BookletPage> crystalPages = new ArrayList<>();
crystalPages.addAll(Arrays.asList(new PageTextOnly(1).addTextReplacement("<rf>", TileEntityAtomicReconstructor.ENERGY_USE), new PageTextOnly(2), new PageTextOnly(3), new PagePicture(4, "page_atomic_reconstructor", 0).setNoText(), new PageTextOnly(5), new PageCrafting(6, BlockCrafting.recipeAtomicReconstructor).setWildcard())); // crystalPages.addAll(Arrays.asList(new PageTextOnly(1).addTextReplacement("<rf>", TileEntityAtomicReconstructor.ENERGY_USE), new PageTextOnly(2), new PageTextOnly(3), new PagePicture(4, "page_atomic_reconstructor", 0).setNoText(), new PageTextOnly(5), new PageCrafting(6, BlockCrafting.recipeAtomicReconstructor).setWildcard()));
for (int i = 0; i < LensRecipeHandler.MAIN_PAGE_RECIPES.size(); i++) { // for (int i = 0; i < LensRecipeHandler.MAIN_PAGE_RECIPES.size(); i++) {
crystalPages.add(new PageReconstructor(7 + i, LensRecipeHandler.MAIN_PAGE_RECIPES.get(i)).setNoText()); // crystalPages.add(new PageReconstructor(7 + i, LensRecipeHandler.MAIN_PAGE_RECIPES.get(i)).setNoText());
} // }
crystalPages.add(new PageCrafting(crystalPages.size() + 1, MiscCrafting.RECIPES_CRYSTALS).setNoText()); // crystalPages.add(new PageCrafting(crystalPages.size() + 1, MiscCrafting.RECIPES_CRYSTALS).setNoText());
crystalPages.add(new PageCrafting(crystalPages.size() + 1, MiscCrafting.RECIPES_CRYSTAL_BLOCKS).setNoText()); // crystalPages.add(new PageCrafting(crystalPages.size() + 1, MiscCrafting.RECIPES_CRYSTAL_BLOCKS).setNoText());
chaptersIntroduction[2] = new BookletChapter("engineerHouse", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(Items.EMERALD), new PageTextOnly(1), new PagePicture(2, "page_engineer_house", 145)); // chaptersIntroduction[2] = new BookletChapter("engineerHouse", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(Items.EMERALD), new PageTextOnly(1), new PagePicture(2, "page_engineer_house", 145));
chaptersIntroduction[6] = new BookletChapter("crystals", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get()), crystalPages.toArray(new BookletPage[crystalPages.size()])).setSpecial(); // chaptersIntroduction[6] = new BookletChapter("crystals", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get()), crystalPages.toArray(new BookletPage[crystalPages.size()])).setSpecial();
chaptersIntroduction[5] = new BookletChapter("coalGen", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(ActuallyBlocks.COAL_GENERATOR.get()), new PageTextOnly(1).addTextReplacement("<rf>", ConfigIntValues.COAL_GENERATOR_CF_PRODUCTION.getValue()), new PageCrafting(2, BlockCrafting.recipeCoalGen).setWildcard().setNoText()); // chaptersIntroduction[5] = new BookletChapter("coalGen", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(ActuallyBlocks.COAL_GENERATOR.get()), new PageTextOnly(1).addTextReplacement("<rf>", ConfigIntValues.COAL_GENERATOR_CF_PRODUCTION.getValue()), new PageCrafting(2, BlockCrafting.recipeCoalGen).setWildcard().setNoText());
ArrayList<BookletPage> empowererPages = new ArrayList<>(); // ArrayList<BookletPage> empowererPages = new ArrayList<>();
empowererPages.addAll(Arrays.asList(new PageTextOnly(1), new PagePicture(2, "page_empowerer", 137), new PageCrafting(3, BlockCrafting.recipeEmpowerer), new PageCrafting(4, BlockCrafting.recipeDisplayStand))); // empowererPages.addAll(Arrays.asList(new PageTextOnly(1), new PagePicture(2, "page_empowerer", 137), new PageCrafting(3, BlockCrafting.recipeEmpowerer), new PageCrafting(4, BlockCrafting.recipeDisplayStand)));
for (int i = 0; i < EmpowererHandler.MAIN_PAGE_RECIPES.size(); i++) { // for (int i = 0; i < EmpowererHandler.MAIN_PAGE_RECIPES.size(); i++) {
empowererPages.add(new PageEmpowerer(7 + i, EmpowererHandler.MAIN_PAGE_RECIPES.get(i)).setNoText()); // empowererPages.add(new PageEmpowerer(7 + i, EmpowererHandler.MAIN_PAGE_RECIPES.get(i)).setNoText());
} // }
empowererPages.add(new PageCrafting(empowererPages.size() + 1, MiscCrafting.RECIPES_EMPOWERED_CRYSTALS).setNoText()); // empowererPages.add(new PageCrafting(empowererPages.size() + 1, MiscCrafting.RECIPES_EMPOWERED_CRYSTALS).setNoText());
empowererPages.add(new PageCrafting(empowererPages.size() + 1, MiscCrafting.RECIPES_EMPOWERED_CRYSTAL_BLOCKS).setNoText()); // empowererPages.add(new PageCrafting(empowererPages.size() + 1, MiscCrafting.RECIPES_EMPOWERED_CRYSTAL_BLOCKS).setNoText());
new BookletChapter("empowerer", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(ActuallyBlocks.EMPOWERER.get()), empowererPages.toArray(new BookletPage[empowererPages.size()])).setSpecial(); // new BookletChapter("empowerer", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(ActuallyBlocks.EMPOWERER.get()), empowererPages.toArray(new BookletPage[empowererPages.size()])).setSpecial();
new BookletChapter("craftingIngs", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(ActuallyItems.COIL.get()), 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()); // new BookletChapter("craftingIngs", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(ActuallyItems.COIL.get()), 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());
chaptersIntroduction[4] = new BookletChapter("rf", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(Items.REDSTONE), new PageTextOnly(1), new PageTextOnly(2)).setImportant(); // chaptersIntroduction[4] = new BookletChapter("rf", ActuallyAdditionsAPI.entryGettingStarted, new ItemStack(Items.REDSTONE), new PageTextOnly(1), new PageTextOnly(2)).setImportant();
//
//Miscellaneous // //Miscellaneous
new BookletChapter("worms", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyItems.WORM.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyItems.WORM.get())), new PagePicture(2, "page_worms", 145)).setImportant(); // new BookletChapter("worms", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyItems.WORM.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyItems.WORM.get())), new PagePicture(2, "page_worms", 145)).setImportant();
new BookletChapter("lushCaves", ActuallyAdditionsAPI.entryMisc, new ItemStack(Blocks.STONE), new PageTextOnly(1), new PagePicture(2, "page_lush_caves", 0).setNoText()); // new BookletChapter("lushCaves", ActuallyAdditionsAPI.entryMisc, new ItemStack(Blocks.STONE), new PageTextOnly(1), new PagePicture(2, "page_lush_caves", 0).setNoText());
new BookletChapter("crystalClusters", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyBlocks.EMERADIC_CRYSTAL_CLUSTER.get()), new PageTextOnly(1).addItemsToPage(WorldGenLushCaves.CRYSTAL_CLUSTERS), new PageCrafting(2, MiscCrafting.RECIPES_CRYSTAL_SHARDS).setNoText(), new PageCrafting(3, MiscCrafting.RECIPES_CRYSTAL_SHARDS_BACK).setNoText()).setSpecial(); // new BookletChapter("crystalClusters", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyBlocks.EMERADIC_CRYSTAL_CLUSTER.get()), new PageTextOnly(1).addItemsToPage(WorldGenLushCaves.CRYSTAL_CLUSTERS), new PageCrafting(2, MiscCrafting.RECIPES_CRYSTAL_SHARDS).setNoText(), new PageCrafting(3, MiscCrafting.RECIPES_CRYSTAL_SHARDS_BACK).setNoText()).setSpecial();
new BookletChapter("banners", ActuallyAdditionsAPI.entryMisc, new ItemStack(Items.BLUE_BANNER, 1), new PageTextOnly(1)); // new BookletChapter("banners", ActuallyAdditionsAPI.entryMisc, new ItemStack(Items.BLUE_BANNER, 1), new PageTextOnly(1));
new BookletChapter("miscDecorStuffsAndThings", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyBlocks.ETHETIC_GREEN_BLOCK.get()), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeWhiteWall).setNoText(), new PageReconstructor(3, LensRecipeHandler.recipeGreenWall).setNoText()); // new BookletChapter("miscDecorStuffsAndThings", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyBlocks.ETHETIC_GREEN_BLOCK.get()), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeWhiteWall).setNoText(), new PageReconstructor(3, LensRecipeHandler.recipeGreenWall).setNoText());
chaptersIntroduction[3] = new BookletChapter("quartz", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyItems.BLACK_QUARTZ.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyBlocks.blockMisc, 1, TheMiscBlocks.ORE_QUARTZ.ordinal())).addTextReplacement("<lowest>", AAWorldGen.QUARTZ_MIN).addTextReplacement("<highest>", AAWorldGen.QUARTZ_MAX), new PageTextOnly(2).addItemsToPage(new ItemStack(ActuallyItems.itemBlackQuartz.get())), new PageCrafting(3, BlockCrafting.recipeQuartzBlock).setNoText(), new PageCrafting(4, BlockCrafting.recipeQuartzPillar).setNoText(), new PageCrafting(5, BlockCrafting.recipeQuartzChiseled).setNoText()); // chaptersIntroduction[3] = new BookletChapter("quartz", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyItems.BLACK_QUARTZ.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyBlocks.blockMisc, 1, TheMiscBlocks.ORE_QUARTZ.ordinal())).addTextReplacement("<lowest>", AAWorldGen.QUARTZ_MIN).addTextReplacement("<highest>", AAWorldGen.QUARTZ_MAX), new PageTextOnly(2).addItemsToPage(new ItemStack(ActuallyItems.itemBlackQuartz.get())), new PageCrafting(3, BlockCrafting.recipeQuartzBlock).setNoText(), new PageCrafting(4, BlockCrafting.recipeQuartzPillar).setNoText(), new PageCrafting(5, BlockCrafting.recipeQuartzChiseled).setNoText());
// new BookletChapter("cloud", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyBlocks.blockSmileyCloud), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeSmileyCloud).setWildcard()).setSpecial(); // // new BookletChapter("cloud", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyBlocks.blockSmileyCloud), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeSmileyCloud).setWildcard()).setSpecial();
new BookletChapter("coalStuff", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyItems.TINY_COAL.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeTinyCoal).setNoText(), new PageCrafting(3, ItemCrafting.recipeTinyChar).setNoText(), new PageCrafting(4, BlockCrafting.recipeBlockChar).setNoText()); // new BookletChapter("coalStuff", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyItems.TINY_COAL.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeTinyCoal).setNoText(), new PageCrafting(3, ItemCrafting.recipeTinyChar).setNoText(), new PageCrafting(4, BlockCrafting.recipeBlockChar).setNoText());
ArrayList<BookletPage> lampPages = new ArrayList<>(); // ArrayList<BookletPage> lampPages = new ArrayList<>();
lampPages.add(new PageTextOnly(lampPages.size() + 1)); // lampPages.add(new PageTextOnly(lampPages.size() + 1));
lampPages.add(new PageTextOnly(lampPages.size() + 1)); // lampPages.add(new PageTextOnly(lampPages.size() + 1));
lampPages.add(new PageCrafting(lampPages.size() + 1, BlockCrafting.recipePowerer).setWildcard().setNoText()); // lampPages.add(new PageCrafting(lampPages.size() + 1, BlockCrafting.recipePowerer).setWildcard().setNoText());
for (IRecipe recipe : BlockCrafting.RECIPES_LAMPS) { // for (IRecipe recipe : BlockCrafting.RECIPES_LAMPS) {
lampPages.add(new PageCrafting(lampPages.size() + 1, recipe).setNoText()); // lampPages.add(new PageCrafting(lampPages.size() + 1, recipe).setNoText());
} // }
new BookletChapter("lamps", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyBlocks.blockColoredLampOn.get(), 1, TheColoredLampColors.GREEN.ordinal()), lampPages.toArray(new BookletPage[lampPages.size()])); // new BookletChapter("lamps", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyBlocks.blockColoredLampOn.get(), 1, TheColoredLampColors.GREEN.ordinal()), lampPages.toArray(new BookletPage[lampPages.size()]));
new BookletChapter("enderStar", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyItems.ENDER_STAR.get()), new PageCrafting(1, ItemCrafting.recipeEnderStar)); // new BookletChapter("enderStar", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyItems.ENDER_STAR.get()), new PageCrafting(1, ItemCrafting.recipeEnderStar));
new BookletChapter("spawnerShard", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyItems.SPAWNER_SHARD.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyItems.SPAWNER_SHARD.get()))); // new BookletChapter("spawnerShard", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyItems.SPAWNER_SHARD.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyItems.SPAWNER_SHARD.get())));
// new BookletChapter("treasureChest", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockTreasureChest.get()), new PagePicture(1, "page_treasure_chest", 150).addItemsToPage(new ItemStack(InitBlocks.blockTreasureChest.get())), new PageTextOnly(2)).setSpecial(); // // new BookletChapter("treasureChest", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockTreasureChest.get()), new PagePicture(1, "page_treasure_chest", 150).addItemsToPage(new ItemStack(InitBlocks.blockTreasureChest.get())), new PageTextOnly(2)).setSpecial();
new BookletChapter("hairBalls", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyItems.HAIRY_BALL.get()), new PagePicture(1, "page_fur_balls", 110).addItemsToPage(new ItemStack(ActuallyItems.HAIRY_BALL.get())), new PageTextOnly(2)).setSpecial(); // new BookletChapter("hairBalls", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyItems.HAIRY_BALL.get()), new PagePicture(1, "page_fur_balls", 110).addItemsToPage(new ItemStack(ActuallyItems.HAIRY_BALL.get())), new PageTextOnly(2)).setSpecial();
// new BookletChapter("blackLotus", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockBlackLotus.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(InitBlocks.blockBlackLotus.get())), new PageCrafting(2, ItemCrafting.recipeBlackDye)); // // new BookletChapter("blackLotus", ActuallyAdditionsAPI.entryMisc, new ItemStack(InitBlocks.blockBlackLotus.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(InitBlocks.blockBlackLotus.get())), new PageCrafting(2, ItemCrafting.recipeBlackDye));
new BookletChapter("waterBowl", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyItems.WATER_BOWL.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyItems.WATER_BOWL.get()))); // new BookletChapter("waterBowl", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyItems.WATER_BOWL.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyItems.WATER_BOWL.get())));
new BookletChapter("tinyTorch", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyBlocks.TINY_TORCH.get()), new PageCrafting(1, BlockCrafting.recipesTinyTorch).setWildcard()).setSpecial(); // new BookletChapter("tinyTorch", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyBlocks.TINY_TORCH.get()), new PageCrafting(1, BlockCrafting.recipesTinyTorch).setWildcard()).setSpecial();
//
//Reconstruction // //Reconstruction
chaptersIntroduction[7] = new BookletChapter("reconstructorLenses", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(ActuallyItems.LENS.get()), new PageTextOnly(1)).setImportant(); // chaptersIntroduction[7] = new BookletChapter("reconstructorLenses", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(ActuallyItems.LENS.get()), new PageTextOnly(1)).setImportant();
new BookletChapter("additionalRecipes", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(Items.LEATHER), new PageReconstructor(1, LensRecipeHandler.recipeSoulSand).setNoText(), new PageReconstructor(2, LensRecipeHandler.recipeLeather).setNoText(), new PageReconstructor(3, LensRecipeHandler.recipeNetherWart).setNoText(), new PageReconstructor(4, LensRecipeHandler.recipePrismarine).setNoText()).setSpecial(); // new BookletChapter("additionalRecipes", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(Items.LEATHER), new PageReconstructor(1, LensRecipeHandler.recipeSoulSand).setNoText(), new PageReconstructor(2, LensRecipeHandler.recipeLeather).setNoText(), new PageReconstructor(3, LensRecipeHandler.recipeNetherWart).setNoText(), new PageReconstructor(4, LensRecipeHandler.recipePrismarine).setNoText()).setSpecial();
new BookletChapter("bookSplitting", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(Items.ENCHANTED_BOOK), new PageTextOnly(1), new PageReconstructor(2, new LensConversionRecipe(Ingredient.fromItem(Items.ENCHANTED_BOOK), new ItemStack(Items.ENCHANTED_BOOK), 0, ActuallyAdditionsAPI.lensDefaultConversion)).setNoText()); // new BookletChapter("bookSplitting", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(Items.ENCHANTED_BOOK), new PageTextOnly(1), new PageReconstructor(2, new LensConversionRecipe(Ingredient.fromItem(Items.ENCHANTED_BOOK), new ItemStack(Items.ENCHANTED_BOOK), 0, ActuallyAdditionsAPI.lensDefaultConversion)).setNoText());
new BookletChapter("lensColor", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(ActuallyItems.COLOR_LENS.get()), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeColorLens).setNoText()); // new BookletChapter("lensColor", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(ActuallyItems.COLOR_LENS.get()), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeColorLens).setNoText());
new BookletChapter("lensDeath", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(ActuallyItems.DAMAGE_LENS.get()), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeDamageLens).setNoText()); // new BookletChapter("lensDeath", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(ActuallyItems.DAMAGE_LENS.get()), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeDamageLens).setNoText());
new BookletChapter("lensMoreDeath", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(ActuallyItems.MORE_DAMAGE_LENS.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLensMoreDeath).setNoText()); // new BookletChapter("lensMoreDeath", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(ActuallyItems.MORE_DAMAGE_LENS.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLensMoreDeath).setNoText());
new BookletChapter("lensDetonation", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(ActuallyItems.EXPLOSION_LENS.get()), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeExplosionLens).setNoText()); // new BookletChapter("lensDetonation", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(ActuallyItems.EXPLOSION_LENS.get()), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeExplosionLens).setNoText());
new BookletChapter("lensDisenchanting", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(ActuallyItems.DISENCHANTING_LENS.get()), new PageTextOnly(1).addTextReplacement("<energy>", LensDisenchanting.ENERGY_USE), new PageCrafting(2, ItemCrafting.recipeDisenchantingLens).setNoText()).setSpecial(); // new BookletChapter("lensDisenchanting", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(ActuallyItems.DISENCHANTING_LENS.get()), new PageTextOnly(1).addTextReplacement("<energy>", LensDisenchanting.ENERGY_USE), new PageCrafting(2, ItemCrafting.recipeDisenchantingLens).setNoText()).setSpecial();
new BookletChapter("lensMining", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(ActuallyItems.MINING_LENS.get()), new PageTextOnly(1).addTextReplacement("<energy>", ConfigIntValues.MINING_LENS_USE.getValue()), new PageCrafting(2, ItemCrafting.recipeMiningLens).setNoText()).setImportant(); // new BookletChapter("lensMining", ActuallyAdditionsAPI.entryReconstruction, new ItemStack(ActuallyItems.MINING_LENS.get()), new PageTextOnly(1).addTextReplacement("<energy>", ConfigIntValues.MINING_LENS_USE.getValue()), new PageCrafting(2, ItemCrafting.recipeMiningLens).setNoText()).setImportant();
//
//Laser Relays // //Laser Relays
chaptersIntroduction[8] = new BookletChapter("laserIntro", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyItems.LASER_WRENCH.get()), new PageTextOnly(1), new PageTextOnly(2).addTextReplacement("<range>", TileEntityLaserRelay.MAX_DISTANCE), new PageCrafting(3, ItemCrafting.recipeLaserWrench)).setImportant(); // chaptersIntroduction[8] = new BookletChapter("laserIntro", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyItems.LASER_WRENCH.get()), new PageTextOnly(1), new PageTextOnly(2).addTextReplacement("<range>", TileEntityLaserRelay.MAX_DISTANCE), new PageCrafting(3, ItemCrafting.recipeLaserWrench)).setImportant();
new BookletChapter("laserRelays", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyBlocks.LASER_RELAY.get()), new PageTextOnly(1), new PageTextOnly(2).addTextReplacement("<cap1>", TileEntityLaserRelayEnergy.CAP).addTextReplacement("<cap2>", TileEntityLaserRelayEnergyAdvanced.CAP).addTextReplacement("<cap3>", TileEntityLaserRelayEnergyExtreme.CAP), new PagePicture(3, "page_laser_relay", 0).setNoText(), new PageCrafting(4, BlockCrafting.recipeLaserRelay).setWildcard().setNoText(), new PageCrafting(5, BlockCrafting.recipeLaserRelayAdvanced).setWildcard().setNoText(), new PageCrafting(6, BlockCrafting.recipeLaserRelayExtreme).setWildcard().setNoText()); // new BookletChapter("laserRelays", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyBlocks.LASER_RELAY.get()), new PageTextOnly(1), new PageTextOnly(2).addTextReplacement("<cap1>", TileEntityLaserRelayEnergy.CAP).addTextReplacement("<cap2>", TileEntityLaserRelayEnergyAdvanced.CAP).addTextReplacement("<cap3>", TileEntityLaserRelayEnergyExtreme.CAP), new PagePicture(3, "page_laser_relay", 0).setNoText(), new PageCrafting(4, BlockCrafting.recipeLaserRelay).setWildcard().setNoText(), new PageCrafting(5, BlockCrafting.recipeLaserRelayAdvanced).setWildcard().setNoText(), new PageCrafting(6, BlockCrafting.recipeLaserRelayExtreme).setWildcard().setNoText());
new BookletChapter("fluidLaser", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyBlocks.LASER_RELAY_FLUIDS.get()), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeFluidLaser).setWildcard().setNoText()); // new BookletChapter("fluidLaser", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyBlocks.LASER_RELAY_FLUIDS.get()), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeFluidLaser).setWildcard().setNoText());
new BookletChapter("itemRelays", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyBlocks.LASER_RELAY_ITEM.get()), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeItemLaser).setWildcard().setNoText()).setSpecial(); // new BookletChapter("itemRelays", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyBlocks.LASER_RELAY_ITEM.get()), new PageTextOnly(1), new PageReconstructor(2, LensRecipeHandler.recipeItemLaser).setWildcard().setNoText()).setSpecial();
new BookletChapter("itemInterfaces", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyBlocks.ITEM_VIEWER.get()), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, BlockCrafting.recipeItemInterface).setNoText()); // new BookletChapter("itemInterfaces", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyBlocks.ITEM_VIEWER.get()), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, BlockCrafting.recipeItemInterface).setNoText());
new BookletChapter("itemRelaysAdvanced", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyBlocks.LASER_RELAY_ITEM_ADVANCED.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeLaserRelayItemWhitelist).setWildcard()); // new BookletChapter("itemRelaysAdvanced", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyBlocks.LASER_RELAY_ITEM_ADVANCED.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeLaserRelayItemWhitelist).setWildcard());
new BookletChapter("itemInterfacesHopping", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyBlocks.ITEM_VIEWER_HOPPING.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeItemInterfaceHopping).setWildcard().setNoText()); // new BookletChapter("itemInterfacesHopping", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyBlocks.ITEM_VIEWER_HOPPING.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeItemInterfaceHopping).setWildcard().setNoText());
new BookletChapter("laserUpgradeInvisibility", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyItems.LASER_UPGRADE_INVISIBILITY.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLaserUpgradeInvisibility).setNoText()).setImportant(); // new BookletChapter("laserUpgradeInvisibility", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyItems.LASER_UPGRADE_INVISIBILITY.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLaserUpgradeInvisibility).setNoText()).setImportant();
new BookletChapter("laserUpgradeRange", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyItems.LASER_UPGRADE_RANGE.get()), new PageTextOnly(1).addTextReplacement("<def>", TileEntityLaserRelay.MAX_DISTANCE).addTextReplacement("<upgraded>", TileEntityLaserRelay.MAX_DISTANCE_RANGED), new PageCrafting(2, ItemCrafting.recipeLaserUpgradeRange).setNoText()).setImportant(); // new BookletChapter("laserUpgradeRange", ActuallyAdditionsAPI.entryLaserRelays, new ItemStack(ActuallyItems.LASER_UPGRADE_RANGE.get()), new PageTextOnly(1).addTextReplacement("<def>", TileEntityLaserRelay.MAX_DISTANCE).addTextReplacement("<upgraded>", TileEntityLaserRelay.MAX_DISTANCE_RANGED), new PageCrafting(2, ItemCrafting.recipeLaserUpgradeRange).setNoText()).setImportant();
//
//No RF Using Blocks // //No RF Using Blocks
new BookletChapter("breaker", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.BREAKER.get()), new PageCrafting(1, BlockCrafting.recipeBreaker).setWildcard(), new PageCrafting(2, BlockCrafting.recipePlacer).setWildcard(), new PageCrafting(3, BlockCrafting.recipeLiquidPlacer).setWildcard(), new PageCrafting(4, BlockCrafting.recipeLiquidCollector).setWildcard()); // new BookletChapter("breaker", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.BREAKER.get()), new PageCrafting(1, BlockCrafting.recipeBreaker).setWildcard(), new PageCrafting(2, BlockCrafting.recipePlacer).setWildcard(), new PageCrafting(3, BlockCrafting.recipeLiquidPlacer).setWildcard(), new PageCrafting(4, BlockCrafting.recipeLiquidCollector).setWildcard());
new BookletChapter("dropper", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.DROPPER.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeDropper).setNoText()); // new BookletChapter("dropper", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.DROPPER.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeDropper).setNoText());
new BookletChapter("phantomfaces", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.PHANTOM_LIQUIFACE.get()), new PageTextOnly(1).addTextReplacement("<range>", TileEntityPhantomFace.RANGE), new PageTextOnly(2), new PageCrafting(3, BlockCrafting.recipePhantomface), new PageCrafting(4, BlockCrafting.recipeLiquiface), new PageCrafting(5, BlockCrafting.recipeEnergyface), new PageCrafting(6, ItemCrafting.recipePhantomConnector).setNoText(), new PageCrafting(7, BlockCrafting.recipePhantomBooster)).setImportant(); // new BookletChapter("phantomfaces", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.PHANTOM_LIQUIFACE.get()), new PageTextOnly(1).addTextReplacement("<range>", TileEntityPhantomFace.RANGE), new PageTextOnly(2), new PageCrafting(3, BlockCrafting.recipePhantomface), new PageCrafting(4, BlockCrafting.recipeLiquiface), new PageCrafting(5, BlockCrafting.recipeEnergyface), new PageCrafting(6, ItemCrafting.recipePhantomConnector).setNoText(), new PageCrafting(7, BlockCrafting.recipePhantomBooster)).setImportant();
new BookletChapter("phantomRedstoneface", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.PHANTOM_REDSTONEFACE.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipePhantomRedstoneface).setNoText()); // new BookletChapter("phantomRedstoneface", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.PHANTOM_REDSTONEFACE.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipePhantomRedstoneface).setNoText());
new BookletChapter("phantomBreaker", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.PHANTOM_BREAKER.get()), new PageTextOnly(1).addTextReplacement("<range>", TileEntityPhantomPlacer.RANGE), new PageCrafting(2, BlockCrafting.recipePhantomPlacer).setNoText(), new PageCrafting(3, BlockCrafting.recipePhantomBreaker).setNoText()); // new BookletChapter("phantomBreaker", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.PHANTOM_BREAKER.get()), new PageTextOnly(1).addTextReplacement("<range>", TileEntityPhantomPlacer.RANGE), new PageCrafting(2, BlockCrafting.recipePhantomPlacer).setNoText(), new PageCrafting(3, BlockCrafting.recipePhantomBreaker).setNoText());
new BookletChapter("esd", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.INPUTTER_ADVANCED.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeESD).setNoText(), new PageCrafting(3, BlockCrafting.recipeAdvancedESD).setNoText()).setSpecial(); // new BookletChapter("esd", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.INPUTTER_ADVANCED.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeESD).setNoText(), new PageCrafting(3, BlockCrafting.recipeAdvancedESD).setNoText()).setSpecial();
new BookletChapter("xpSolidifier", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.XP_SOLIDIFIER.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyItems.SOLIDIFIED_EXPERIENCE.get())), new PageCrafting(2, BlockCrafting.recipeSolidifier).setNoText()).setImportant(); // new BookletChapter("xpSolidifier", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.XP_SOLIDIFIER.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyItems.SOLIDIFIED_EXPERIENCE.get())), new PageCrafting(2, BlockCrafting.recipeSolidifier).setNoText()).setImportant();
new BookletChapter("greenhouseGlass", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.GREENHOUSE_GLASS.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeGlass)); // new BookletChapter("greenhouseGlass", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.GREENHOUSE_GLASS.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeGlass));
new BookletChapter("feeder", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.FEEDER.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeFeeder).setNoText()); // new BookletChapter("feeder", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.FEEDER.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeFeeder).setNoText());
new BookletChapter("crate", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.blockGiantChest.get()), new PageCrafting(1, BlockCrafting.recipeCrate), new PageCrafting(2, BlockCrafting.recipeCrateMedium).setNoText(), new PageCrafting(3, BlockCrafting.recipeCrateLarge).setNoText(), new PageCrafting(4, ItemCrafting.recipeCrateKeeper), new PageCrafting(5, ItemCrafting.recipeChestToCrateUpgrade), new PageCrafting(6, ItemCrafting.recipeSmallToMediumCrateUpgrade), new PageCrafting(7, ItemCrafting.recipeMediumToLargeCrateUpgrade)); // new BookletChapter("crate", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.blockGiantChest.get()), new PageCrafting(1, BlockCrafting.recipeCrate), new PageCrafting(2, BlockCrafting.recipeCrateMedium).setNoText(), new PageCrafting(3, BlockCrafting.recipeCrateLarge).setNoText(), new PageCrafting(4, ItemCrafting.recipeCrateKeeper), new PageCrafting(5, ItemCrafting.recipeChestToCrateUpgrade), new PageCrafting(6, ItemCrafting.recipeSmallToMediumCrateUpgrade), new PageCrafting(7, ItemCrafting.recipeMediumToLargeCrateUpgrade));
new BookletChapter("rangedCollector", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.RANGED_COLLECTOR.get()), new PageTextOnly(1).addTextReplacement("<range>", TileEntityRangedCollector.RANGE), new PageCrafting(2, BlockCrafting.recipeRangedCollector).setNoText()); // new BookletChapter("rangedCollector", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyBlocks.RANGED_COLLECTOR.get()), new PageTextOnly(1).addTextReplacement("<range>", TileEntityRangedCollector.RANGE), new PageCrafting(2, BlockCrafting.recipeRangedCollector).setNoText());
//
//RF Using Blocks // //RF Using Blocks
new BookletChapter("fireworkBox", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.FIREWORK_BOX.get()), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityFireworkBox.USE_PER_SHOT), new PageCrafting(2, BlockCrafting.recipeFireworkBox)).setSpecial(); // new BookletChapter("fireworkBox", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.FIREWORK_BOX.get()), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityFireworkBox.USE_PER_SHOT), new PageCrafting(2, BlockCrafting.recipeFireworkBox)).setSpecial();
new BookletChapter("batteryBox", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.BATTERY_BOX.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeBatteryBox).setNoText()).setSpecial(); // new BookletChapter("batteryBox", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.BATTERY_BOX.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeBatteryBox).setNoText()).setSpecial();
new BookletChapter("farmer", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.FARMER.get()), new PageTextOnly(1), new PagePicture(2, "page_farmer_crops", 95).addItemsToPage(new ItemStack(Items.WHEAT_SEEDS)).addItemsToPage(new ItemStack(ActuallyItems.CANOLA_SEED.get())), new PagePicture(3, "page_farmer_cactus", 105).addItemsToPage(new ItemStack(Blocks.CACTUS)), new PagePicture(4, "page_farmer_wart", 95).addItemsToPage(new ItemStack(Items.NETHER_WART)), new PagePicture(5, "page_farmer_reeds", 105).addItemsToPage(new ItemStack(Items.REEDS)), new PagePicture(6, "page_farmer_melons", 105).addItemsToPage(new ItemStack(Items.MELON), new ItemStack(Blocks.PUMPKIN), new ItemStack(Blocks.MELON_BLOCK)), new PagePicture(7, "page_farmer_enderlilly", 105), new PagePicture(8, "page_farmer_redorchid", 105), new PageCrafting(4, BlockCrafting.recipeFarmer).setWildcard().setNoText()).setImportant(); // new BookletChapter("farmer", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.FARMER.get()), new PageTextOnly(1), new PagePicture(2, "page_farmer_crops", 95).addItemsToPage(new ItemStack(Items.WHEAT_SEEDS)).addItemsToPage(new ItemStack(ActuallyItems.CANOLA_SEED.get())), new PagePicture(3, "page_farmer_cactus", 105).addItemsToPage(new ItemStack(Blocks.CACTUS)), new PagePicture(4, "page_farmer_wart", 95).addItemsToPage(new ItemStack(Items.NETHER_WART)), new PagePicture(5, "page_farmer_reeds", 105).addItemsToPage(new ItemStack(Items.REEDS)), new PagePicture(6, "page_farmer_melons", 105).addItemsToPage(new ItemStack(Items.MELON), new ItemStack(Blocks.PUMPKIN), new ItemStack(Blocks.MELON_BLOCK)), new PagePicture(7, "page_farmer_enderlilly", 105), new PagePicture(8, "page_farmer_redorchid", 105), new PageCrafting(4, BlockCrafting.recipeFarmer).setWildcard().setNoText()).setImportant();
new BookletChapter("miner", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.VERTICAL_DIGGER.get()), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityVerticalDigger.ENERGY_USE_PER_BLOCK).addTextReplacement("<range>", TileEntityVerticalDigger.DEFAULT_RANGE), new PageCrafting(2, BlockCrafting.recipeMiner)).setSpecial(); // new BookletChapter("miner", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.VERTICAL_DIGGER.get()), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityVerticalDigger.ENERGY_USE_PER_BLOCK).addTextReplacement("<range>", TileEntityVerticalDigger.DEFAULT_RANGE), new PageCrafting(2, BlockCrafting.recipeMiner)).setSpecial();
new BookletChapterCoffee("coffeeMachine", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.COFFEE_MACHINE.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyItems.COFFEE_BEANS.get())).addTextReplacement("<rf>", TileEntityCoffeeMachine.ENERGY_USED).addTextReplacement("<coffee>", TileEntityCoffeeMachine.CACHE_USE).addTextReplacement("<water>", TileEntityCoffeeMachine.WATER_USE), new PageTextOnly(2).addItemsToPage(new ItemStack(ActuallyItems.COFFEE.get())), new PagePicture(3, "page_coffee_machine", 115), new PageCrafting(4, BlockCrafting.recipeCoffeeMachine).setWildcard().setNoText(), new PageCrafting(5, ItemCrafting.recipeCup).setNoText()).setImportant(); // new BookletChapterCoffee("coffeeMachine", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.COFFEE_MACHINE.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyItems.COFFEE_BEANS.get())).addTextReplacement("<rf>", TileEntityCoffeeMachine.ENERGY_USED).addTextReplacement("<coffee>", TileEntityCoffeeMachine.CACHE_USE).addTextReplacement("<water>", TileEntityCoffeeMachine.WATER_USE), new PageTextOnly(2).addItemsToPage(new ItemStack(ActuallyItems.COFFEE.get())), new PagePicture(3, "page_coffee_machine", 115), new PageCrafting(4, BlockCrafting.recipeCoffeeMachine).setWildcard().setNoText(), new PageCrafting(5, ItemCrafting.recipeCup).setNoText()).setImportant();
//
List<IBookletPage> list = new ArrayList<>(); // List<IBookletPage> list = new ArrayList<>();
list.add(new PageTextOnly(1).addTextReplacement("<rf>", TileEntityCrusher.ENERGY_USE)); // list.add(new PageTextOnly(1).addTextReplacement("<rf>", TileEntityCrusher.ENERGY_USE));
list.add(new PageCrafting(2, BlockCrafting.recipeCrusher).setWildcard().setNoText()); // list.add(new PageCrafting(2, BlockCrafting.recipeCrusher).setWildcard().setNoText());
list.add(new PageCrafting(3, BlockCrafting.recipeDoubleCrusher).setWildcard().setNoText()); // list.add(new PageCrafting(3, BlockCrafting.recipeDoubleCrusher).setWildcard().setNoText());
if (CrusherCrafting.recipeIronHorseArmor != null) { // if (CrusherCrafting.recipeIronHorseArmor != null) {
list.add(new PageCrusherRecipe(4, CrusherCrafting.recipeIronHorseArmor).setNoText()); // list.add(new PageCrusherRecipe(4, CrusherCrafting.recipeIronHorseArmor).setNoText());
} // }
if (CrusherCrafting.recipeGoldHorseArmor != null) { // if (CrusherCrafting.recipeGoldHorseArmor != null) {
list.add(new PageCrusherRecipe(5, CrusherCrafting.recipeGoldHorseArmor).setNoText()); // list.add(new PageCrusherRecipe(5, CrusherCrafting.recipeGoldHorseArmor).setNoText());
} // }
if (CrusherCrafting.recipeDiamondHorseArmor != null) { // if (CrusherCrafting.recipeDiamondHorseArmor != null) {
list.add(new PageCrusherRecipe(6, CrusherCrafting.recipeDiamondHorseArmor).setNoText()); // list.add(new PageCrusherRecipe(6, CrusherCrafting.recipeDiamondHorseArmor).setNoText());
} // }
//
new BookletChapterCrusher("crusher", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.CRUSHER_DOUBLE.get()), list.toArray(new IBookletPage[0])); // new BookletChapterCrusher("crusher", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.CRUSHER_DOUBLE.get()), list.toArray(new IBookletPage[0]));
new BookletChapter("furnaceDouble", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.POWERED_FURNACE.get()), new PageCrafting(1, BlockCrafting.recipeFurnace).setWildcard().addTextReplacement("<rf>", TileEntityPoweredFurnace.ENERGY_USE)); // new BookletChapter("furnaceDouble", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.POWERED_FURNACE.get()), new PageCrafting(1, BlockCrafting.recipeFurnace).setWildcard().addTextReplacement("<rf>", TileEntityPoweredFurnace.ENERGY_USE));
new BookletChapter("lavaFactory", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.LAVA_FACTORY_CONTROLLER.get()), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityLavaFactoryController.ENERGY_USE), new PagePicture(2, "page_lava_factory", 0).setNoText(), new PageCrafting(3, BlockCrafting.recipeLavaFactory).setNoText(), new PageCrafting(4, BlockCrafting.recipeCasing).setNoText()); // new BookletChapter("lavaFactory", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.LAVA_FACTORY_CONTROLLER.get()), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityLavaFactoryController.ENERGY_USE), new PagePicture(2, "page_lava_factory", 0).setNoText(), new PageCrafting(3, BlockCrafting.recipeLavaFactory).setNoText(), new PageCrafting(4, BlockCrafting.recipeCasing).setNoText());
new BookletChapter("energizer", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.ENERGIZER.get()), new PageCrafting(1, BlockCrafting.recipeEnergizer), new PageCrafting(2, BlockCrafting.recipeEnervator)); // new BookletChapter("energizer", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.ENERGIZER.get()), new PageCrafting(1, BlockCrafting.recipeEnergizer), new PageCrafting(2, BlockCrafting.recipeEnervator));
// new BookletChapter("repairer", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockItemRepairer.get()), new PageCrafting(1, BlockCrafting.recipeRepairer).addTextReplacement("<rf>", TileEntityItemRepairer.ENERGY_USE)); // // new BookletChapter("repairer", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(InitBlocks.blockItemRepairer.get()), new PageCrafting(1, BlockCrafting.recipeRepairer).addTextReplacement("<rf>", TileEntityItemRepairer.ENERGY_USE));
new BookletChapter("longRangeBreaker", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.LONG_RANGE_BREAKER.get()), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityLongRangeBreaker.ENERGY_USE).addTextReplacement("<range>", TileEntityLongRangeBreaker.RANGE), new PageCrafting(2, BlockCrafting.recipeDirectionalBreaker).setWildcard()); // new BookletChapter("longRangeBreaker", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.LONG_RANGE_BREAKER.get()), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityLongRangeBreaker.ENERGY_USE).addTextReplacement("<range>", TileEntityLongRangeBreaker.RANGE), new PageCrafting(2, BlockCrafting.recipeDirectionalBreaker).setWildcard());
new BookletChapter("playerInterface", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.PLAYER_INTERFACE.get()), new PageTextOnly(1).addTextReplacement("<range>", TileEntityPlayerInterface.DEFAULT_RANGE), new PageCrafting(2, BlockCrafting.recipePlayerInterface).setNoText()).setSpecial(); // new BookletChapter("playerInterface", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.PLAYER_INTERFACE.get()), new PageTextOnly(1).addTextReplacement("<range>", TileEntityPlayerInterface.DEFAULT_RANGE), new PageCrafting(2, BlockCrafting.recipePlayerInterface).setNoText()).setSpecial();
new BookletChapter("displayStand", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.DISPLAY_STAND.get()), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, BlockCrafting.recipeDisplayStand).setNoText()).setSpecial(); // new BookletChapter("displayStand", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.DISPLAY_STAND.get()), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, BlockCrafting.recipeDisplayStand).setNoText()).setSpecial();
new BookletChapter("shockSuppressor", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.SHOCK_SUPPRESSOR.get()), new PageTextOnly(1).addTextReplacement("<range>", TileEntityShockSuppressor.RANGE).addTextReplacement("<rf>", TileEntityShockSuppressor.USE_PER), new PageCrafting(2, BlockCrafting.recipeShockSuppressor)); // new BookletChapter("shockSuppressor", ActuallyAdditionsAPI.entryFunctionalRF, new ItemStack(ActuallyBlocks.SHOCK_SUPPRESSOR.get()), new PageTextOnly(1).addTextReplacement("<range>", TileEntityShockSuppressor.RANGE).addTextReplacement("<rf>", TileEntityShockSuppressor.USE_PER), new PageCrafting(2, BlockCrafting.recipeShockSuppressor));
//
//RF Generating Blocks // //RF Generating Blocks
// new BookletChapter("solarPanel", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(ActuallyBlocks.blockFurnaceSolar.get()), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityFurnaceSolar.PRODUCE), new PageCrafting(2, BlockCrafting.recipeSolar).setNoText()); // // new BookletChapter("solarPanel", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(ActuallyBlocks.blockFurnaceSolar.get()), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityFurnaceSolar.PRODUCE), new PageCrafting(2, BlockCrafting.recipeSolar).setNoText());
new BookletChapter("heatCollector", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(ActuallyBlocks.HEAT_COLLECTOR.get()), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityHeatCollector.ENERGY_PRODUCE).addTextReplacement("<min>", TileEntityHeatCollector.BLOCKS_NEEDED), new PageCrafting(2, BlockCrafting.recipeHeatCollector).setNoText()); // new BookletChapter("heatCollector", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(ActuallyBlocks.HEAT_COLLECTOR.get()), new PageTextOnly(1).addTextReplacement("<rf>", TileEntityHeatCollector.ENERGY_PRODUCE).addTextReplacement("<min>", TileEntityHeatCollector.BLOCKS_NEEDED), new PageCrafting(2, BlockCrafting.recipeHeatCollector).setNoText());
new BookletChapter("canola", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(ActuallyBlocks.FERMENTING_BARREL.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyItems.CANOLA.get())).addItemsToPage(new ItemStack(ActuallyItems.CANOLA_SEED.get())).addFluidToPage(InitFluids.fluidCanolaOil), new PageTextOnly(2).addFluidToPage(InitFluids.fluidRefinedCanolaOil).addFluidToPage(InitFluids.fluidCrystalOil).addFluidToPage(InitFluids.fluidEmpoweredOil), new PageCrafting(3, BlockCrafting.recipeCanolaPress).setNoText(), new PageCrafting(4, BlockCrafting.recipeFermentingBarrel), new PageCrafting(5, BlockCrafting.recipeOilGen), new PageReconstructor(6, LensRecipeHandler.recipeCrystallizedCanolaSeed).setNoText(), new PageEmpowerer(7, EmpowererHandler.recipeEmpoweredCanolaSeed).setNoText()); // new BookletChapter("canola", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(ActuallyBlocks.FERMENTING_BARREL.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyItems.CANOLA.get())).addItemsToPage(new ItemStack(ActuallyItems.CANOLA_SEED.get())).addFluidToPage(InitFluids.fluidCanolaOil), new PageTextOnly(2).addFluidToPage(InitFluids.fluidRefinedCanolaOil).addFluidToPage(InitFluids.fluidCrystalOil).addFluidToPage(InitFluids.fluidEmpoweredOil), new PageCrafting(3, BlockCrafting.recipeCanolaPress).setNoText(), new PageCrafting(4, BlockCrafting.recipeFermentingBarrel), new PageCrafting(5, BlockCrafting.recipeOilGen), new PageReconstructor(6, LensRecipeHandler.recipeCrystallizedCanolaSeed).setNoText(), new PageEmpowerer(7, EmpowererHandler.recipeEmpoweredCanolaSeed).setNoText());
new BookletChapter("leafGen", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(ActuallyBlocks.LEAF_GENERATOR.get()), new PageTextOnly(1).addTextReplacement("<rf>", ConfigIntValues.LEAF_GENERATOR_CF_PER_LEAF.getValue()).addTextReplacement("<range>", ConfigIntValues.LEAF_GENERATOR_AREA.getValue()), new PageCrafting(2, BlockCrafting.recipeLeafGen)).setImportant(); // new BookletChapter("leafGen", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(ActuallyBlocks.LEAF_GENERATOR.get()), new PageTextOnly(1).addTextReplacement("<rf>", ConfigIntValues.LEAF_GENERATOR_CF_PER_LEAF.getValue()).addTextReplacement("<range>", ConfigIntValues.LEAF_GENERATOR_AREA.getValue()), new PageCrafting(2, BlockCrafting.recipeLeafGen)).setImportant();
new BookletChapter("bioReactor", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(ActuallyBlocks.BIOREACTOR.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeBioReactor).setNoText()).setSpecial(); // new BookletChapter("bioReactor", ActuallyAdditionsAPI.entryGeneratingRF, new ItemStack(ActuallyBlocks.BIOREACTOR.get()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeBioReactor).setNoText()).setSpecial();
//
//No RF Using Items // //No RF Using Items
chaptersIntroduction[9] = new BookletChapter("goggles", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.ENGINEER_GOGGLES.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeGoggles).setNoText(), new PageCrafting(3, ItemCrafting.recipeGogglesAdvanced).setNoText()).setImportant(); // chaptersIntroduction[9] = new BookletChapter("goggles", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.ENGINEER_GOGGLES.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeGoggles).setNoText(), new PageCrafting(3, ItemCrafting.recipeGogglesAdvanced).setNoText()).setImportant();
new BookletChapter("bags", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.BAG.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeBag), new PageCrafting(3, ItemCrafting.recipeVoidBag).setNoText()).setImportant(); // new BookletChapter("bags", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.BAG.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeBag), new PageCrafting(3, ItemCrafting.recipeVoidBag).setNoText()).setImportant();
new BookletChapter("wings", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.WINGS_OF_THE_BATS.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyItems.BAT_WING.get())).addTextReplacement("<secs>", ItemWingsOfTheBats.MAX_FLY_TIME / 20), new PageCrafting(2, ItemCrafting.recipeWings).setNoText()).setSpecial(); // new BookletChapter("wings", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.WINGS_OF_THE_BATS.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyItems.BAT_WING.get())).addTextReplacement("<secs>", ItemWingsOfTheBats.MAX_FLY_TIME / 20), new PageCrafting(2, ItemCrafting.recipeWings).setNoText()).setSpecial();
new BookletChapter("foods", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.FOOD.get(), 1, TheFoods.HAMBURGER.ordinal()), new PageCrafting(1, FoodCrafting.recipeBacon).setNoText(), new PageFurnace(2, new ItemStack(ActuallyItems.FOOD.get(), 1, TheFoods.RICE_BREAD.ordinal())).setNoText(), new PageCrafting(3, FoodCrafting.recipeHamburger).setNoText(), new PageCrafting(4, FoodCrafting.recipeBigCookie).setNoText(), new PageCrafting(5, FoodCrafting.recipeSubSandwich).setNoText(), new PageCrafting(6, FoodCrafting.recipeFrenchFry).setNoText(), new PageCrafting(7, FoodCrafting.recipeFrenchFries).setNoText(), new PageCrafting(8, FoodCrafting.recipeFishNChips).setNoText(), new PageCrafting(9, FoodCrafting.recipeCheese).setNoText(), new PageCrafting(10, FoodCrafting.recipePumpkinStew).setNoText(), new PageCrafting(11, FoodCrafting.recipeCarrotJuice).setNoText(), new PageCrafting(12, FoodCrafting.recipeSpaghetti).setNoText(), new PageCrafting(13, FoodCrafting.recipeNoodle).setNoText(), new PageCrafting(14, FoodCrafting.recipeChocolate).setNoText(), new PageCrafting(15, FoodCrafting.recipeChocolateCake).setNoText(), new PageCrafting(16, FoodCrafting.recipeToast).setNoText(), new PageFurnace(17, new ItemStack(ActuallyItems.FOOD.get(), 1, TheFoods.BAGUETTE.ordinal())).setNoText(), new PageCrafting(18, FoodCrafting.recipeChocolateToast).setNoText(), new PageCrafting(1, FoodCrafting.recipePizza).setNoText()); // new BookletChapter("foods", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.FOOD.get(), 1, TheFoods.HAMBURGER.ordinal()), new PageCrafting(1, FoodCrafting.recipeBacon).setNoText(), new PageFurnace(2, new ItemStack(ActuallyItems.FOOD.get(), 1, TheFoods.RICE_BREAD.ordinal())).setNoText(), new PageCrafting(3, FoodCrafting.recipeHamburger).setNoText(), new PageCrafting(4, FoodCrafting.recipeBigCookie).setNoText(), new PageCrafting(5, FoodCrafting.recipeSubSandwich).setNoText(), new PageCrafting(6, FoodCrafting.recipeFrenchFry).setNoText(), new PageCrafting(7, FoodCrafting.recipeFrenchFries).setNoText(), new PageCrafting(8, FoodCrafting.recipeFishNChips).setNoText(), new PageCrafting(9, FoodCrafting.recipeCheese).setNoText(), new PageCrafting(10, FoodCrafting.recipePumpkinStew).setNoText(), new PageCrafting(11, FoodCrafting.recipeCarrotJuice).setNoText(), new PageCrafting(12, FoodCrafting.recipeSpaghetti).setNoText(), new PageCrafting(13, FoodCrafting.recipeNoodle).setNoText(), new PageCrafting(14, FoodCrafting.recipeChocolate).setNoText(), new PageCrafting(15, FoodCrafting.recipeChocolateCake).setNoText(), new PageCrafting(16, FoodCrafting.recipeToast).setNoText(), new PageFurnace(17, new ItemStack(ActuallyItems.FOOD.get(), 1, TheFoods.BAGUETTE.ordinal())).setNoText(), new PageCrafting(18, FoodCrafting.recipeChocolateToast).setNoText(), new PageCrafting(1, FoodCrafting.recipePizza).setNoText());
new BookletChapter("leafBlower", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.LEAF_BLOWER_ADVANCED.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLeafBlower).setNoText(), new PageCrafting(3, ItemCrafting.recipeLeafBlowerAdvanced).setNoText()).setImportant(); // new BookletChapter("leafBlower", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.LEAF_BLOWER_ADVANCED.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLeafBlower).setNoText(), new PageCrafting(3, ItemCrafting.recipeLeafBlowerAdvanced).setNoText()).setImportant();
new BookletChapter("playerProbe", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.PLAYER_PROBE.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipePlayerProbe).setNoText()).setSpecial(); // new BookletChapter("playerProbe", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.PLAYER_PROBE.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipePlayerProbe).setNoText()).setSpecial();
ArrayList<BookletPage> aiotPages = new ArrayList<>(); // ArrayList<BookletPage> aiotPages = new ArrayList<>();
aiotPages.add(new PageTextOnly(aiotPages.size() + 1)); // aiotPages.add(new PageTextOnly(aiotPages.size() + 1));
for (IRecipe recipe : ToolCrafting.RECIPES_PAXELS) { // for (IRecipe recipe : ToolCrafting.RECIPES_PAXELS) {
aiotPages.add(new PageCrafting(aiotPages.size() + 1, recipe).setWildcard().setNoText()); // aiotPages.add(new PageCrafting(aiotPages.size() + 1, recipe).setWildcard().setNoText());
} // }
new BookletChapter("aiots", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.emeraldPaxel.get()), aiotPages.toArray(new BookletPage[aiotPages.size()])).setImportant(); // new BookletChapter("aiots", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.emeraldPaxel.get()), aiotPages.toArray(new BookletPage[aiotPages.size()])).setImportant();
//
new BookletChapter("jams", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.JAM.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyItems.JAM.get(), 1, Util.WILDCARD)), new PagePicture(2, "page_jam_house", 150), new PageTextOnly(3)); // new BookletChapter("jams", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.JAM.get()), new PageTextOnly(1).addItemsToPage(new ItemStack(ActuallyItems.JAM.get(), 1, Util.WILDCARD)), new PagePicture(2, "page_jam_house", 150), new PageTextOnly(3));
//
ArrayList<BookletPage> potionRingPages = new ArrayList<>(); // ArrayList<BookletPage> potionRingPages = new ArrayList<>();
potionRingPages.add(new PageTextOnly(potionRingPages.size() + 1)); // potionRingPages.add(new PageTextOnly(potionRingPages.size() + 1));
for (IRecipe recipe : ItemCrafting.RECIPES_POTION_RINGS) { // for (IRecipe recipe : ItemCrafting.RECIPES_POTION_RINGS) {
potionRingPages.add(new PageCrafting(potionRingPages.size() + 1, recipe).setNoText()); // potionRingPages.add(new PageCrafting(potionRingPages.size() + 1, recipe).setNoText());
} // }
new BookletChapter("potionRings", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.POTION_RING.get()), potionRingPages.toArray(new BookletPage[potionRingPages.size()])); // new BookletChapter("potionRings", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.POTION_RING.get()), potionRingPages.toArray(new BookletPage[potionRingPages.size()]));
new BookletChapter("itemFilter", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyItems.FILTER.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeFilter).setNoText()).setImportant(); // new BookletChapter("itemFilter", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyItems.FILTER.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeFilter).setNoText()).setImportant();
//
//RF Using Items // //RF Using Items
new BookletChapter("drill", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(ActuallyItems.DRILL.get(), 1, TheColoredLampColors.LIGHT_BLUE.ordinal()), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, ItemCrafting.recipeDrill).setNoText(), new PageCrafting(4, ItemCrafting.RECIPES_DRILL_COLORING), new PageCrafting(4, ItemCrafting.recipeDrillCore).setNoText(), new PageCrafting(5, ItemCrafting.recipeDrillSpeedI).setNoText(), new PageCrafting(6, ItemCrafting.recipeDrillSpeedII).setNoText(), new PageCrafting(7, ItemCrafting.recipeDrillSpeedIII).setNoText(), new PageCrafting(8, ItemCrafting.recipeDrillFortuneI).setNoText(), new PageCrafting(9, ItemCrafting.recipeDrillFortuneII).setNoText(), new PageCrafting(10, ItemCrafting.recipeDrillSilk).setNoText(), new PageCrafting(11, ItemCrafting.recipeDrillThree).setNoText(), new PageCrafting(12, ItemCrafting.recipeDrillFive).setNoText(), new PageCrafting(13, ItemCrafting.recipeDrillPlacing).setNoText()).setSpecial(); // new BookletChapter("drill", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(ActuallyItems.DRILL.get(), 1, TheColoredLampColors.LIGHT_BLUE.ordinal()), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, ItemCrafting.recipeDrill).setNoText(), new PageCrafting(4, ItemCrafting.RECIPES_DRILL_COLORING), new PageCrafting(4, ItemCrafting.recipeDrillCore).setNoText(), new PageCrafting(5, ItemCrafting.recipeDrillSpeedI).setNoText(), new PageCrafting(6, ItemCrafting.recipeDrillSpeedII).setNoText(), new PageCrafting(7, ItemCrafting.recipeDrillSpeedIII).setNoText(), new PageCrafting(8, ItemCrafting.recipeDrillFortuneI).setNoText(), new PageCrafting(9, ItemCrafting.recipeDrillFortuneII).setNoText(), new PageCrafting(10, ItemCrafting.recipeDrillSilk).setNoText(), new PageCrafting(11, ItemCrafting.recipeDrillThree).setNoText(), new PageCrafting(12, ItemCrafting.recipeDrillFive).setNoText(), new PageCrafting(13, ItemCrafting.recipeDrillPlacing).setNoText()).setSpecial();
new BookletChapter("fillingWand", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(ActuallyItems.FILLING_WAND.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeFillingWand).setNoText()).setSpecial(); // new BookletChapter("fillingWand", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(ActuallyItems.FILLING_WAND.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeFillingWand).setNoText()).setSpecial();
new BookletChapter("staff", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(ActuallyItems.TELE_STAFF.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeStaff).setNoText()).setImportant(); // new BookletChapter("staff", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(ActuallyItems.TELE_STAFF.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeStaff).setNoText()).setImportant();
new BookletChapter("magnetRing", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(ActuallyItems.MAGNET_RING.get()), new PageCrafting(1, ItemCrafting.recipeMagnetRing)); // new BookletChapter("magnetRing", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(ActuallyItems.MAGNET_RING.get()), new PageCrafting(1, ItemCrafting.recipeMagnetRing));
new BookletChapter("growthRing", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(ActuallyItems.GROWTH_RING.get()), new PageCrafting(1, ItemCrafting.recipeGrowthRing)); // new BookletChapter("growthRing", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(ActuallyItems.GROWTH_RING.get()), new PageCrafting(1, ItemCrafting.recipeGrowthRing));
new BookletChapter("waterRemovalRing", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(ActuallyItems.WATER_REMOVAL_RING.get()), new PageCrafting(1, ItemCrafting.recipeWaterRing)); // new BookletChapter("waterRemovalRing", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(ActuallyItems.WATER_REMOVAL_RING.get()), new PageCrafting(1, ItemCrafting.recipeWaterRing));
new BookletChapter("batteries", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(ActuallyItems.BATTERY_TRIPLE.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeBattery).setNoText(), new PageCrafting(3, ItemCrafting.recipeBatteryDouble).setNoText(), new PageCrafting(4, ItemCrafting.recipeBatteryTriple).setNoText(), new PageCrafting(5, ItemCrafting.recipeBatteryQuadruple).setNoText(), new PageCrafting(6, ItemCrafting.recipeBatteryQuintuple).setNoText()); // new BookletChapter("batteries", ActuallyAdditionsAPI.entryItemsRF, new ItemStack(ActuallyItems.BATTERY_TRIPLE.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeBattery).setNoText(), new PageCrafting(3, ItemCrafting.recipeBatteryDouble).setNoText(), new PageCrafting(4, ItemCrafting.recipeBatteryTriple).setNoText(), new PageCrafting(5, ItemCrafting.recipeBatteryQuadruple).setNoText(), new PageCrafting(6, ItemCrafting.recipeBatteryQuintuple).setNoText());
//
//Updates and infos // //Updates and infos
new BookletChapter("changelog", ActuallyAdditionsAPI.entryUpdatesAndInfos, new ItemStack(Items.CLOCK), new PageLinkButton(1, UpdateChecker.CHANGELOG_LINK)); // new BookletChapter("changelog", ActuallyAdditionsAPI.entryUpdatesAndInfos, new ItemStack(Items.CLOCK), new PageLinkButton(1, UpdateChecker.CHANGELOG_LINK));
new BookletChapter("curse", ActuallyAdditionsAPI.entryUpdatesAndInfos, new ItemStack(Items.FLINT_AND_STEEL), new PageLinkButton(1, "http://ellpeck.de/actadd")); // new BookletChapter("curse", ActuallyAdditionsAPI.entryUpdatesAndInfos, new ItemStack(Items.FLINT_AND_STEEL), new PageLinkButton(1, "http://ellpeck.de/actadd"));
new BookletChapter("patreon", ActuallyAdditionsAPI.entryUpdatesAndInfos, new ItemStack(ActuallyItems.EMERADIC_CRYSTAL.get(), 1), new PageLinkButton(1, "http://patreon.com/Ellpeck"), new PagePicture(2, "page_patreon", 153)).setImportant(); // new BookletChapter("patreon", ActuallyAdditionsAPI.entryUpdatesAndInfos, new ItemStack(ActuallyItems.EMERADIC_CRYSTAL.get(), 1), new PageLinkButton(1, "http://patreon.com/Ellpeck"), new PagePicture(2, "page_patreon", 153)).setImportant();
new BookletChapter("website", ActuallyAdditionsAPI.entryUpdatesAndInfos, new ItemStack(ActuallyItems.ITEM_BOOKLET.get()), new PageLinkButton(1, "http://ellpeck.de")); // new BookletChapter("website", ActuallyAdditionsAPI.entryUpdatesAndInfos, new ItemStack(ActuallyItems.ITEM_BOOKLET.get()), new PageLinkButton(1, "http://ellpeck.de"));
//
//Trials // //Trials
chaptersIntroduction[10] = new BookletChapter("trialsIntro", ActuallyAdditionsAPI.entryTrials, new ItemStack(Items.GOLD_INGOT), new PageTextOnly(1), new PageTextOnly(2)).setSpecial(); // chaptersIntroduction[10] = new BookletChapter("trialsIntro", ActuallyAdditionsAPI.entryTrials, new ItemStack(Items.GOLD_INGOT), new PageTextOnly(1), new PageTextOnly(2)).setSpecial();
new BookletChapterTrials("crystalProduction", new ItemStack(ActuallyItems.EMERADIC_CRYSTAL.get()), false); // new BookletChapterTrials("crystalProduction", new ItemStack(ActuallyItems.EMERADIC_CRYSTAL.get()), false);
new BookletChapterTrials("leatherProduction", new ItemStack(Items.LEATHER), false); // new BookletChapterTrials("leatherProduction", new ItemStack(Items.LEATHER), false);
new BookletChapterTrials("crystalOil", FluidUtil.getFilledBucket(new FluidStack(InitFluids.fluidCrystalOil, FluidAttributes.BUCKET_VOLUME)), false); // new BookletChapterTrials("crystalOil", FluidUtil.getFilledBucket(new FluidStack(InitFluids.fluidCrystalOil, FluidAttributes.BUCKET_VOLUME)), false);
new BookletChapterTrials("autoDisenchanter", new ItemStack(ActuallyItems.DISENCHANTING_LENS.get()), false); // new BookletChapterTrials("autoDisenchanter", new ItemStack(ActuallyItems.DISENCHANTING_LENS.get()), false);
new BookletChapterTrials("empoweredOil", FluidUtil.getFilledBucket(new FluidStack(InitFluids.fluidEmpoweredOil, FluidAttributes.BUCKET_VOLUME)), false); // new BookletChapterTrials("empoweredOil", FluidUtil.getFilledBucket(new FluidStack(InitFluids.fluidEmpoweredOil, FluidAttributes.BUCKET_VOLUME)), false);
new BookletChapterTrials("mobFarm", new ItemStack(Items.ROTTEN_FLESH), false); // new BookletChapterTrials("mobFarm", new ItemStack(Items.ROTTEN_FLESH), false);
new BookletChapterTrials("empowererAutomation", new ItemStack(ActuallyBlocks.EMPOWERER.get()), false); // new BookletChapterTrials("empowererAutomation", new ItemStack(ActuallyBlocks.EMPOWERER.get()), false);
//
*/ // */
} // }
} //}

View file

@ -1,119 +1,119 @@
/* ///*
* This file ("BookmarkButton.java") is part of the Actually Additions mod for Minecraft. // * This file ("BookmarkButton.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed // * It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at // * under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense // * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* // *
* © 2015-2017 Ellpeck // * © 2015-2017 Ellpeck
*/ // */
//
package de.ellpeck.actuallyadditions.mod.booklet.button; //package de.ellpeck.actuallyadditions.mod.booklet.button;
//
import com.mojang.blaze3d.matrix.MatrixStack; //import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager; //import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; //import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; //import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; //import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; //import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiPage; //import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiPage;
import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils; //import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; //import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; //import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; //import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.Minecraft; //import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.Screen; //import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.button.Button; //import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.item.ItemStack; //import net.minecraft.item.ItemStack;
import net.minecraft.util.text.StringTextComponent; //import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting; //import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.api.distmarker.Dist; //import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; //import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.client.gui.GuiUtils; //import net.minecraftforge.fml.client.gui.GuiUtils;
//
import java.util.ArrayList; //import java.util.ArrayList;
import java.util.List; //import java.util.List;
import java.util.stream.Collectors; //import java.util.stream.Collectors;
//
@OnlyIn(Dist.CLIENT) //@OnlyIn(Dist.CLIENT)
public class BookmarkButton extends Button { //public class BookmarkButton extends Button {
//
private final GuiBooklet booklet; // private final GuiBooklet booklet;
public IBookletPage assignedPage; // public IBookletPage assignedPage;
//
public BookmarkButton(int x, int y, GuiBooklet booklet) { // public BookmarkButton(int x, int y, GuiBooklet booklet) {
super(x, y, 16, 16, StringTextComponent.EMPTY, btn -> { // super(x, y, 16, 16, StringTextComponent.EMPTY, btn -> {
BookmarkButton button = (BookmarkButton) btn; // BookmarkButton button = (BookmarkButton) btn;
if (button.assignedPage != null) { // if (button.assignedPage != null) {
if (Screen.hasShiftDown()) { // if (Screen.hasShiftDown()) {
button.assignedPage = null; // button.assignedPage = null;
} else if (!(button.booklet instanceof GuiPage) || ((GuiPage) button.booklet).pages[0] != button.assignedPage) { // } else if (!(button.booklet instanceof GuiPage) || ((GuiPage) button.booklet).pages[0] != button.assignedPage) {
GuiPage gui = BookletUtils.createPageGui(button.booklet.previousScreen, button.booklet, button.assignedPage); // GuiPage gui = BookletUtils.createPageGui(button.booklet.previousScreen, button.booklet, button.assignedPage);
Minecraft.getInstance().setScreen(gui); // Minecraft.getInstance().setScreen(gui);
} // }
} else { // } else {
if (button.booklet instanceof GuiPage) { // if (button.booklet instanceof GuiPage) {
button.assignedPage = ((GuiPage) button.booklet).pages[0]; // button.assignedPage = ((GuiPage) button.booklet).pages[0];
} // }
} // }
}); // });
this.booklet = booklet; // this.booklet = booklet;
} // }
//
@Override // @Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) { // public void render(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) {
if (this.visible) { // if (this.visible) {
Minecraft.getInstance().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS); // Minecraft.getInstance().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS);
GlStateManager._color4f(1.0F, 1.0F, 1.0F, 1.0F); // GlStateManager._color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.isHovered = mouseX >= this.x && mouseY >= this.y && this.x < this.x + this.width && this.y < this.y + this.height; // this.isHovered = mouseX >= this.x && mouseY >= this.y && this.x < this.x + this.width && this.y < this.y + this.height;
int offset = this.isHovered // int offset = this.isHovered
? 1 // ? 1
: 0; // : 0;
//
GlStateManager._enableBlend(); // GlStateManager._enableBlend();
GlStateManager._blendFuncSeparate(770, 771, 1, 0); // GlStateManager._blendFuncSeparate(770, 771, 1, 0);
GlStateManager._blendFunc(770, 771); // GlStateManager._blendFunc(770, 771);
int renderHeight = 25; // int renderHeight = 25;
this.blit(matrices, this.x, this.y, 224 + (this.assignedPage == null // this.blit(matrices, this.x, this.y, 224 + (this.assignedPage == null
? 0 // ? 0
: 16), 14 - renderHeight + offset * renderHeight, this.width, renderHeight); // : 16), 14 - renderHeight + offset * renderHeight, this.width, renderHeight);
//
// TODO: FIX THIS // // TODO: FIX THIS
// this.mouseDragged(minecraft, mouseX, mouseY); // // this.mouseDragged(minecraft, mouseX, mouseY);
//
if (this.assignedPage != null) { // if (this.assignedPage != null) {
ItemStack display = this.assignedPage.getChapter().getDisplayItemStack(); // ItemStack display = this.assignedPage.getChapter().getDisplayItemStack();
if (StackUtil.isValid(display)) { // if (StackUtil.isValid(display)) {
GlStateManager._pushMatrix(); // GlStateManager._pushMatrix();
AssetUtil.renderStackToGui(display, this.x + 2, this.y + 1, 0.725F); // AssetUtil.renderStackToGui(display, this.x + 2, this.y + 1, 0.725F);
GlStateManager._popMatrix(); // GlStateManager._popMatrix();
} // }
} // }
} // }
} // }
//
public void drawHover(MatrixStack stack, int mouseX, int mouseY) { // public void drawHover(MatrixStack stack, int mouseX, int mouseY) {
if (this.isMouseOver(mouseX, mouseY)) { // if (this.isMouseOver(mouseX, mouseY)) {
List<String> list = new ArrayList<>(); // List<String> list = new ArrayList<>();
//
if (this.assignedPage != null) { // if (this.assignedPage != null) {
IBookletChapter chapter = this.assignedPage.getChapter(); // IBookletChapter chapter = this.assignedPage.getChapter();
//
list.add(TextFormatting.GOLD + chapter.getLocalizedName() + ", Page " + (chapter.getPageIndex(this.assignedPage) + 1)); // list.add(TextFormatting.GOLD + chapter.getLocalizedName() + ", Page " + (chapter.getPageIndex(this.assignedPage) + 1));
list.add(StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.bookmark.openDesc")); // list.add(StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.bookmark.openDesc"));
list.add(TextFormatting.ITALIC + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.bookmark.removeDesc")); // list.add(TextFormatting.ITALIC + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.bookmark.removeDesc"));
} else { // } else {
list.add(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.noBookmark.name")); // list.add(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.noBookmark.name"));
//
if (this.booklet instanceof GuiPage) { // if (this.booklet instanceof GuiPage) {
list.add(StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.noBookmark.pageDesc")); // list.add(StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.noBookmark.pageDesc"));
} else { // } else {
list.add(StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.noBookmark.notPageDesc")); // list.add(StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.noBookmark.notPageDesc"));
} // }
} // }
//
Minecraft mc = Minecraft.getInstance(); // Minecraft mc = Minecraft.getInstance();
GuiUtils.drawHoveringText(stack, list.stream().map(StringTextComponent::new).collect(Collectors.toList()), mouseX, mouseY, mc.screen.width, mc.screen.height, -1, mc.font); // GuiUtils.drawHoveringText(stack, list.stream().map(StringTextComponent::new).collect(Collectors.toList()), mouseX, mouseY, mc.screen.width, mc.screen.height, -1, mc.font);
} // }
} // }
} //}

View file

@ -1,67 +1,67 @@
/* ///*
* This file ("EntryButton.java") is part of the Actually Additions mod for Minecraft. // * This file ("EntryButton.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed // * It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at // * under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense // * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* // *
* © 2015-2017 Ellpeck // * © 2015-2017 Ellpeck
*/ // */
//
package de.ellpeck.actuallyadditions.mod.booklet.button; //package de.ellpeck.actuallyadditions.mod.booklet.button;
//
import com.mojang.blaze3d.platform.GlStateManager; //import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; //import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; //import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; //import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; //import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.Minecraft; //import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.widget.button.Button; //import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.item.ItemStack; //import net.minecraft.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist; //import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; //import net.minecraftforge.api.distmarker.OnlyIn;
//
//
@OnlyIn(Dist.CLIENT) //@OnlyIn(Dist.CLIENT)
public class EntryButton extends Button { //public class EntryButton extends Button {
//
private final GuiBookletBase gui; // private final GuiBookletBase gui;
private final ItemStack stackToRender; // private final ItemStack stackToRender;
//
public EntryButton(GuiBookletBase gui, int id, int x, int y, int width, int height, String text, ItemStack stackToRender) { // public EntryButton(GuiBookletBase gui, int id, int x, int y, int width, int height, String text, ItemStack stackToRender) {
super(id, x, y, width, height, text); // super(id, x, y, width, height, text);
this.gui = gui; // this.gui = gui;
StackUtil.isValid(stackToRender); // StackUtil.isValid(stackToRender);
this.stackToRender = stackToRender; // this.stackToRender = stackToRender;
} // }
//
@Override // @Override
public void drawButton(Minecraft minecraft, int mouseX, int mouseY, float f) { // public void drawButton(Minecraft minecraft, int mouseX, int mouseY, float f) {
if (this.visible) { // if (this.visible) {
GlStateManager.color3arg(1.0F, 1.0F, 1.0F, 1.0F); // GlStateManager.color3arg(1.0F, 1.0F, 1.0F, 1.0F);
this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height; // this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
GlStateManager._enableBlend(); // GlStateManager._enableBlend();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); // GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GlStateManager._blendFunc(770, 771); // GlStateManager._blendFunc(770, 771);
this.mouseDragged(minecraft, mouseX, mouseY); // this.mouseDragged(minecraft, mouseX, mouseY);
//
int textOffsetX = 0; // int textOffsetX = 0;
if (StackUtil.isValid(this.stackToRender)) { // if (StackUtil.isValid(this.stackToRender)) {
GlStateManager._pushMatrix(); // GlStateManager._pushMatrix();
AssetUtil.renderStackToGui(this.stackToRender, this.x - 4, this.y, 0.725F); // AssetUtil.renderStackToGui(this.stackToRender, this.x - 4, this.y, 0.725F);
GlStateManager._popMatrix(); // GlStateManager._popMatrix();
textOffsetX = 10; // textOffsetX = 10;
} // }
//
float scale = this.gui.getMediumFontSize(); // float scale = this.gui.getMediumFontSize();
//
if (this.hovered) { // if (this.hovered) {
GlStateManager._pushMatrix(); // GlStateManager._pushMatrix();
AssetUtil.drawHorizontalGradientRect(this.x + textOffsetX - 1, this.y + this.height - 1, this.x + (int) (minecraft.font.width(this.displayString) * scale) + textOffsetX + 1, this.y + this.height, 0x80 << 24 | 22271, 22271, this.zLevel); // AssetUtil.drawHorizontalGradientRect(this.x + textOffsetX - 1, this.y + this.height - 1, this.x + (int) (minecraft.font.width(this.displayString) * scale) + textOffsetX + 1, this.y + this.height, 0x80 << 24 | 22271, 22271, this.zLevel);
GlStateManager._popMatrix(); // GlStateManager._popMatrix();
} // }
//
StringUtil.renderScaledAsciiString(minecraft.font, this.displayString, this.x + textOffsetX, this.y + 2 + (this.height - 8) / 2, 0, false, scale); // StringUtil.renderScaledAsciiString(minecraft.font, this.displayString, this.x + textOffsetX, this.y + 2 + (this.height - 8) / 2, 0, false, scale);
} // }
} // }
} //}

View file

@ -1,52 +1,52 @@
/* ///*
* This file ("TrialsButton.java") is part of the Actually Additions mod for Minecraft. // * This file ("TrialsButton.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed // * It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at // * under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense // * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* // *
* © 2015-2017 Ellpeck // * © 2015-2017 Ellpeck
*/ // */
//
package de.ellpeck.actuallyadditions.mod.booklet.button; //package de.ellpeck.actuallyadditions.mod.booklet.button;
//
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; //import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; //import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
import de.ellpeck.actuallyadditions.mod.inventory.gui.TexturedButton; //import de.ellpeck.actuallyadditions.mod.inventory.gui.TexturedButton;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; //import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.Minecraft; //import net.minecraft.client.Minecraft;
//
import net.minecraft.client.gui.widget.button.Button.IPressable; //import net.minecraft.client.gui.widget.button.Button.IPressable;
//
public class TrialsButton extends TexturedButton { //public class TrialsButton extends TexturedButton {
//
private final boolean isTrials; // private final boolean isTrials;
//
public TrialsButton(GuiBooklet gui, IPressable action) { // public TrialsButton(GuiBooklet gui, IPressable action) {
super(GuiBooklet.RES_LOC_GADGETS, gui.getGuiLeft() + gui.getSizeX(), gui.getGuiTop() + 10, 0, 204, 52, 16, action); // super(GuiBooklet.RES_LOC_GADGETS, gui.getGuiLeft() + gui.getSizeX(), gui.getGuiTop() + 10, 0, 204, 52, 16, action);
this.isTrials = gui.areTrialsOpened(); // this.isTrials = gui.areTrialsOpened();
this.active = !this.isTrials; // this.active = !this.isTrials;
} // }
//
@Override // @Override
public void drawButton(Minecraft minecraft, int x, int y, float f) { // public void drawButton(Minecraft minecraft, int x, int y, float f) {
super.drawButton(minecraft, x, y, f); // super.drawButton(minecraft, x, y, f);
//
if (this.visible) { // if (this.visible) {
if (this.isHovered || this.isTrials) { // if (this.isHovered || this.isTrials) {
this.drawCenteredString(minecraft.font, StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".trialsButton.name"), this.x + (this.width - 8) / 2, this.y + (this.height - 8) / 2, 14737632); // this.drawCenteredString(minecraft.font, StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".trialsButton.name"), this.x + (this.width - 8) / 2, this.y + (this.height - 8) / 2, 14737632);
} // }
} // }
} // }
//
@Override // @Override
protected int getHoverState(boolean mouseOver) { // protected int getHoverState(boolean mouseOver) {
if (mouseOver || this.isTrials) { // if (mouseOver || this.isTrials) {
return 2; // return 2;
} else if (!this.active) { // } else if (!this.active) {
return 0; // return 0;
} else { // } else {
return 1; // return 1;
} // }
} // }
} //}

View file

@ -1,110 +1,110 @@
/* ///*
* This file ("BookletChapter.java") is part of the Actually Additions mod for Minecraft. // * This file ("BookletChapter.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed // * It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at // * under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense // * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* // *
* © 2015-2017 Ellpeck // * © 2015-2017 Ellpeck
*/ // */
//
package de.ellpeck.actuallyadditions.mod.booklet.chapter; //package de.ellpeck.actuallyadditions.mod.booklet.chapter;
//
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; //import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry; //import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; //import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
import de.ellpeck.actuallyadditions.api.misc.IDisableableItem; //import de.ellpeck.actuallyadditions.api.misc.IDisableableItem;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; //import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; //import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.item.ItemStack; //import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextFormatting; //import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.api.distmarker.Dist; //import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; //import net.minecraftforge.api.distmarker.OnlyIn;
//
public class BookletChapter implements IBookletChapter { //public class BookletChapter implements IBookletChapter {
//
public final IBookletPage[] pages; // public final IBookletPage[] pages;
public final IBookletEntry entry; // public final IBookletEntry entry;
public final ItemStack displayStack; // public final ItemStack displayStack;
private final String identifier; // private final String identifier;
private final int priority; // private final int priority;
public TextFormatting color; // public TextFormatting color;
//
public BookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages) { // public BookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages) {
this(identifier, entry, displayStack, 0, pages); // this(identifier, entry, displayStack, 0, pages);
} // }
//
public BookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, int priority, IBookletPage... pages) { // public BookletChapter(String identifier, IBookletEntry entry, ItemStack displayStack, int priority, IBookletPage... pages) {
this.pages = pages; // this.pages = pages;
this.identifier = identifier; // this.identifier = identifier;
this.entry = entry; // this.entry = entry;
this.displayStack = displayStack; // this.displayStack = displayStack;
if (displayStack.getItem() instanceof IDisableableItem && ((IDisableableItem) displayStack.getItem()).isDisabled()) { // if (displayStack.getItem() instanceof IDisableableItem && ((IDisableableItem) displayStack.getItem()).isDisabled()) {
displayStack = ItemStack.EMPTY; // displayStack = ItemStack.EMPTY;
} // }
this.priority = priority; // this.priority = priority;
this.color = TextFormatting.RESET; // this.color = TextFormatting.RESET;
//
this.entry.addChapter(this); // this.entry.addChapter(this);
for (IBookletPage page : this.pages) { // for (IBookletPage page : this.pages) {
page.setChapter(this); // page.setChapter(this);
} // }
} // }
//
@Override // @Override
public IBookletPage[] getAllPages() { // public IBookletPage[] getAllPages() {
return this.pages; // return this.pages;
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public String getLocalizedName() { // public String getLocalizedName() {
return StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".chapter." + this.getIdentifier() + ".name"); // return StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".chapter." + this.getIdentifier() + ".name");
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public String getLocalizedNameWithFormatting() { // public String getLocalizedNameWithFormatting() {
return this.color + this.getLocalizedName(); // return this.color + this.getLocalizedName();
} // }
//
@Override // @Override
public IBookletEntry getEntry() { // public IBookletEntry getEntry() {
return this.entry; // return this.entry;
} // }
//
@Override // @Override
public ItemStack getDisplayItemStack() { // public ItemStack getDisplayItemStack() {
return this.displayStack; // return this.displayStack;
} // }
//
@Override // @Override
public String getIdentifier() { // public String getIdentifier() {
return this.identifier; // return this.identifier;
} // }
//
@Override // @Override
public int getPageIndex(IBookletPage page) { // public int getPageIndex(IBookletPage page) {
for (int i = 0; i < this.pages.length; i++) { // for (int i = 0; i < this.pages.length; i++) {
if (this.pages[i] == page) { // if (this.pages[i] == page) {
return i; // return i;
} // }
} // }
return -1; // return -1;
} // }
//
@Override // @Override
public int getSortingPriority() { // public int getSortingPriority() {
return this.priority; // return this.priority;
} // }
//
public BookletChapter setImportant() { // public BookletChapter setImportant() {
this.color = TextFormatting.DARK_GREEN; // this.color = TextFormatting.DARK_GREEN;
return this; // return this;
} // }
//
public BookletChapter setSpecial() { // public BookletChapter setSpecial() {
this.color = TextFormatting.DARK_PURPLE; // this.color = TextFormatting.DARK_PURPLE;
return this; // return this;
} // }
} //}

View file

@ -1,46 +1,46 @@
/* ///*
* This file ("BookletChapterCoffee.java") is part of the Actually Additions mod for Minecraft. // * This file ("BookletChapterCoffee.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed // * It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at // * under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense // * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* // *
* © 2015-2017 Ellpeck // * © 2015-2017 Ellpeck
*/ // */
//
package de.ellpeck.actuallyadditions.mod.booklet.chapter; //package de.ellpeck.actuallyadditions.mod.booklet.chapter;
//
import java.util.ArrayList; //import java.util.ArrayList;
import java.util.Arrays; //import java.util.Arrays;
import java.util.List; //import java.util.List;
//
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; //import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry; //import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; //import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient; //import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
import de.ellpeck.actuallyadditions.mod.booklet.page.BookletPage; //import de.ellpeck.actuallyadditions.mod.booklet.page.BookletPage;
import de.ellpeck.actuallyadditions.mod.booklet.page.PageCoffeeMachine; //import de.ellpeck.actuallyadditions.mod.booklet.page.PageCoffeeMachine;
import de.ellpeck.actuallyadditions.mod.items.ItemCoffee; //import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
import net.minecraft.item.ItemStack; //import net.minecraft.item.ItemStack;
//
public class BookletChapterCoffee extends BookletChapter { //public class BookletChapterCoffee extends BookletChapter {
//
public BookletChapterCoffee(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages) { // public BookletChapterCoffee(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages) {
super(identifier, entry, displayStack, getPages(pages)); // super(identifier, entry, displayStack, getPages(pages));
} // }
//
private static IBookletPage[] getPages(IBookletPage... pages) { // private static IBookletPage[] getPages(IBookletPage... pages) {
List<IBookletPage> allPages = new ArrayList<>(); // List<IBookletPage> allPages = new ArrayList<>();
allPages.addAll(Arrays.asList(pages)); // allPages.addAll(Arrays.asList(pages));
//
for (CoffeeIngredient ingredient : ActuallyAdditionsAPI.COFFEE_MACHINE_INGREDIENTS) { // for (CoffeeIngredient ingredient : ActuallyAdditionsAPI.COFFEE_MACHINE_INGREDIENTS) {
BookletPage page = new PageCoffeeMachine(allPages.size() + 1, ingredient); // BookletPage page = new PageCoffeeMachine(allPages.size() + 1, ingredient);
if (!(ingredient instanceof ItemCoffee.MilkIngredient)) { // if (!(ingredient instanceof ItemCoffee.MilkIngredient)) {
page.setNoText(); // page.setNoText();
} // }
allPages.add(page); // allPages.add(page);
} // }
//
return allPages.toArray(new IBookletPage[allPages.size()]); // return allPages.toArray(new IBookletPage[allPages.size()]);
} // }
} //}

View file

@ -1,40 +1,40 @@
/* ///*
* This file ("BookletChapterCrusher.java") is part of the Actually Additions mod for Minecraft. // * This file ("BookletChapterCrusher.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed // * It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at // * under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense // * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* // *
* © 2015-2017 Ellpeck // * © 2015-2017 Ellpeck
*/ // */
//
package de.ellpeck.actuallyadditions.mod.booklet.chapter; //package de.ellpeck.actuallyadditions.mod.booklet.chapter;
//
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry; //import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; //import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
import de.ellpeck.actuallyadditions.mod.booklet.page.PageCrusherRecipe; //import de.ellpeck.actuallyadditions.mod.booklet.page.PageCrusherRecipe;
import de.ellpeck.actuallyadditions.mod.crafting.CrusherCrafting; //import de.ellpeck.actuallyadditions.mod.crafting.CrusherCrafting;
import de.ellpeck.actuallyadditions.mod.crafting.CrushingRecipe; //import de.ellpeck.actuallyadditions.mod.crafting.CrushingRecipe;
import net.minecraft.item.ItemStack; //import net.minecraft.item.ItemStack;
//
import java.util.ArrayList; //import java.util.ArrayList;
import java.util.Arrays; //import java.util.Arrays;
import java.util.List; //import java.util.List;
//
public class BookletChapterCrusher extends BookletChapter { //public class BookletChapterCrusher extends BookletChapter {
//
public BookletChapterCrusher(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages) { // public BookletChapterCrusher(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages) {
super(identifier, entry, displayStack, getPages(pages)); // super(identifier, entry, displayStack, getPages(pages));
} // }
//
private static IBookletPage[] getPages(IBookletPage... pages) { // private static IBookletPage[] getPages(IBookletPage... pages) {
List<IBookletPage> allPages = new ArrayList<>(); // List<IBookletPage> allPages = new ArrayList<>();
allPages.addAll(Arrays.asList(pages)); // allPages.addAll(Arrays.asList(pages));
//
for (CrushingRecipe recipe : CrusherCrafting.MISC_RECIPES) { // for (CrushingRecipe recipe : CrusherCrafting.MISC_RECIPES) {
allPages.add(new PageCrusherRecipe(allPages.size() + 1, recipe).setNoText()); // allPages.add(new PageCrusherRecipe(allPages.size() + 1, recipe).setNoText());
} // }
//
return allPages.toArray(new IBookletPage[allPages.size()]); // return allPages.toArray(new IBookletPage[allPages.size()]);
} // }
} //}

View file

@ -1,48 +1,48 @@
/* ///*
* This file ("BookletChapterTrials.java") is part of the Actually Additions mod for Minecraft. // * This file ("BookletChapterTrials.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed // * It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at // * under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense // * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* // *
* © 2015-2017 Ellpeck // * © 2015-2017 Ellpeck
*/ // */
//
package de.ellpeck.actuallyadditions.mod.booklet.chapter; //package de.ellpeck.actuallyadditions.mod.booklet.chapter;
//
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; //import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; //import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.booklet.page.PageTrials; //import de.ellpeck.actuallyadditions.mod.booklet.page.PageTrials;
import de.ellpeck.actuallyadditions.mod.data.PlayerData; //import de.ellpeck.actuallyadditions.mod.data.PlayerData;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; //import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.Minecraft; //import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.PlayerEntity; //import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; //import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextFormatting; //import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.api.distmarker.Dist; //import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; //import net.minecraftforge.api.distmarker.OnlyIn;
//
public class BookletChapterTrials extends BookletChapter { //public class BookletChapterTrials extends BookletChapter {
//
public BookletChapterTrials(String identifier, ItemStack displayStack, boolean secondPageText) { // public BookletChapterTrials(String identifier, ItemStack displayStack, boolean secondPageText) {
super(identifier, ActuallyAdditionsAPI.entryTrials, displayStack, new PageTrials(1, false, true), new PageTrials(2, true, secondPageText)); // super(identifier, ActuallyAdditionsAPI.entryTrials, displayStack, new PageTrials(1, false, true), new PageTrials(2, true, secondPageText));
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public String getLocalizedName() { // public String getLocalizedName() {
return StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".trials." + this.getIdentifier() + ".name"); // return StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".trials." + this.getIdentifier() + ".name");
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public String getLocalizedNameWithFormatting() { // public String getLocalizedNameWithFormatting() {
PlayerEntity player = Minecraft.getInstance().player; // PlayerEntity player = Minecraft.getInstance().player;
PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player); // PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player);
boolean completed = data.completedTrials.contains(this.getIdentifier()); // boolean completed = data.completedTrials.contains(this.getIdentifier());
//
return (completed // return (completed
? TextFormatting.DARK_GREEN // ? TextFormatting.DARK_GREEN
: TextFormatting.DARK_RED) + TextFormatting.ITALIC.toString() + this.getLocalizedName(); // : TextFormatting.DARK_RED) + TextFormatting.ITALIC.toString() + this.getLocalizedName();
} // }
} //}

View file

@ -1,162 +1,162 @@
/* ///*
* This file ("BookletEntry.java") is part of the Actually Additions mod for Minecraft. // * This file ("BookletEntry.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed // * It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at // * under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense // * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* // *
* © 2015-2017 Ellpeck // * © 2015-2017 Ellpeck
*/ // */
//
package de.ellpeck.actuallyadditions.mod.booklet.entry; //package de.ellpeck.actuallyadditions.mod.booklet.entry;
//
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; //import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; //import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry; //import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; //import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; //import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; //import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; //import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.Minecraft; //import net.minecraft.client.Minecraft;
import net.minecraft.client.util.ITooltipFlag; //import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.ItemStack; //import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextFormatting; //import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.api.distmarker.Dist; //import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; //import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fluids.FluidStack; //import net.minecraftforge.fluids.FluidStack;
//
import java.util.ArrayList; //import java.util.ArrayList;
import java.util.List; //import java.util.List;
import java.util.Locale; //import java.util.Locale;
//
public class BookletEntry implements IBookletEntry { //public class BookletEntry implements IBookletEntry {
//
private final String identifier; // private final String identifier;
private final int priority; // private final int priority;
private final List<IBookletChapter> chapters = new ArrayList<>(); // private final List<IBookletChapter> chapters = new ArrayList<>();
private TextFormatting color; // private TextFormatting color;
//
public BookletEntry(String identifier) { // public BookletEntry(String identifier) {
this(identifier, 0); // this(identifier, 0);
} // }
//
public BookletEntry(String identifier, int prio) { // public BookletEntry(String identifier, int prio) {
this.identifier = identifier; // this.identifier = identifier;
this.priority = prio; // this.priority = prio;
ActuallyAdditionsAPI.addBookletEntry(this); // ActuallyAdditionsAPI.addBookletEntry(this);
//
this.color = TextFormatting.RESET; // this.color = TextFormatting.RESET;
} // }
//
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
private static boolean fitsFilter(IBookletPage page, String searchBarText) { // private static boolean fitsFilter(IBookletPage page, String searchBarText) {
Minecraft mc = Minecraft.getInstance(); // Minecraft mc = Minecraft.getInstance();
//
List<ItemStack> items = new ArrayList<>(); // List<ItemStack> items = new ArrayList<>();
page.getItemStacksForPage(items); // page.getItemStacksForPage(items);
if (!items.isEmpty()) { // if (!items.isEmpty()) {
for (ItemStack stack : items) { // for (ItemStack stack : items) {
if (StackUtil.isValid(stack)) { // if (StackUtil.isValid(stack)) {
List<String> tooltip = stack.getTooltipLines(mc.player, mc.options.advancedItemTooltips // List<String> tooltip = stack.getTooltipLines(mc.player, mc.options.advancedItemTooltips
? ITooltipFlag.TooltipFlags.ADVANCED // ? ITooltipFlag.TooltipFlags.ADVANCED
: ITooltipFlag.TooltipFlags.NORMAL); // : ITooltipFlag.TooltipFlags.NORMAL);
for (String strg : tooltip) { // for (String strg : tooltip) {
if (strg != null && strg.toLowerCase(Locale.ROOT).contains(searchBarText)) { // if (strg != null && strg.toLowerCase(Locale.ROOT).contains(searchBarText)) {
return true; // return true;
} // }
} // }
} // }
} // }
} // }
//
List<FluidStack> fluids = new ArrayList<>(); // List<FluidStack> fluids = new ArrayList<>();
page.getFluidStacksForPage(fluids); // page.getFluidStacksForPage(fluids);
if (!fluids.isEmpty()) { // if (!fluids.isEmpty()) {
for (FluidStack stack : fluids) { // for (FluidStack stack : fluids) {
if (stack != null) { // if (stack != null) {
String strg = stack.getLocalizedName(); // String strg = stack.getLocalizedName();
if (strg != null && strg.toLowerCase(Locale.ROOT).contains(searchBarText)) { // if (strg != null && strg.toLowerCase(Locale.ROOT).contains(searchBarText)) {
return true; // return true;
} // }
} // }
} // }
} // }
//
return false; // return false;
} // }
//
@Override // @Override
public List<IBookletChapter> getAllChapters() { // public List<IBookletChapter> getAllChapters() {
return this.chapters; // return this.chapters;
} // }
//
@Override // @Override
public String getIdentifier() { // public String getIdentifier() {
return this.identifier; // return this.identifier;
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public String getLocalizedName() { // public String getLocalizedName() {
return StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".indexEntry." + this.getIdentifier() + ".name"); // return StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".indexEntry." + this.getIdentifier() + ".name");
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public String getLocalizedNameWithFormatting() { // public String getLocalizedNameWithFormatting() {
return this.color + this.getLocalizedName(); // return this.color + this.getLocalizedName();
} // }
//
@Override // @Override
public void addChapter(IBookletChapter chapter) { // public void addChapter(IBookletChapter chapter) {
this.chapters.add(chapter); // this.chapters.add(chapter);
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public List<IBookletChapter> getChaptersForDisplay(String searchBarText) { // public List<IBookletChapter> getChaptersForDisplay(String searchBarText) {
if (searchBarText != null && !searchBarText.isEmpty()) { // if (searchBarText != null && !searchBarText.isEmpty()) {
String search = searchBarText.toLowerCase(Locale.ROOT); // String search = searchBarText.toLowerCase(Locale.ROOT);
//
List<IBookletChapter> fittingChapters = new ArrayList<>(); // List<IBookletChapter> fittingChapters = new ArrayList<>();
for (IBookletChapter chapter : this.getAllChapters()) { // for (IBookletChapter chapter : this.getAllChapters()) {
if (chapter.getLocalizedName().toLowerCase(Locale.ROOT).contains(search)) { // if (chapter.getLocalizedName().toLowerCase(Locale.ROOT).contains(search)) {
fittingChapters.add(chapter); // fittingChapters.add(chapter);
} else { // } else {
for (IBookletPage page : chapter.getAllPages()) { // for (IBookletPage page : chapter.getAllPages()) {
if (fitsFilter(page, search)) { // if (fitsFilter(page, search)) {
fittingChapters.add(chapter); // fittingChapters.add(chapter);
break; // break;
} // }
} // }
} // }
} // }
//
return fittingChapters; // return fittingChapters;
} else { // } else {
return this.getAllChapters(); // return this.getAllChapters();
} // }
} // }
//
@Override // @Override
public int getSortingPriority() { // public int getSortingPriority() {
return this.priority; // return this.priority;
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public boolean visibleOnFrontPage() { // public boolean visibleOnFrontPage() {
return true; // return true;
} // }
//
public BookletEntry setImportant() { // public BookletEntry setImportant() {
this.color = TextFormatting.DARK_GREEN; // this.color = TextFormatting.DARK_GREEN;
return this; // return this;
} // }
//
public BookletEntry setSpecial() { // public BookletEntry setSpecial() {
this.color = TextFormatting.DARK_PURPLE; // this.color = TextFormatting.DARK_PURPLE;
return this; // return this;
} // }
//
} //}

View file

@ -1,33 +1,33 @@
/* ///*
* This file ("BookletEntryAllItems.java") is part of the Actually Additions mod for Minecraft. // * This file ("BookletEntryAllItems.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed // * It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at // * under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense // * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* // *
* © 2015-2017 Ellpeck // * © 2015-2017 Ellpeck
*/ // */
//
package de.ellpeck.actuallyadditions.mod.booklet.entry; //package de.ellpeck.actuallyadditions.mod.booklet.entry;
//
import java.util.List; //import java.util.List;
//
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; //import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; //import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
//
public class BookletEntryAllItems extends BookletEntry { //public class BookletEntryAllItems extends BookletEntry {
//
public BookletEntryAllItems(String identifier) { // public BookletEntryAllItems(String identifier) {
super(identifier, -Integer.MAX_VALUE); // super(identifier, -Integer.MAX_VALUE);
} // }
//
@Override // @Override
public void addChapter(IBookletChapter chapter) { // public void addChapter(IBookletChapter chapter) {
//
} // }
//
@Override // @Override
public List<IBookletChapter> getAllChapters() { // public List<IBookletChapter> getAllChapters() {
return ActuallyAdditionsAPI.ALL_CHAPTERS; // return ActuallyAdditionsAPI.ALL_CHAPTERS;
} // }
} //}

View file

@ -1,23 +1,23 @@
/* ///*
* This file ("BookletEntryTrials.java") is part of the Actually Additions mod for Minecraft. // * This file ("BookletEntryTrials.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed // * It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at // * under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense // * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* // *
* © 2015-2017 Ellpeck // * © 2015-2017 Ellpeck
*/ // */
//
package de.ellpeck.actuallyadditions.mod.booklet.entry; //package de.ellpeck.actuallyadditions.mod.booklet.entry;
//
public class BookletEntryTrials extends BookletEntry { //public class BookletEntryTrials extends BookletEntry {
//
public BookletEntryTrials(String identifier) { // public BookletEntryTrials(String identifier) {
super(identifier, -Integer.MAX_VALUE); // super(identifier, -Integer.MAX_VALUE);
} // }
//
@Override // @Override
public boolean visibleOnFrontPage() { // public boolean visibleOnFrontPage() {
return false; // return false;
} // }
} //}

View file

@ -1,369 +1,369 @@
/* ///*
* This file ("GuiBooklet.java") is part of the Actually Additions mod for Minecraft. // * This file ("GuiBooklet.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed // * It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at // * under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense // * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* // *
* © 2015-2017 Ellpeck // * © 2015-2017 Ellpeck
*/ // */
//
package de.ellpeck.actuallyadditions.mod.booklet.gui; //package de.ellpeck.actuallyadditions.mod.booklet.gui;
//
import com.mojang.blaze3d.matrix.MatrixStack; //import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager; //import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; //import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; //import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; //import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.booklet.button.BookmarkButton; //import de.ellpeck.actuallyadditions.mod.booklet.button.BookmarkButton;
import de.ellpeck.actuallyadditions.mod.booklet.button.TrialsButton; //import de.ellpeck.actuallyadditions.mod.booklet.button.TrialsButton;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; //import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
import de.ellpeck.actuallyadditions.mod.data.PlayerData; //import de.ellpeck.actuallyadditions.mod.data.PlayerData;
import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave; //import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave;
import de.ellpeck.actuallyadditions.mod.inventory.gui.TexturedButton; //import de.ellpeck.actuallyadditions.mod.inventory.gui.TexturedButton;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; //import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; //import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; //import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.gui.IGuiEventListener; //import net.minecraft.client.gui.IGuiEventListener;
import net.minecraft.client.gui.screen.Screen; //import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.TextFieldWidget; //import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.client.gui.widget.button.Button; //import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.util.ResourceLocation; //import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.StringTextComponent; //import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting; //import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.api.distmarker.Dist; //import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; //import net.minecraftforge.api.distmarker.OnlyIn;
//
import java.util.Arrays; //import java.util.Arrays;
import java.util.List; //import java.util.List;
import java.util.stream.Collectors; //import java.util.stream.Collectors;
//
@OnlyIn(Dist.CLIENT) //@OnlyIn(Dist.CLIENT)
public abstract class GuiBooklet extends GuiBookletBase { //public abstract class GuiBooklet extends GuiBookletBase {
//
public static final int BUTTONS_PER_PAGE = 12; // public static final int BUTTONS_PER_PAGE = 12;
public static final ResourceLocation RES_LOC_GUI = AssetUtil.getBookletGuiLocation("gui_booklet"); // public static final ResourceLocation RES_LOC_GUI = AssetUtil.getBookletGuiLocation("gui_booklet");
public static final ResourceLocation RES_LOC_GADGETS = AssetUtil.getBookletGuiLocation("gui_booklet_gadgets"); // public static final ResourceLocation RES_LOC_GADGETS = AssetUtil.getBookletGuiLocation("gui_booklet_gadgets");
protected final BookmarkButton[] bookmarkButtons = new BookmarkButton[12]; // protected final BookmarkButton[] bookmarkButtons = new BookmarkButton[12];
public Screen previousScreen; // public Screen previousScreen;
public GuiBookletBase parentPage; // public GuiBookletBase parentPage;
public TextFieldWidget searchField; // public TextFieldWidget searchField;
protected int xSize; // protected int xSize;
protected int ySize; // protected int ySize;
protected int guiLeft; // protected int guiLeft;
protected int guiTop; // protected int guiTop;
private Button buttonLeft; // private Button buttonLeft;
private Button buttonRight; // private Button buttonRight;
private Button buttonBack; // private Button buttonBack;
//
private Button buttonTrials; // private Button buttonTrials;
//
private float smallFontSize; // private float smallFontSize;
private float mediumFontSize; // private float mediumFontSize;
private float largeFontSize; // private float largeFontSize;
//
public GuiBooklet(Screen previousScreen, GuiBookletBase parentPage) { // public GuiBooklet(Screen previousScreen, GuiBookletBase parentPage) {
super(StringTextComponent.EMPTY); // super(StringTextComponent.EMPTY);
//
this.previousScreen = previousScreen; // this.previousScreen = previousScreen;
this.parentPage = parentPage; // this.parentPage = parentPage;
//
this.xSize = 281; // this.xSize = 281;
this.ySize = 180; // this.ySize = 180;
} // }
//
private static float getFontSize(String lang, ConfigIntValues config, float defaultValue) { // private static float getFontSize(String lang, ConfigIntValues config, float defaultValue) {
int conf = config.getValue(); // int conf = config.getValue();
if (conf <= 0) { // if (conf <= 0) {
try { // try {
return Float.parseFloat(StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".fontSize." + lang)); // return Float.parseFloat(StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".fontSize." + lang));
} catch (Exception e) { // } catch (Exception e) {
return defaultValue; // return defaultValue;
} // }
} else { // } else {
return conf / 100F; // return conf / 100F;
} // }
} // }
//
@Override // @Override
public void init() { // public void init() {
super.init(); // super.init();
//
this.guiLeft = (this.width - this.xSize) / 2; // this.guiLeft = (this.width - this.xSize) / 2;
this.guiTop = (this.height - this.ySize) / 2; // this.guiTop = (this.height - this.ySize) / 2;
//
this.smallFontSize = getFontSize("small", ConfigIntValues.FONT_SIZE_SMALL, 0.5F); // this.smallFontSize = getFontSize("small", ConfigIntValues.FONT_SIZE_SMALL, 0.5F);
this.mediumFontSize = getFontSize("medium", ConfigIntValues.FONT_SIZE_MEDIUM, 0.75F); // this.mediumFontSize = getFontSize("medium", ConfigIntValues.FONT_SIZE_MEDIUM, 0.75F);
this.largeFontSize = getFontSize("large", ConfigIntValues.FONT_SIZE_LARGE, 0.8F); // this.largeFontSize = getFontSize("large", ConfigIntValues.FONT_SIZE_LARGE, 0.8F);
//
if (this.hasPageLeftButton()) { // if (this.hasPageLeftButton()) {
List<String> hoverText = Arrays.asList(TextFormatting.GOLD + "Previous Page", TextFormatting.ITALIC + "Or scroll up"); // List<String> hoverText = Arrays.asList(TextFormatting.GOLD + "Previous Page", TextFormatting.ITALIC + "Or scroll up");
this.buttonLeft = new TexturedButton(RES_LOC_GADGETS, this.guiLeft - 12, this.guiTop + this.ySize - 8, 18, 54, 18, 10, hoverText, btn -> this.onPageLeftButtonPressed()); // this.buttonLeft = new TexturedButton(RES_LOC_GADGETS, this.guiLeft - 12, this.guiTop + this.ySize - 8, 18, 54, 18, 10, hoverText, btn -> this.onPageLeftButtonPressed());
this.addButton(this.buttonLeft); // this.addButton(this.buttonLeft);
} // }
//
if (this.hasPageRightButton()) { // if (this.hasPageRightButton()) {
List<String> hoverText = Arrays.asList(TextFormatting.GOLD + "Next Page", TextFormatting.ITALIC + "Or scroll down"); // List<String> hoverText = Arrays.asList(TextFormatting.GOLD + "Next Page", TextFormatting.ITALIC + "Or scroll down");
this.buttonRight = new TexturedButton(RES_LOC_GADGETS, this.guiLeft + this.xSize - 6, this.guiTop + this.ySize - 8, 0, 54, 18, 10, hoverText, btn -> this.onPageRightButtonPressed()); // this.buttonRight = new TexturedButton(RES_LOC_GADGETS, this.guiLeft + this.xSize - 6, this.guiTop + this.ySize - 8, 0, 54, 18, 10, hoverText, btn -> this.onPageRightButtonPressed());
this.addButton(this.buttonRight); // this.addButton(this.buttonRight);
} // }
//
if (this.hasBackButton()) { // if (this.hasBackButton()) {
List<String> hoverText = Arrays.asList(TextFormatting.GOLD + "Go Back", TextFormatting.ITALIC + "Or right-click", TextFormatting.ITALIC.toString() + TextFormatting.GRAY + "Hold Shift for Main Page"); // List<String> hoverText = Arrays.asList(TextFormatting.GOLD + "Go Back", TextFormatting.ITALIC + "Or right-click", TextFormatting.ITALIC.toString() + TextFormatting.GRAY + "Hold Shift for Main Page");
this.buttonBack = new TexturedButton(RES_LOC_GADGETS, this.guiLeft - 15, this.guiTop - 3, 36, 54, 18, 10, hoverText, btn -> this.onBackButtonPressed()); // this.buttonBack = new TexturedButton(RES_LOC_GADGETS, this.guiLeft - 15, this.guiTop - 3, 36, 54, 18, 10, hoverText, btn -> this.onBackButtonPressed());
this.addButton(this.buttonBack); // this.addButton(this.buttonBack);
} // }
//
if (this.hasSearchBar()) { // if (this.hasSearchBar()) {
this.searchField = new TextFieldWidget(this.font, this.guiLeft + this.xSize + 2, this.guiTop + this.ySize - 40 + 2, 64, 12, StringTextComponent.EMPTY); // this.searchField = new TextFieldWidget(this.font, this.guiLeft + this.xSize + 2, this.guiTop + this.ySize - 40 + 2, 64, 12, StringTextComponent.EMPTY);
this.searchField.setMaxLength(50); // this.searchField.setMaxLength(50);
this.searchField.setBordered(false); // this.searchField.setBordered(false);
this.children.add(this.searchField); // this.children.add(this.searchField);
} // }
//
if (this.hasBookmarkButtons()) { // if (this.hasBookmarkButtons()) {
PlayerSave data = PlayerData.getDataFromPlayer(this.getMinecraft().player); // PlayerSave data = PlayerData.getDataFromPlayer(this.getMinecraft().player);
//
int xStart = this.guiLeft + this.xSize / 2 - 16 * this.bookmarkButtons.length / 2; // int xStart = this.guiLeft + this.xSize / 2 - 16 * this.bookmarkButtons.length / 2;
for (int i = 0; i < this.bookmarkButtons.length; i++) { // for (int i = 0; i < this.bookmarkButtons.length; i++) {
this.bookmarkButtons[i] = new BookmarkButton(xStart + i * 16, this.guiTop + this.ySize, this); // this.bookmarkButtons[i] = new BookmarkButton(xStart + i * 16, this.guiTop + this.ySize, this);
this.addButton(this.bookmarkButtons[i]); // this.addButton(this.bookmarkButtons[i]);
//
if (data.bookmarks[i] != null) { // if (data.bookmarks[i] != null) {
this.bookmarkButtons[i].assignedPage = data.bookmarks[i]; // this.bookmarkButtons[i].assignedPage = data.bookmarks[i];
} // }
} // }
} // }
//
this.buttonTrials = new TrialsButton(this, btn -> this.getMinecraft().setScreen(new GuiEntry(this.previousScreen, this, ActuallyAdditionsAPI.entryTrials, 0, "", false))); // this.buttonTrials = new TrialsButton(this, btn -> this.getMinecraft().setScreen(new GuiEntry(this.previousScreen, this, ActuallyAdditionsAPI.entryTrials, 0, "", false)));
this.addButton(this.buttonTrials); // this.addButton(this.buttonTrials);
} // }
//
@Override // @Override
public void removed() { // public void removed() {
super.removed(); // super.removed();
//
//Don't cache the parent GUI, otherwise it opens again when you close the cached book! // //Don't cache the parent GUI, otherwise it opens again when you close the cached book!
this.previousScreen = null; // this.previousScreen = null;
//
if (this.getMinecraft().player == null) { // if (this.getMinecraft().player == null) {
return; // return;
} // }
PlayerSave data = PlayerData.getDataFromPlayer(this.getMinecraft().player); // PlayerSave data = PlayerData.getDataFromPlayer(this.getMinecraft().player);
data.lastOpenBooklet = this; // data.lastOpenBooklet = this;
//
boolean change = false; // boolean change = false;
for (int i = 0; i < this.bookmarkButtons.length; i++) { // for (int i = 0; i < this.bookmarkButtons.length; i++) {
if (data.bookmarks[i] != this.bookmarkButtons[i].assignedPage) { // if (data.bookmarks[i] != this.bookmarkButtons[i].assignedPage) {
data.bookmarks[i] = this.bookmarkButtons[i].assignedPage; // data.bookmarks[i] = this.bookmarkButtons[i].assignedPage;
change = true; // change = true;
} // }
} // }
//
if (change) { // if (change) {
PacketHandlerHelper.sendPlayerDataToServer(true, 0); // PacketHandlerHelper.sendPlayerDataToServer(true, 0);
} // }
} // }
//
@Override // @Override
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { // public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
this.drawScreenPre(matrixStack, mouseX, mouseY, partialTicks); // this.drawScreenPre(matrixStack, mouseX, mouseY, partialTicks);
super.render(matrixStack, mouseX, mouseY, partialTicks); // super.render(matrixStack, mouseX, mouseY, partialTicks);
this.drawScreenPost(matrixStack, mouseX, mouseY, partialTicks); // this.drawScreenPost(matrixStack, mouseX, mouseY, partialTicks);
} // }
//
public void drawScreenPre(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) { // public void drawScreenPre(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) {
GlStateManager._color4f(1F, 1F, 1F, 1F); // GlStateManager._color4f(1F, 1F, 1F, 1F);
this.getMinecraft().getTextureManager().bind(RES_LOC_GUI); // this.getMinecraft().getTextureManager().bind(RES_LOC_GUI);
blit(matrices, this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize, 512, 512); // blit(matrices, this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize, 512, 512);
//
if (this.hasSearchBar()) { // if (this.hasSearchBar()) {
this.getMinecraft().getTextureManager().bind(RES_LOC_GADGETS); // this.getMinecraft().getTextureManager().bind(RES_LOC_GADGETS);
this.blit(matrices, this.guiLeft + this.xSize, this.guiTop + this.ySize - 40, 188, 0, 68, 14); // this.blit(matrices, this.guiLeft + this.xSize, this.guiTop + this.ySize - 40, 188, 0, 68, 14);
//
// boolean unicodeBefore = this.font.getUnicodeFlag(); // // boolean unicodeBefore = this.font.getUnicodeFlag();
// this.font.setUnicodeFlag(true); // // this.font.setUnicodeFlag(true);
//
if (!this.searchField.isFocused() && (this.searchField.getValue() == null || this.searchField.getValue().isEmpty())) { // if (!this.searchField.isFocused() && (this.searchField.getValue() == null || this.searchField.getValue().isEmpty())) {
this.font.draw(matrices, TextFormatting.ITALIC + StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.searchField"), this.guiLeft + this.xSize + 2, this.guiTop + this.ySize - 40 + 2, 0xFFFFFF); // this.font.draw(matrices, TextFormatting.ITALIC + StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.searchField"), this.guiLeft + this.xSize + 2, this.guiTop + this.ySize - 40 + 2, 0xFFFFFF);
} // }
//
this.searchField.render(matrices, mouseX, mouseY, partialTicks); // this.searchField.render(matrices, mouseX, mouseY, partialTicks);
//
// this.font.setUnicodeFlag(unicodeBefore); // // this.font.setUnicodeFlag(unicodeBefore);
} // }
} // }
//
public void drawScreenPost(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { // public void drawScreenPost(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
for (IGuiEventListener button : this.children) { // for (IGuiEventListener button : this.children) {
if (button instanceof BookmarkButton) { // if (button instanceof BookmarkButton) {
((BookmarkButton) button).drawHover(matrixStack, mouseX, mouseY); // ((BookmarkButton) button).drawHover(matrixStack, mouseX, mouseY);
} else if (button instanceof TexturedButton) { // } else if (button instanceof TexturedButton) {
((TexturedButton) button).drawHover(matrixStack, mouseX, mouseY); // ((TexturedButton) button).drawHover(matrixStack, mouseX, mouseY);
} // }
} // }
} // }
//
@Override // @Override
public boolean mouseClicked(double mouseX, double mouseY, int button) { // public boolean mouseClicked(double mouseX, double mouseY, int button) {
return super.mouseClicked(mouseX, mouseY, button); // return super.mouseClicked(mouseX, mouseY, button);
} // }
//
// TODO: Ensure replacement works // // TODO: Ensure replacement works
@Override // @Override
public boolean mouseScrolled(double mouseX, double mouseY, double delta) { // public boolean mouseScrolled(double mouseX, double mouseY, double delta) {
if (delta < 0) { // if (delta < 0) {
if (this.hasPageRightButton()) { // if (this.hasPageRightButton()) {
this.onPageRightButtonPressed(); // this.onPageRightButtonPressed();
} // }
} else if (delta > 0) { // } else if (delta > 0) {
if (this.hasPageLeftButton()) { // if (this.hasPageLeftButton()) {
this.onPageLeftButtonPressed(); // this.onPageLeftButtonPressed();
} // }
} // }
return super.mouseScrolled(mouseX, mouseY, delta); // return super.mouseScrolled(mouseX, mouseY, delta);
} // }
//
// @Override // // @Override
// public void handleMouseInput() throws IOException { // // public void handleMouseInput() throws IOException {
// int wheel = Mouse.getEventDWheel(); // // int wheel = Mouse.getEventDWheel();
// if (wheel != 0) { // // if (wheel != 0) {
// if (wheel < 0) { // // if (wheel < 0) {
// if (this.hasPageRightButton()) { // // if (this.hasPageRightButton()) {
// this.onPageRightButtonPressed(); // // this.onPageRightButtonPressed();
// } // // }
// } else if (wheel > 0) { // // } else if (wheel > 0) {
// if (this.hasPageLeftButton()) { // // if (this.hasPageLeftButton()) {
// this.onPageLeftButtonPressed(); // // this.onPageLeftButtonPressed();
// } // // }
// } // // }
// } // // }
// super.handleMouseInput(); // // super.handleMouseInput();
// } // // }
//
//
@Override // @Override
public void tick() { // public void tick() {
if (this.hasSearchBar()) { // if (this.hasSearchBar()) {
this.searchField.tick(); // this.searchField.tick();
} // }
} // }
//
@Override // @Override
public boolean isPauseScreen() { // public boolean isPauseScreen() {
return false; // return false;
} // }
//
public boolean hasPageLeftButton() { // public boolean hasPageLeftButton() {
return false; // return false;
} // }
//
public void onPageLeftButtonPressed() { // public void onPageLeftButtonPressed() {
//
} // }
//
public boolean hasPageRightButton() { // public boolean hasPageRightButton() {
return false; // return false;
} // }
//
public void onPageRightButtonPressed() { // public void onPageRightButtonPressed() {
//
} // }
//
public boolean areTrialsOpened() { // public boolean areTrialsOpened() {
return false; // return false;
} // }
//
public boolean hasBackButton() { // public boolean hasBackButton() {
return false; // return false;
} // }
//
public void onBackButtonPressed() { // public void onBackButtonPressed() {
this.getMinecraft().setScreen(new GuiMainPage(this.previousScreen)); // this.getMinecraft().setScreen(new GuiMainPage(this.previousScreen));
} // }
//
public boolean hasSearchBar() { // public boolean hasSearchBar() {
return true; // return true;
} // }
//
public boolean hasBookmarkButtons() { // public boolean hasBookmarkButtons() {
return true; // return true;
} // }
//
@Override // @Override
public float getSmallFontSize() { // public float getSmallFontSize() {
return this.smallFontSize; // return this.smallFontSize;
} // }
//
@Override // @Override
public float getMediumFontSize() { // public float getMediumFontSize() {
return this.mediumFontSize; // return this.mediumFontSize;
} // }
//
@Override // @Override
public float getLargeFontSize() { // public float getLargeFontSize() {
return this.largeFontSize; // return this.largeFontSize;
} // }
//
// TODO: Check if not being used // // TODO: Check if not being used
public void onSearchBarChanged(String searchBarText) { // public void onSearchBarChanged(String searchBarText) {
GuiBookletBase parent = !(this instanceof GuiEntry) // GuiBookletBase parent = !(this instanceof GuiEntry)
? this // ? this
: this.parentPage; // : this.parentPage;
this.getMinecraft().setScreen(new GuiEntry(this.previousScreen, parent, ActuallyAdditionsAPI.entryAllAndSearch, 0, searchBarText, true)); // this.getMinecraft().setScreen(new GuiEntry(this.previousScreen, parent, ActuallyAdditionsAPI.entryAllAndSearch, 0, searchBarText, true));
} // }
//
// TODO: ensure typing still works // // TODO: ensure typing still works
//
// @Override // // @Override
// protected void keyTyped(char typedChar, int key) throws IOException { // // protected void keyTyped(char typedChar, int key) throws IOException {
// if (key == Keyboard.KEY_ESCAPE || key == this.mc.gameSettings.keyBindInventory.getKeyCode() && (!this.hasSearchBar() || !this.searchField.isFocused())) { // // if (key == Keyboard.KEY_ESCAPE || key == this.mc.gameSettings.keyBindInventory.getKeyCode() && (!this.hasSearchBar() || !this.searchField.isFocused())) {
// this.mc.displayGuiScreen(this.previousScreen); // // this.mc.displayGuiScreen(this.previousScreen);
// } else if (this.hasSearchBar() & this.searchField.isFocused()) { // // } else if (this.hasSearchBar() & this.searchField.isFocused()) {
// String lastText = this.searchField.getText(); // // String lastText = this.searchField.getText();
// // //
// this.searchField.textboxKeyTyped(typedChar, key); // // this.searchField.textboxKeyTyped(typedChar, key);
// // //
// if (!lastText.equals(this.searchField.getText())) { // // if (!lastText.equals(this.searchField.getText())) {
// this.onSearchBarChanged(this.searchField.getText()); // // this.onSearchBarChanged(this.searchField.getText());
// } // // }
// } else { // // } else {
// super.keyTyped(typedChar, key); // // super.keyTyped(typedChar, key);
// } // // }
// } // // }
//
@Override // @Override
public void renderScaledAsciiString(String text, int x, int y, int color, boolean shadow, float scale) { // public void renderScaledAsciiString(String text, int x, int y, int color, boolean shadow, float scale) {
StringUtil.renderScaledAsciiString(this.font, text, x, y, color, shadow, scale); // StringUtil.renderScaledAsciiString(this.font, text, x, y, color, shadow, scale);
} // }
//
@Override // @Override
public void renderSplitScaledAsciiString(String text, int x, int y, int color, boolean shadow, float scale, int length) { // public void renderSplitScaledAsciiString(String text, int x, int y, int color, boolean shadow, float scale, int length) {
StringUtil.renderSplitScaledAsciiString(this.font, text, x, y, color, shadow, scale, length); // StringUtil.renderSplitScaledAsciiString(this.font, text, x, y, color, shadow, scale, length);
} // }
//
@Override // @Override
public List<IGuiEventListener> getButtonList() { // public List<IGuiEventListener> getButtonList() {
return this.children.stream().filter(e -> e instanceof Button).collect(Collectors.toList()); // return this.children.stream().filter(e -> e instanceof Button).collect(Collectors.toList());
} // }
//
@Override // @Override
public int getGuiLeft() { // public int getGuiLeft() {
return this.guiLeft; // return this.guiLeft;
} // }
//
@Override // @Override
public int getGuiTop() { // public int getGuiTop() {
return this.guiTop; // return this.guiTop;
} // }
//
@Override // @Override
public int getSizeX() { // public int getSizeX() {
return this.xSize; // return this.xSize;
} // }
//
@Override // @Override
public int getSizeY() { // public int getSizeY() {
return this.ySize; // return this.ySize;
} // }
} //}

View file

@ -1,170 +1,170 @@
/* ///*
* This file ("GuiEntry.java") is part of the Actually Additions mod for Minecraft. // * This file ("GuiEntry.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed // * It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at // * under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense // * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* // *
* © 2015-2017 Ellpeck // * © 2015-2017 Ellpeck
*/ // */
//
package de.ellpeck.actuallyadditions.mod.booklet.gui; //package de.ellpeck.actuallyadditions.mod.booklet.gui;
//
import com.mojang.blaze3d.matrix.MatrixStack; //import com.mojang.blaze3d.matrix.MatrixStack;
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; //import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry; //import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; //import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; //import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import de.ellpeck.actuallyadditions.mod.booklet.button.EntryButton; //import de.ellpeck.actuallyadditions.mod.booklet.button.EntryButton;
import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryTrials; //import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryTrials;
import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils; //import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
import net.minecraft.client.gui.screen.Screen; //import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.button.Button; //import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.item.ItemStack; //import net.minecraft.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist; //import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; //import net.minecraftforge.api.distmarker.OnlyIn;
//
import java.io.IOException; //import java.io.IOException;
import java.util.List; //import java.util.List;
//
@OnlyIn(Dist.CLIENT) //@OnlyIn(Dist.CLIENT)
public class GuiEntry extends GuiBooklet { //public class GuiEntry extends GuiBooklet {
//
//The page in the entry. Say you have 2 more chapters than fit on one double page, then those 2 would be displayed on entryPage 1 instead. // //The page in the entry. Say you have 2 more chapters than fit on one double page, then those 2 would be displayed on entryPage 1 instead.
private final int entryPage; // private final int entryPage;
private final int pageAmount; // private final int pageAmount;
private final IBookletEntry entry; // private final IBookletEntry entry;
private final List<IBookletChapter> chapters; // private final List<IBookletChapter> chapters;
private final String searchText; // private final String searchText;
private final boolean focusSearch; // private final boolean focusSearch;
//
public GuiEntry(Screen previousScreen, GuiBookletBase parentPage, IBookletEntry entry, int entryPage, String search, boolean focusSearch) { // public GuiEntry(Screen previousScreen, GuiBookletBase parentPage, IBookletEntry entry, int entryPage, String search, boolean focusSearch) {
super(previousScreen, parentPage); // super(previousScreen, parentPage);
this.entryPage = entryPage; // this.entryPage = entryPage;
this.entry = entry; // this.entry = entry;
this.searchText = search; // this.searchText = search;
this.focusSearch = focusSearch; // this.focusSearch = focusSearch;
this.chapters = entry.getChaptersForDisplay(search); // this.chapters = entry.getChaptersForDisplay(search);
//
if (!this.chapters.isEmpty()) { // if (!this.chapters.isEmpty()) {
IBookletChapter lastChap = this.chapters.get(this.chapters.size() - 1); // IBookletChapter lastChap = this.chapters.get(this.chapters.size() - 1);
this.pageAmount = lastChap == null // this.pageAmount = lastChap == null
? 1 // ? 1
: calcEntryPage(this.entry, lastChap, this.searchText) + 1; // : calcEntryPage(this.entry, lastChap, this.searchText) + 1;
} else { // } else {
this.pageAmount = 1; // this.pageAmount = 1;
} // }
} // }
//
public GuiEntry(Screen previousScreen, GuiBookletBase parentPage, IBookletEntry entry, IBookletChapter chapterForPageCalc, String search, boolean focusSearch) { // public GuiEntry(Screen previousScreen, GuiBookletBase parentPage, IBookletEntry entry, IBookletChapter chapterForPageCalc, String search, boolean focusSearch) {
this(previousScreen, parentPage, entry, calcEntryPage(entry, chapterForPageCalc, search), search, focusSearch); // this(previousScreen, parentPage, entry, calcEntryPage(entry, chapterForPageCalc, search), search, focusSearch);
} // }
//
private static int calcEntryPage(IBookletEntry entry, IBookletChapter chapterForPageCalc, String search) { // private static int calcEntryPage(IBookletEntry entry, IBookletChapter chapterForPageCalc, String search) {
int index = entry.getChaptersForDisplay(search).indexOf(chapterForPageCalc); // int index = entry.getChaptersForDisplay(search).indexOf(chapterForPageCalc);
return index / (BUTTONS_PER_PAGE * 2); // return index / (BUTTONS_PER_PAGE * 2);
} // }
//
@Override // @Override
public void drawScreenPre(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) { // public void drawScreenPre(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) {
super.drawScreenPre(matrices, mouseX, mouseY, partialTicks); // super.drawScreenPre(matrices, mouseX, mouseY, partialTicks);
//
String name = this.entry.getLocalizedName(); // String name = this.entry.getLocalizedName();
this.font.draw(matrices, name, this.guiLeft + this.xSize / 2 - this.font.width(name) / 2, this.guiTop - 1, 0xFFFFFF); // this.font.draw(matrices, name, this.guiLeft + this.xSize / 2 - this.font.width(name) / 2, this.guiTop - 1, 0xFFFFFF);
//
for (int i = 0; i < 2; i++) { // for (int i = 0; i < 2; i++) {
String pageStrg = "Page " + (this.entryPage * 2 + i + 1) + "/" + this.pageAmount * 2; // String pageStrg = "Page " + (this.entryPage * 2 + i + 1) + "/" + this.pageAmount * 2;
this.renderScaledAsciiString(pageStrg, this.guiLeft + 25 + i * 136, this.guiTop + this.ySize - 7, 0xFFFFFF, false, this.getLargeFontSize()); // this.renderScaledAsciiString(pageStrg, this.guiLeft + 25 + i * 136, this.guiTop + this.ySize - 7, 0xFFFFFF, false, this.getLargeFontSize());
} // }
} // }
//
@Override // @Override
public void init() { // public void init() {
super.init(); // super.init();
//
if (this.hasSearchBar() && this.searchText != null) { // if (this.hasSearchBar() && this.searchText != null) {
this.searchField.setValue(this.searchText); // this.searchField.setValue(this.searchText);
if (this.focusSearch) { // if (this.focusSearch) {
this.searchField.setFocus(true); // this.searchField.setFocus(true);
} // }
} // }
//
int idOffset = this.entryPage * BUTTONS_PER_PAGE * 2; // int idOffset = this.entryPage * BUTTONS_PER_PAGE * 2;
for (int x = 0; x < 2; x++) { // for (int x = 0; x < 2; x++) {
for (int y = 0; y < BUTTONS_PER_PAGE; y++) { // for (int y = 0; y < BUTTONS_PER_PAGE; y++) {
int id = y + x * BUTTONS_PER_PAGE; // int id = y + x * BUTTONS_PER_PAGE;
if (this.chapters.size() > id + idOffset) { // if (this.chapters.size() > id + idOffset) {
IBookletChapter chapter = this.chapters.get(id + idOffset); // IBookletChapter chapter = this.chapters.get(id + idOffset);
this.addButton(new EntryButton(this, id, this.guiLeft + 14 + x * 142, this.guiTop + 11 + y * 13, 115, 10, chapter.getLocalizedNameWithFormatting(), chapter.getDisplayItemStack())); // this.addButton(new EntryButton(this, id, this.guiLeft + 14 + x * 142, this.guiTop + 11 + y * 13, 115, 10, chapter.getLocalizedNameWithFormatting(), chapter.getDisplayItemStack()));
} else { // } else {
return; // return;
} // }
} // }
} // }
} // }
/* ///*
@Override // @Override
protected void actionPerformed(Button button) throws IOException { // protected void actionPerformed(Button button) throws IOException {
if (button instanceof EntryButton) { // if (button instanceof EntryButton) {
int actualId = button.id + this.entryPage * BUTTONS_PER_PAGE * 2; // int actualId = button.id + this.entryPage * BUTTONS_PER_PAGE * 2;
//
if (this.chapters.size() > actualId) { // if (this.chapters.size() > actualId) {
IBookletChapter chapter = this.chapters.get(actualId); // IBookletChapter chapter = this.chapters.get(actualId);
if (chapter != null) { // if (chapter != null) {
IBookletPage[] pages = chapter.getAllPages(); // IBookletPage[] pages = chapter.getAllPages();
if (pages != null && pages.length > 0) { // if (pages != null && pages.length > 0) {
this.minecraft.setScreen(BookletUtils.createPageGui(this.previousScreen, this, pages[0])); // this.minecraft.setScreen(BookletUtils.createPageGui(this.previousScreen, this, pages[0]));
} // }
} // }
} // }
} else { // } else {
super.actionPerformed(button); // super.actionPerformed(button);
} // }
} // }
//
*/ // */
//
@Override // @Override
public void addOrModifyItemRenderer(ItemStack renderedStack, int x, int y, float scale, boolean shouldTryTransfer) { // public void addOrModifyItemRenderer(ItemStack renderedStack, int x, int y, float scale, boolean shouldTryTransfer) {
//
} // }
//
@Override // @Override
public boolean hasPageLeftButton() { // public boolean hasPageLeftButton() {
return this.entryPage > 0; // return this.entryPage > 0;
} // }
//
@Override // @Override
public void onPageLeftButtonPressed() { // public void onPageLeftButtonPressed() {
this.minecraft.setScreen(new GuiEntry(this.previousScreen, this.parentPage, this.entry, this.entryPage - 1, this.searchText, this.searchField.isFocused())); // this.minecraft.setScreen(new GuiEntry(this.previousScreen, this.parentPage, this.entry, this.entryPage - 1, this.searchText, this.searchField.isFocused()));
} // }
//
@Override // @Override
public boolean hasPageRightButton() { // public boolean hasPageRightButton() {
return !this.chapters.isEmpty() && this.entryPage < this.pageAmount - 1; // return !this.chapters.isEmpty() && this.entryPage < this.pageAmount - 1;
} // }
//
@Override // @Override
public void onPageRightButtonPressed() { // public void onPageRightButtonPressed() {
this.minecraft.setScreen(new GuiEntry(this.previousScreen, this.parentPage, this.entry, this.entryPage + 1, this.searchText, this.searchField.isFocused())); // this.minecraft.setScreen(new GuiEntry(this.previousScreen, this.parentPage, this.entry, this.entryPage + 1, this.searchText, this.searchField.isFocused()));
} // }
//
@Override // @Override
public boolean hasBackButton() { // public boolean hasBackButton() {
return true; // return true;
} // }
//
@Override // @Override
public void onBackButtonPressed() { // public void onBackButtonPressed() {
if (!hasShiftDown()) { // if (!hasShiftDown()) {
this.minecraft.setScreen(this.parentPage); // this.minecraft.setScreen(this.parentPage);
} else { // } else {
super.onBackButtonPressed(); // super.onBackButtonPressed();
} // }
} // }
//
@Override // @Override
public boolean areTrialsOpened() { // public boolean areTrialsOpened() {
return this.entry instanceof BookletEntryTrials; // return this.entry instanceof BookletEntryTrials;
} // }
} //}

View file

@ -1,240 +1,240 @@
/* ///*
* This file ("GuiMainPage.java") is part of the Actually Additions mod for Minecraft. // * This file ("GuiMainPage.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed // * It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at // * under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense // * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* // *
* © 2015-2017 Ellpeck // * © 2015-2017 Ellpeck
*/ // */
//
package de.ellpeck.actuallyadditions.mod.booklet.gui; //package de.ellpeck.actuallyadditions.mod.booklet.gui;
//
import com.mojang.blaze3d.matrix.MatrixStack; //import com.mojang.blaze3d.matrix.MatrixStack;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; //import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry; //import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; //import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.booklet.InitBooklet; //import de.ellpeck.actuallyadditions.mod.booklet.InitBooklet;
import de.ellpeck.actuallyadditions.mod.booklet.button.EntryButton; //import de.ellpeck.actuallyadditions.mod.booklet.button.EntryButton;
import de.ellpeck.actuallyadditions.mod.data.PlayerData; //import de.ellpeck.actuallyadditions.mod.data.PlayerData;
import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave; //import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave;
import de.ellpeck.actuallyadditions.mod.inventory.gui.TexturedButton; //import de.ellpeck.actuallyadditions.mod.inventory.gui.TexturedButton;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; //import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; //import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import de.ellpeck.actuallyadditions.mod.util.Util; //import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.client.gui.screen.Screen; //import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.button.Button; //import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.item.ItemStack; //import net.minecraft.item.ItemStack;
import net.minecraft.util.math.MathHelper; //import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.TextFormatting; //import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.api.distmarker.Dist; //import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; //import net.minecraftforge.api.distmarker.OnlyIn;
//
import java.io.IOException; //import java.io.IOException;
import java.util.ArrayList; //import java.util.ArrayList;
import java.util.List; //import java.util.List;
//
//TODO Fix achievement button ////TODO Fix achievement button
@OnlyIn(Dist.CLIENT) //@OnlyIn(Dist.CLIENT)
public class GuiMainPage extends GuiBooklet { //public class GuiMainPage extends GuiBooklet {
//
private static final String[] QUOTES = new String[]{"Actually Additions, to me, is quite magical in a way.@Saphrym", "Actually quite cool. Lots of nice little additions.@Direwolf20", "Mod Dev quite rude and arrogant@Bubb1e0seven", "A whimsical breath of fresh air in a stuffy tech-mod world.@mezz", "User-friendly :3@TheMeeep", "A lot of stuff, some of it really good.@Narubion", "I like the bookmarks.@Vazkii", "It's got some stuff I guess.@Ellpeck", "Actually Additions should be included in every new modpack that includes any form of tech.@YasminEndusa", "A mod that basically lets you do what ever the heck you want.@Ristelle", "TINY TORCHES!! BABY TORCHES!! Somebody actually finally did it!!@Soaryn", "Balanced mod wich makes things different - in a good way.@garantiertnicht", "The mod everyone needs, but not everyone knows@Brewpl", "The in-game documentation is the best Ive seen. I especially love the JEI integration. Even a derp like me can figure it out.@dannydjdk", "The second best mod I've ever used.@mmaas44", "The Fermenting Barrel is one of my favorite textures.@amadornes", "Smiley Clouds is the reason for fascism in 2016.@raoulvdberge", "The worms are an awesome idea!@greenking", "Can I use that mod in my pack?@Ibraheem", "Hello, love the mod.@SuntannedDuck2", "Quick! Have all the fun before they nerf it!@JuddMan03", "I have a feeling Actually Additions is also like Extra Utilities with Random things smashed together why is it...@lesslighter", "Leaf eater... munchdew... hummm@EiOs", "There is no such thing as canola seeds.@AlBoVa", "This mod is cancer, BRUTAL EXPENSIVE POWER usage..Just, cancer.@KoJo", "Spaghetti is spaghetti, and noodles are noodles.@robsonld04", "The Actually Additions name is actually true. It's actually great!@asiekierka", "Such a great mod@jsdeveloper", "That mod is kind of funny.@Anonymous", "Actually Additions is a lot of fun.@Anonymous", "Is Actually Additions still fugly?@Anonymous", "I like it, but it's so small.@Anonymous", "It has a couple of blocks I like, but overall it's just a mess.@Anonymous", "Direwolf's 1.10 playthrough is just him shilling Actually Additions@Anonymous", "We thought about sending the author a bunch of pizzas to his adress@Anonymous", "It's op as heck.@billofbong0", "Actually AdditionsってマイクラMODすごく良いのに日本人で遊んでる人あんまいないっぽい@stay_uk", "Actually Additions is OP. Not like my favorite combination of mods, Project E + Magic Crops + Draconic Evolution.@Anonymous", "To be perfectly honest, I never actually realized how much content Actually Additions has before.@Ellpeck", "I don't blame you, I actually downgraded to Actually Additions.@PvtSeaCow", "It is lonely because there is no device to fly items with the laser in the 1.7.10 version.@Google Translate", "始めまして。日本人です。このMODは本当に素晴らしいただ、1.7.10ヴァージョンだと、レーザーでアイテムを飛ばす装置がないので寂しいです。@Anonymous", "Some verses found in older translations, such as the KJV were actually additions made by later copyists.@Pat_Joel", "I can't place filters into Laser Relays, but the mod is very cool.@LP_Jakob", "Am I good enough to be an Actually Additions tool?@deanwhufc"}; // private static final String[] QUOTES = new String[]{"Actually Additions, to me, is quite magical in a way.@Saphrym", "Actually quite cool. Lots of nice little additions.@Direwolf20", "Mod Dev quite rude and arrogant@Bubb1e0seven", "A whimsical breath of fresh air in a stuffy tech-mod world.@mezz", "User-friendly :3@TheMeeep", "A lot of stuff, some of it really good.@Narubion", "I like the bookmarks.@Vazkii", "It's got some stuff I guess.@Ellpeck", "Actually Additions should be included in every new modpack that includes any form of tech.@YasminEndusa", "A mod that basically lets you do what ever the heck you want.@Ristelle", "TINY TORCHES!! BABY TORCHES!! Somebody actually finally did it!!@Soaryn", "Balanced mod wich makes things different - in a good way.@garantiertnicht", "The mod everyone needs, but not everyone knows@Brewpl", "The in-game documentation is the best Ive seen. I especially love the JEI integration. Even a derp like me can figure it out.@dannydjdk", "The second best mod I've ever used.@mmaas44", "The Fermenting Barrel is one of my favorite textures.@amadornes", "Smiley Clouds is the reason for fascism in 2016.@raoulvdberge", "The worms are an awesome idea!@greenking", "Can I use that mod in my pack?@Ibraheem", "Hello, love the mod.@SuntannedDuck2", "Quick! Have all the fun before they nerf it!@JuddMan03", "I have a feeling Actually Additions is also like Extra Utilities with Random things smashed together why is it...@lesslighter", "Leaf eater... munchdew... hummm@EiOs", "There is no such thing as canola seeds.@AlBoVa", "This mod is cancer, BRUTAL EXPENSIVE POWER usage..Just, cancer.@KoJo", "Spaghetti is spaghetti, and noodles are noodles.@robsonld04", "The Actually Additions name is actually true. It's actually great!@asiekierka", "Such a great mod@jsdeveloper", "That mod is kind of funny.@Anonymous", "Actually Additions is a lot of fun.@Anonymous", "Is Actually Additions still fugly?@Anonymous", "I like it, but it's so small.@Anonymous", "It has a couple of blocks I like, but overall it's just a mess.@Anonymous", "Direwolf's 1.10 playthrough is just him shilling Actually Additions@Anonymous", "We thought about sending the author a bunch of pizzas to his adress@Anonymous", "It's op as heck.@billofbong0", "Actually AdditionsってマイクラMODすごく良いのに日本人で遊んでる人あんまいないっぽい@stay_uk", "Actually Additions is OP. Not like my favorite combination of mods, Project E + Magic Crops + Draconic Evolution.@Anonymous", "To be perfectly honest, I never actually realized how much content Actually Additions has before.@Ellpeck", "I don't blame you, I actually downgraded to Actually Additions.@PvtSeaCow", "It is lonely because there is no device to fly items with the laser in the 1.7.10 version.@Google Translate", "始めまして。日本人です。このMODは本当に素晴らしいただ、1.7.10ヴァージョンだと、レーザーでアイテムを飛ばす装置がないので寂しいです。@Anonymous", "Some verses found in older translations, such as the KJV were actually additions made by later copyists.@Pat_Joel", "I can't place filters into Laser Relays, but the mod is very cool.@LP_Jakob", "Am I good enough to be an Actually Additions tool?@deanwhufc"};
//
//private TexturedButton achievementButton; // //private TexturedButton achievementButton;
private TexturedButton configButton; // private TexturedButton configButton;
//
private Button tutorialButton; // private Button tutorialButton;
private boolean showTutorial; // private boolean showTutorial;
//
private String bookletName; // private String bookletName;
private String bookletEdition; // private String bookletEdition;
//
private List<String> quote; // private List<String> quote;
private String quoteGuy; // private String quoteGuy;
//
public GuiMainPage(Screen previousScreen) { // public GuiMainPage(Screen previousScreen) {
super(previousScreen, null); // super(previousScreen, null);
} // }
//
private static List<IBookletEntry> getDisplayedEntries() { // private static List<IBookletEntry> getDisplayedEntries() {
List<IBookletEntry> displayed = new ArrayList<>(); // List<IBookletEntry> displayed = new ArrayList<>();
//
for (IBookletEntry entry : ActuallyAdditionsAPI.BOOKLET_ENTRIES) { // for (IBookletEntry entry : ActuallyAdditionsAPI.BOOKLET_ENTRIES) {
if (entry.visibleOnFrontPage()) { // if (entry.visibleOnFrontPage()) {
displayed.add(entry); // displayed.add(entry);
} // }
} // }
//
return displayed; // return displayed;
} // }
//
@Override // @Override
public void init() { // public void init() {
super.init(); // super.init();
//
int flavor = 1; // int flavor = 1;
if (this.getMinecraft().level.random.nextFloat() <= 0.1) { // if (this.getMinecraft().level.random.nextFloat() <= 0.1) {
flavor = MathHelper.nextInt(this.getMinecraft().level.random, 2, 7); // flavor = MathHelper.nextInt(this.getMinecraft().level.random, 2, 7);
} // }
this.bookletName = "info." + ActuallyAdditions.MODID + ".booklet.manualName.1." + flavor; // this.bookletName = "info." + ActuallyAdditions.MODID + ".booklet.manualName.1." + flavor;
//
String usedQuote = QUOTES[this.getMinecraft().level.random.nextInt(QUOTES.length)]; // String usedQuote = QUOTES[this.getMinecraft().level.random.nextInt(QUOTES.length)];
String[] quoteSplit = usedQuote.split("@"); // String[] quoteSplit = usedQuote.split("@");
if (quoteSplit.length == 2) { // if (quoteSplit.length == 2) {
//this.quote = this.font.listFormattedStringToWidth(quoteSplit[0], 120); //TODO wut // //this.quote = this.font.listFormattedStringToWidth(quoteSplit[0], 120); //TODO wut
this.quoteGuy = quoteSplit[1]; // this.quoteGuy = quoteSplit[1];
} // }
//
String playerName = this.getMinecraft().player.getName().getString(); // String playerName = this.getMinecraft().player.getName().getString();
if (playerName.equalsIgnoreCase("dqmhose")) { // if (playerName.equalsIgnoreCase("dqmhose")) {
this.bookletEdition = "Pants Edition"; // this.bookletEdition = "Pants Edition";
} else if (playerName.equalsIgnoreCase("TwoOfEight") || playerName.equalsIgnoreCase("BootyToast")) { // } else if (playerName.equalsIgnoreCase("TwoOfEight") || playerName.equalsIgnoreCase("BootyToast")) {
this.bookletEdition = "Illustrator's Edition"; // this.bookletEdition = "Illustrator's Edition";
} else if (playerName.equalsIgnoreCase("KittyVanCat")) { // } else if (playerName.equalsIgnoreCase("KittyVanCat")) {
this.bookletEdition = "Cat's Edition"; // this.bookletEdition = "Cat's Edition";
} else if (playerName.equalsIgnoreCase("canitzp")) { // } else if (playerName.equalsIgnoreCase("canitzp")) {
this.bookletEdition = "P's Edition"; // this.bookletEdition = "P's Edition";
} else if (playerName.equalsIgnoreCase("direwolf20")) { // } else if (playerName.equalsIgnoreCase("direwolf20")) {
this.bookletEdition = "Edition 20"; // this.bookletEdition = "Edition 20";
} else if (playerName.equalsIgnoreCase("dannydjdk") || playerName.equalsIgnoreCase("andrew_period")) { // } else if (playerName.equalsIgnoreCase("dannydjdk") || playerName.equalsIgnoreCase("andrew_period")) {
this.bookletEdition = "Derp's Edition"; // this.bookletEdition = "Derp's Edition";
} else if (playerName.equalsIgnoreCase("mezz")) { // } else if (playerName.equalsIgnoreCase("mezz")) {
this.bookletEdition = "Just Enough Editions"; // this.bookletEdition = "Just Enough Editions";
} else if (playerName.equalsIgnoreCase("amadornes")) { // } else if (playerName.equalsIgnoreCase("amadornes")) {
this.bookletEdition = "Beard's Edition"; // this.bookletEdition = "Beard's Edition";
} else if (playerName.equalsIgnoreCase("raoul")) { // } else if (playerName.equalsIgnoreCase("raoul")) {
this.bookletEdition = "Giraffe's Edition"; // this.bookletEdition = "Giraffe's Edition";
} else if (playerName.equalsIgnoreCase("ellpeck") || playerName.equalsIgnoreCase("profprospector")) { // } else if (playerName.equalsIgnoreCase("ellpeck") || playerName.equalsIgnoreCase("profprospector")) {
String[] colors = new String[15]; // String[] colors = new String[15];
for (int i = 0; i < colors.length; i++) { // for (int i = 0; i < colors.length; i++) {
colors[i] = TextFormatting.getById(this.getMinecraft().level.random.nextInt(15)).toString() + TextFormatting.ITALIC; // colors[i] = TextFormatting.getById(this.getMinecraft().level.random.nextInt(15)).toString() + TextFormatting.ITALIC;
} // }
this.bookletEdition = String.format("%sC%so%sl%so%sr%sf%su%sl %sE%sd%si%st%si%so%sn", (Object[]) colors); // this.bookletEdition = String.format("%sC%so%sl%so%sr%sf%su%sl %sE%sd%si%st%si%so%sn", (Object[]) colors);
} else if (playerName.equalsIgnoreCase("oitsjustjose")) { // } else if (playerName.equalsIgnoreCase("oitsjustjose")) {
this.bookletEdition = "oitsjustanedition"; // this.bookletEdition = "oitsjustanedition";
} else if (playerName.equalsIgnoreCase("xbony2")) { // } else if (playerName.equalsIgnoreCase("xbony2")) {
this.bookletEdition = "Naughty Edition"; // this.bookletEdition = "Naughty Edition";
} else if (playerName.equalsIgnoreCase("themattabase")) { // } else if (playerName.equalsIgnoreCase("themattabase")) {
this.bookletEdition = "Withered Edition"; // this.bookletEdition = "Withered Edition";
} else if (playerName.equalsIgnoreCase("robsonld04")) { // } else if (playerName.equalsIgnoreCase("robsonld04")) {
this.bookletEdition = "Modpack Edition"; // this.bookletEdition = "Modpack Edition";
} else if (playerName.equalsIgnoreCase("snowshock35")) { // } else if (playerName.equalsIgnoreCase("snowshock35")) {
this.bookletEdition = "Edition 35"; // this.bookletEdition = "Edition 35";
} else if (playerName.equalsIgnoreCase("asiekierka")) { // } else if (playerName.equalsIgnoreCase("asiekierka")) {
this.bookletEdition = "‽ Edition"; // this.bookletEdition = "‽ Edition";
} else if (playerName.equalsIgnoreCase("elucent")) { // } else if (playerName.equalsIgnoreCase("elucent")) {
this.bookletEdition = ""; // this.bookletEdition = "";
} else { // } else {
if (Util.isDevVersion()) { // if (Util.isDevVersion()) {
this.bookletEdition = "Dev's Edition"; // this.bookletEdition = "Dev's Edition";
} else { // } else {
this.bookletEdition = StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.edition") + " " + Util.getMajorModVersion(); // this.bookletEdition = StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.edition") + " " + Util.getMajorModVersion();
} // }
} // }
//
List<String> configText = new ArrayList<>(); // List<String> configText = new ArrayList<>();
configText.add(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".configButton.name")); // configText.add(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".configButton.name"));
//configText.addAll(this.font.listFormattedStringToWidth(StringUtil.localizeFormatted("booklet." + ActuallyAdditions.MODID + ".configButton.desc", ActuallyAdditions.NAME).replaceAll("\\\\n", "\n"), 200)); //TODO wut // //configText.addAll(this.font.listFormattedStringToWidth(StringUtil.localizeFormatted("booklet." + ActuallyAdditions.MODID + ".configButton.desc", ActuallyAdditions.NAME).replaceAll("\\\\n", "\n"), 200)); //TODO wut
this.configButton = new TexturedButton(RES_LOC_GADGETS, this.guiLeft + 16, this.guiTop + this.ySize - 30, 188, 14, 16, 16, configText, btn -> { // this.configButton = new TexturedButton(RES_LOC_GADGETS, this.guiLeft + 16, this.guiTop + this.ySize - 30, 188, 14, 16, 16, configText, btn -> {
}); // });
this.addButton(this.configButton); // this.addButton(this.configButton);
//
List<String> achievementText = new ArrayList<>(); // List<String> achievementText = new ArrayList<>();
achievementText.add(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".achievementButton.name")); // achievementText.add(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".achievementButton.name"));
//achievementText.addAll(this.font.listFormattedStringToWidth(StringUtil.localizeFormatted("booklet." + ActuallyAdditions.MODID + ".achievementButton.desc", ActuallyAdditions.NAME), 200)); //TODO wut // //achievementText.addAll(this.font.listFormattedStringToWidth(StringUtil.localizeFormatted("booklet." + ActuallyAdditions.MODID + ".achievementButton.desc", ActuallyAdditions.NAME), 200)); //TODO wut
//this.achievementButton = new TexturedButton(RES_LOC_GADGETS, -389, this.guiLeft+36, this.guiTop+this.ySize-30, 204, 14, 16, 16, achievementText); // //this.achievementButton = new TexturedButton(RES_LOC_GADGETS, -389, this.guiLeft+36, this.guiTop+this.ySize-30, 204, 14, 16, 16, achievementText);
//this.addButton(this.achievementButton); // //this.addButton(this.achievementButton);
//
PlayerSave data = PlayerData.getDataFromPlayer(this.getMinecraft().player); // PlayerSave data = PlayerData.getDataFromPlayer(this.getMinecraft().player);
if (!data.didBookTutorial) { // if (!data.didBookTutorial) {
this.showTutorial = true; // this.showTutorial = true;
//
//this.tutorialButton = new GuiButton(666666, this.guiLeft + 140 / 2 - 50, this.guiTop + 146, 100, 20, "Please click me <3"); // //this.tutorialButton = new GuiButton(666666, this.guiLeft + 140 / 2 - 50, this.guiTop + 146, 100, 20, "Please click me <3");
this.addButton(this.tutorialButton); // this.addButton(this.tutorialButton);
//
this.configButton.visible = false; // this.configButton.visible = false;
//this.achievementButton.visible = false; // //this.achievementButton.visible = false;
} // }
//
for (int i = 0; i < BUTTONS_PER_PAGE; i++) { // for (int i = 0; i < BUTTONS_PER_PAGE; i++) {
List<IBookletEntry> displayed = getDisplayedEntries(); // List<IBookletEntry> displayed = getDisplayedEntries();
if (displayed.size() > i) { // if (displayed.size() > i) {
IBookletEntry entry = displayed.get(i); // IBookletEntry entry = displayed.get(i);
this.addButton(new EntryButton(this, i, this.guiLeft + 156, this.guiTop + 11 + i * 13, 115, 10, "- " + entry.getLocalizedNameWithFormatting(), ItemStack.EMPTY)); // this.addButton(new EntryButton(this, i, this.guiLeft + 156, this.guiTop + 11 + i * 13, 115, 10, "- " + entry.getLocalizedNameWithFormatting(), ItemStack.EMPTY));
} else { // } else {
return; // return;
} // }
} // }
} // }
/* ///*
@Override // @Override
protected void actionPerformed(GuiButton button) throws IOException { // protected void actionPerformed(GuiButton button) throws IOException {
if (button instanceof EntryButton) { // if (button instanceof EntryButton) {
List<IBookletEntry> displayed = getDisplayedEntries(); // List<IBookletEntry> displayed = getDisplayedEntries();
if (displayed.size() > button.id) { // if (displayed.size() > button.id) {
IBookletEntry entry = displayed.get(button.id); // IBookletEntry entry = displayed.get(button.id);
if (entry != null) { // if (entry != null) {
this.getMinecraft().setScreen(new GuiEntry(this.previousScreen, this, entry, 0, "", false)); // this.getMinecraft().setScreen(new GuiEntry(this.previousScreen, this, entry, 0, "", false));
} // }
} // }
} // }
/*else if(button == this.achievementButton){ // /*else if(button == this.achievementButton){
GuiScreen achievements = new GuiAAAchievements(this, this.getMinecraft().player.getStatFileWriter()); // GuiScreen achievements = new GuiAAAchievements(this, this.getMinecraft().player.getStatFileWriter());
this.getMinecraft().displayGuiScreen(achievements); // this.getMinecraft().displayGuiScreen(achievements);
}*/ // }*/
/* // /*
else if (button == this.configButton) { // else if (button == this.configButton) {
GuiScreen config = new GuiConfiguration(this); // GuiScreen config = new GuiConfiguration(this);
this.getMinecraft().setScreen(config); // this.getMinecraft().setScreen(config);
} else if (this.showTutorial && button == this.tutorialButton) { // } else if (this.showTutorial && button == this.tutorialButton) {
if (this.hasBookmarkButtons()) { // if (this.hasBookmarkButtons()) {
if (!isShiftKeyDown()) { // if (!isShiftKeyDown()) {
for (int i = 0; i < InitBooklet.chaptersIntroduction.length; i++) { // for (int i = 0; i < InitBooklet.chaptersIntroduction.length; i++) {
this.bookmarkButtons[i].assignedPage = InitBooklet.chaptersIntroduction[i].getAllPages()[0]; // this.bookmarkButtons[i].assignedPage = InitBooklet.chaptersIntroduction[i].getAllPages()[0];
} // }
} // }
this.showTutorial = false; // this.showTutorial = false;
this.tutorialButton.visible = false; // this.tutorialButton.visible = false;
//
this.configButton.visible = true; // this.configButton.visible = true;
//this.achievementButton.visible = true; // //this.achievementButton.visible = true;
//
PlayerSave data = PlayerData.getDataFromPlayer(this.getMinecraft().player); // PlayerSave data = PlayerData.getDataFromPlayer(this.getMinecraft().player);
data.didBookTutorial = true; // data.didBookTutorial = true;
PacketHandlerHelper.sendPlayerDataToServer(false, 1); // PacketHandlerHelper.sendPlayerDataToServer(false, 1);
} // }
} else { // } else {
super.actionPerformed(button); // super.actionPerformed(button);
} // }
} // }
*/ // */
@Override // @Override
public void drawScreenPre(MatrixStack stack, int mouseX, int mouseY, float partialTicks) { // public void drawScreenPre(MatrixStack stack, int mouseX, int mouseY, float partialTicks) {
super.drawScreenPre(stack, mouseX, mouseY, partialTicks); // super.drawScreenPre(stack, mouseX, mouseY, partialTicks);
//
String strg = TextFormatting.DARK_GREEN + StringUtil.localize(this.bookletName); // String strg = TextFormatting.DARK_GREEN + StringUtil.localize(this.bookletName);
this.font.draw(stack, strg, this.guiLeft + 72 - this.font.width(strg) / 2 - 3, this.guiTop + 19, 0); // this.font.draw(stack, strg, this.guiLeft + 72 - this.font.width(strg) / 2 - 3, this.guiTop + 19, 0);
strg = TextFormatting.DARK_GREEN + StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.manualName.2"); // strg = TextFormatting.DARK_GREEN + StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.manualName.2");
this.font.draw(stack, strg, this.guiLeft + 72 - this.font.width(strg) / 2 - 3, this.guiTop + 19 + this.font.lineHeight, 0); // this.font.draw(stack, strg, this.guiLeft + 72 - this.font.width(strg) / 2 - 3, this.guiTop + 19 + this.font.lineHeight, 0);
//
strg = TextFormatting.GOLD + TextFormatting.ITALIC.toString() + this.bookletEdition; // strg = TextFormatting.GOLD + TextFormatting.ITALIC.toString() + this.bookletEdition;
this.font.draw(stack, strg, this.guiLeft + 72 - this.font.width(strg) / 2 - 3, this.guiTop + 40, 0); // this.font.draw(stack, strg, this.guiLeft + 72 - this.font.width(strg) / 2 - 3, this.guiTop + 40, 0);
//
if (this.showTutorial) { // if (this.showTutorial) {
String text = TextFormatting.BLUE + "It looks like this is the first time you are using this manual. \nIf you click the button below, some useful bookmarks will be stored at the bottom of the GUI. You should definitely check them out to get started with " + ActuallyAdditions.NAME + "! \nIf you don't want this, shift-click the button."; // String text = TextFormatting.BLUE + "It looks like this is the first time you are using this manual. \nIf you click the button below, some useful bookmarks will be stored at the bottom of the GUI. You should definitely check them out to get started with " + ActuallyAdditions.NAME + "! \nIf you don't want this, shift-click the button.";
this.renderSplitScaledAsciiString(text, this.guiLeft + 11, this.guiTop + 55, 0, false, this.getMediumFontSize(), 120); // this.renderSplitScaledAsciiString(text, this.guiLeft + 11, this.guiTop + 55, 0, false, this.getMediumFontSize(), 120);
} else if (this.quote != null && !this.quote.isEmpty() && this.quoteGuy != null) { // } else if (this.quote != null && !this.quote.isEmpty() && this.quoteGuy != null) {
int quoteSize = this.quote.size(); // int quoteSize = this.quote.size();
//
for (int i = 0; i < quoteSize; i++) { // for (int i = 0; i < quoteSize; i++) {
this.renderScaledAsciiString(TextFormatting.ITALIC + this.quote.get(i), this.guiLeft + 25, this.guiTop + 90 + i * 8, 0, false, this.getMediumFontSize()); // this.renderScaledAsciiString(TextFormatting.ITALIC + this.quote.get(i), this.guiLeft + 25, this.guiTop + 90 + i * 8, 0, false, this.getMediumFontSize());
} // }
this.renderScaledAsciiString("- " + this.quoteGuy, this.guiLeft + 60, this.guiTop + 93 + quoteSize * 8, 0, false, this.getLargeFontSize()); // this.renderScaledAsciiString("- " + this.quoteGuy, this.guiLeft + 60, this.guiTop + 93 + quoteSize * 8, 0, false, this.getLargeFontSize());
} // }
} // }
//
@Override // @Override
public void addOrModifyItemRenderer(ItemStack renderedStack, int x, int y, float scale, boolean shouldTryTransfer) { // public void addOrModifyItemRenderer(ItemStack renderedStack, int x, int y, float scale, boolean shouldTryTransfer) {
//
} // }
} //}

View file

@ -1,289 +1,289 @@
/* ///*
* This file ("GuiPage.java") is part of the Actually Additions mod for Minecraft. // * This file ("GuiPage.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed // * It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at // * under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense // * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* // *
* © 2015-2017 Ellpeck // * © 2015-2017 Ellpeck
*/ // */
//
package de.ellpeck.actuallyadditions.mod.booklet.gui; //package de.ellpeck.actuallyadditions.mod.booklet.gui;
//
import com.mojang.blaze3d.matrix.MatrixStack; //import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager; //import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem; //import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; //import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; //import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; //import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; //import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils; //import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
import de.ellpeck.actuallyadditions.mod.booklet.page.ItemDisplay; //import de.ellpeck.actuallyadditions.mod.booklet.page.ItemDisplay;
import de.ellpeck.actuallyadditions.mod.inventory.gui.TexturedButton; //import de.ellpeck.actuallyadditions.mod.inventory.gui.TexturedButton;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; //import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.gui.screen.Screen; //import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.button.Button; //import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.item.ItemStack; //import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextFormatting; //import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.api.distmarker.Dist; //import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; //import net.minecraftforge.api.distmarker.OnlyIn;
//
import java.awt.*; //import java.awt.*;
import java.io.IOException; //import java.io.IOException;
import java.net.URI; //import java.net.URI;
import java.util.ArrayList; //import java.util.ArrayList;
import java.util.Collections; //import java.util.Collections;
import java.util.List; //import java.util.List;
//
@OnlyIn(Dist.CLIENT) //@OnlyIn(Dist.CLIENT)
public class GuiPage extends GuiBooklet { //public class GuiPage extends GuiBooklet {
//
public final IBookletPage[] pages = new IBookletPage[2]; // public final IBookletPage[] pages = new IBookletPage[2];
private final List<ItemDisplay> itemDisplays = new ArrayList<>(); // private final List<ItemDisplay> itemDisplays = new ArrayList<>();
private int pageTimer; // private int pageTimer;
//
private Button buttonViewOnline; // private Button buttonViewOnline;
//
public GuiPage(Screen previousScreen, GuiBookletBase parentPage, IBookletPage page1, IBookletPage page2) { // public GuiPage(Screen previousScreen, GuiBookletBase parentPage, IBookletPage page1, IBookletPage page2) {
super(previousScreen, parentPage); // super(previousScreen, parentPage);
//
this.pages[0] = page1; // this.pages[0] = page1;
this.pages[1] = page2; // this.pages[1] = page2;
} // }
//
@Override // @Override
public void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { // public void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
super.mouseClicked(mouseX, mouseY, mouseButton); // super.mouseClicked(mouseX, mouseY, mouseButton);
//
for (ItemDisplay display : this.itemDisplays) { // for (ItemDisplay display : this.itemDisplays) {
display.onMousePress(mouseButton, mouseX, mouseY); // display.onMousePress(mouseButton, mouseX, mouseY);
} // }
//
for (IBookletPage page : this.pages) { // for (IBookletPage page : this.pages) {
if (page != null) { // if (page != null) {
page.mouseClicked(this, mouseX, mouseY, mouseButton); // page.mouseClicked(this, mouseX, mouseY, mouseButton);
} // }
} // }
} // }
//
@Override // @Override
public void mouseReleased(int mouseX, int mouseY, int state) { // public void mouseReleased(int mouseX, int mouseY, int state) {
super.mouseReleased(mouseX, mouseY, state); // super.mouseReleased(mouseX, mouseY, state);
//
for (IBookletPage page : this.pages) { // for (IBookletPage page : this.pages) {
if (page != null) { // if (page != null) {
page.mouseReleased(this, mouseX, mouseY, state); // page.mouseReleased(this, mouseX, mouseY, state);
} // }
} // }
} // }
//
@Override // @Override
public void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) { // public void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
super.mouseClickMove(mouseX, mouseY, clickedMouseButton, timeSinceLastClick); // super.mouseClickMove(mouseX, mouseY, clickedMouseButton, timeSinceLastClick);
//
for (IBookletPage page : this.pages) { // for (IBookletPage page : this.pages) {
if (page != null) { // if (page != null) {
page.mouseClickMove(this, mouseX, mouseY, clickedMouseButton, timeSinceLastClick); // page.mouseClickMove(this, mouseX, mouseY, clickedMouseButton, timeSinceLastClick);
} // }
} // }
} // }
/* ///*
@Override // @Override
public void actionPerformed(GuiButton button) throws IOException { // public void actionPerformed(GuiButton button) throws IOException {
if (button == this.buttonViewOnline) { // if (button == this.buttonViewOnline) {
List<String> links = this.getWebLinks(); // List<String> links = this.getWebLinks();
if (Desktop.isDesktopSupported()) { // if (Desktop.isDesktopSupported()) {
for (String link : links) { // for (String link : links) {
try { // try {
Desktop.getDesktop().browse(new URI(link)); // Desktop.getDesktop().browse(new URI(link));
} catch (Exception e) { // } catch (Exception e) {
ActuallyAdditions.LOGGER.error("Couldn't open website from Booklet page!", e); // ActuallyAdditions.LOGGER.error("Couldn't open website from Booklet page!", e);
} // }
} // }
} // }
} else { // } else {
super.actionPerformed(button); // super.actionPerformed(button);
//
for (IBookletPage page : this.pages) { // for (IBookletPage page : this.pages) {
if (page != null) { // if (page != null) {
page.actionPerformed(this, button); // page.actionPerformed(this, button);
} // }
} // }
} // }
} // }
*/ // */
@Override // @Override
public void init() { // public void init() {
this.itemDisplays.clear(); // this.itemDisplays.clear();
super.init(); // super.init();
//
List<String> links = this.getWebLinks(); // List<String> links = this.getWebLinks();
if (links != null && !links.isEmpty()) { // if (links != null && !links.isEmpty()) {
this.buttonViewOnline = new TexturedButton(RES_LOC_GADGETS, this.guiLeft + this.xSize - 24, this.guiTop + this.ySize - 25, 0, 172, 16, 16, Collections.singletonList(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".onlineButton.name")), btn -> { // this.buttonViewOnline = new TexturedButton(RES_LOC_GADGETS, this.guiLeft + this.xSize - 24, this.guiTop + this.ySize - 25, 0, 172, 16, 16, Collections.singletonList(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".onlineButton.name")), btn -> {
}); // });
this.addButton(this.buttonViewOnline); // this.addButton(this.buttonViewOnline);
} // }
//
for (int i = 0; i < this.pages.length; i++) { // for (int i = 0; i < this.pages.length; i++) {
IBookletPage page = this.pages[i]; // IBookletPage page = this.pages[i];
if (page != null) { // if (page != null) {
page.init(this, this.guiLeft + 6 + i * 142, this.guiTop + 7); // page.init(this, this.guiLeft + 6 + i * 142, this.guiTop + 7);
} // }
} // }
} // }
//
private List<String> getWebLinks() { // private List<String> getWebLinks() {
List<String> links = new ArrayList<>(); // List<String> links = new ArrayList<>();
//
for (IBookletPage page : this.pages) { // for (IBookletPage page : this.pages) {
if (page != null) { // if (page != null) {
String link = page.getWebLink(); // String link = page.getWebLink();
if (link != null && !links.contains(link)) { // if (link != null && !links.contains(link)) {
links.add(link); // links.add(link);
} // }
} // }
} // }
//
return links; // return links;
} // }
//
@Override // @Override
public void tick() { // public void tick() {
super.tick(); // super.tick();
//
for (int i = 0; i < this.pages.length; i++) { // for (int i = 0; i < this.pages.length; i++) {
IBookletPage page = this.pages[i]; // IBookletPage page = this.pages[i];
if (page != null) { // if (page != null) {
page.updateScreen(this, this.guiLeft + 6 + i * 142, this.guiTop + 7, this.pageTimer); // page.updateScreen(this, this.guiLeft + 6 + i * 142, this.guiTop + 7, this.pageTimer);
} // }
} // }
//
this.pageTimer++; // this.pageTimer++;
} // }
//
@Override // @Override
public void drawScreenPre(MatrixStack stack, int mouseX, int mouseY, float partialTicks) { // public void drawScreenPre(MatrixStack stack, int mouseX, int mouseY, float partialTicks) {
super.drawScreenPre(stack, mouseX, mouseY, partialTicks); // super.drawScreenPre(stack, mouseX, mouseY, partialTicks);
//
if (this.pages[0] != null) { // if (this.pages[0] != null) {
IBookletChapter chapter = this.pages[0].getChapter(); // IBookletChapter chapter = this.pages[0].getChapter();
String name = chapter.getLocalizedName(); // String name = chapter.getLocalizedName();
this.font.draw(stack, name, this.guiLeft + this.xSize / 2 - this.font.width(name) / 2, this.guiTop - 1, 0xFFFFFF); // this.font.draw(stack, name, this.guiLeft + this.xSize / 2 - this.font.width(name) / 2, this.guiTop - 1, 0xFFFFFF);
} // }
//
for (int i = 0; i < this.pages.length; i++) { // for (int i = 0; i < this.pages.length; i++) {
IBookletPage page = this.pages[i]; // IBookletPage page = this.pages[i];
if (page != null) { // if (page != null) {
IBookletChapter chapter = this.pages[i].getChapter(); // IBookletChapter chapter = this.pages[i].getChapter();
String pageStrg = "Page " + (chapter.getPageIndex(this.pages[i]) + 1) + "/" + chapter.getAllPages().length; // String pageStrg = "Page " + (chapter.getPageIndex(this.pages[i]) + 1) + "/" + chapter.getAllPages().length;
this.renderScaledAsciiString(pageStrg, this.guiLeft + 25 + i * 136, this.guiTop + this.ySize - 7, 0xFFFFFF, false, this.getLargeFontSize()); // this.renderScaledAsciiString(pageStrg, this.guiLeft + 25 + i * 136, this.guiTop + this.ySize - 7, 0xFFFFFF, false, this.getLargeFontSize());
//
RenderSystem.color3f(1f, 1f, 1f); // RenderSystem.color3f(1f, 1f, 1f);
page.drawScreenPre(this, this.guiLeft + 6 + i * 142, this.guiTop + 7, mouseX, mouseY, partialTicks); // page.drawScreenPre(this, this.guiLeft + 6 + i * 142, this.guiTop + 7, mouseX, mouseY, partialTicks);
} // }
} // }
for (ItemDisplay display : this.itemDisplays) { // for (ItemDisplay display : this.itemDisplays) {
display.drawPre(); // display.drawPre();
} // }
} // }
//
@Override // @Override
public void drawScreenPost(MatrixStack stack, int mouseX, int mouseY, float partialTicks) { // public void drawScreenPost(MatrixStack stack, int mouseX, int mouseY, float partialTicks) {
super.drawScreenPost(stack, mouseX, mouseY, partialTicks); // super.drawScreenPost(stack, mouseX, mouseY, partialTicks);
//
for (int i = 0; i < this.pages.length; i++) { // for (int i = 0; i < this.pages.length; i++) {
IBookletPage page = this.pages[i]; // IBookletPage page = this.pages[i];
if (page != null) { // if (page != null) {
RenderSystem.color3f(1F, 1F, 1F); // RenderSystem.color3f(1F, 1F, 1F);
page.drawScreenPost(this, this.guiLeft + 6 + i * 142, this.guiTop + 7, mouseX, mouseY, partialTicks); // page.drawScreenPost(this, this.guiLeft + 6 + i * 142, this.guiTop + 7, mouseX, mouseY, partialTicks);
} // }
} // }
for (ItemDisplay display : this.itemDisplays) { // for (ItemDisplay display : this.itemDisplays) {
display.drawPost(mouseX, mouseY); // display.drawPost(mouseX, mouseY);
} // }
} // }
//
@Override // @Override
public void addOrModifyItemRenderer(ItemStack renderedStack, int x, int y, float scale, boolean shouldTryTransfer) { // public void addOrModifyItemRenderer(ItemStack renderedStack, int x, int y, float scale, boolean shouldTryTransfer) {
for (ItemDisplay display : this.itemDisplays) { // for (ItemDisplay display : this.itemDisplays) {
if (display.x == x && display.y == y && display.scale == scale) { // if (display.x == x && display.y == y && display.scale == scale) {
display.stack = renderedStack; // display.stack = renderedStack;
return; // return;
} // }
} // }
//
this.itemDisplays.add(new ItemDisplay(this, x, y, scale, renderedStack, shouldTryTransfer)); // this.itemDisplays.add(new ItemDisplay(this, x, y, scale, renderedStack, shouldTryTransfer));
} // }
//
@Override // @Override
public boolean hasPageLeftButton() { // public boolean hasPageLeftButton() {
IBookletPage page = this.pages[0]; // IBookletPage page = this.pages[0];
if (page != null) { // if (page != null) {
IBookletChapter chapter = page.getChapter(); // IBookletChapter chapter = page.getChapter();
if (chapter != null) { // if (chapter != null) {
return chapter.getPageIndex(page) > 0; // return chapter.getPageIndex(page) > 0;
} // }
} // }
return false; // return false;
} // }
//
@Override // @Override
public void onPageLeftButtonPressed() { // public void onPageLeftButtonPressed() {
IBookletPage page = this.pages[0]; // IBookletPage page = this.pages[0];
if (page != null) { // if (page != null) {
IBookletChapter chapter = page.getChapter(); // IBookletChapter chapter = page.getChapter();
if (chapter != null) { // if (chapter != null) {
IBookletPage[] pages = chapter.getAllPages(); // IBookletPage[] pages = chapter.getAllPages();
//
int pageNumToOpen = chapter.getPageIndex(page) - 1; // int pageNumToOpen = chapter.getPageIndex(page) - 1;
if (pageNumToOpen >= 0 && pageNumToOpen < pages.length) { // if (pageNumToOpen >= 0 && pageNumToOpen < pages.length) {
this.minecraft.setScreen(BookletUtils.createPageGui(this.previousScreen, this.parentPage, pages[pageNumToOpen])); // this.minecraft.setScreen(BookletUtils.createPageGui(this.previousScreen, this.parentPage, pages[pageNumToOpen]));
} // }
} // }
} // }
} // }
//
@Override // @Override
public boolean hasPageRightButton() { // public boolean hasPageRightButton() {
IBookletPage page = this.pages[1]; // IBookletPage page = this.pages[1];
if (page != null) { // if (page != null) {
IBookletChapter chapter = page.getChapter(); // IBookletChapter chapter = page.getChapter();
if (chapter != null) { // if (chapter != null) {
int pageIndex = chapter.getPageIndex(page); // int pageIndex = chapter.getPageIndex(page);
int pageAmount = chapter.getAllPages().length; // int pageAmount = chapter.getAllPages().length;
return pageIndex + 1 < pageAmount; // return pageIndex + 1 < pageAmount;
} // }
} // }
return false; // return false;
} // }
//
@Override // @Override
public void onPageRightButtonPressed() { // public void onPageRightButtonPressed() {
IBookletPage page = this.pages[1]; // IBookletPage page = this.pages[1];
if (page != null) { // if (page != null) {
IBookletChapter chapter = page.getChapter(); // IBookletChapter chapter = page.getChapter();
if (chapter != null) { // if (chapter != null) {
IBookletPage[] pages = chapter.getAllPages(); // IBookletPage[] pages = chapter.getAllPages();
//
int pageNumToOpen = chapter.getPageIndex(page) + 1; // int pageNumToOpen = chapter.getPageIndex(page) + 1;
if (pageNumToOpen >= 0 && pageNumToOpen < pages.length) { // if (pageNumToOpen >= 0 && pageNumToOpen < pages.length) {
this.minecraft.setScreen(BookletUtils.createPageGui(this.previousScreen, this.parentPage, pages[pageNumToOpen])); // this.minecraft.setScreen(BookletUtils.createPageGui(this.previousScreen, this.parentPage, pages[pageNumToOpen]));
} // }
} // }
} // }
} // }
//
@Override // @Override
public boolean hasBackButton() { // public boolean hasBackButton() {
return true; // return true;
} // }
//
@Override // @Override
public void onBackButtonPressed() { // public void onBackButtonPressed() {
if (!hasShiftDown()) { // if (!hasShiftDown()) {
this.minecraft.setScreen(this.parentPage); // this.minecraft.setScreen(this.parentPage);
} else { // } else {
super.onBackButtonPressed(); // super.onBackButtonPressed();
} // }
} // }
} //}

View file

@ -1,92 +1,92 @@
/* ///*
* This file ("BookletUtils.java") is part of the Actually Additions mod for Minecraft. // * This file ("BookletUtils.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed // * It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at // * under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense // * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* // *
* © 2015-2017 Ellpeck // * © 2015-2017 Ellpeck
*/ // */
//
package de.ellpeck.actuallyadditions.mod.booklet.misc; //package de.ellpeck.actuallyadditions.mod.booklet.misc;
//
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; //import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; //import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; //import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; //import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiEntry; //import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiEntry;
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiMainPage; //import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiMainPage;
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiPage; //import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiPage;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil; //import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import net.minecraft.client.gui.screen.Screen; //import net.minecraft.client.gui.screen.Screen;
import net.minecraft.item.ItemStack; //import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList; //import net.minecraft.util.NonNullList;
import net.minecraftforge.api.distmarker.Dist; //import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; //import net.minecraftforge.api.distmarker.OnlyIn;
//
import java.util.List; //import java.util.List;
//
public final class BookletUtils { //public final class BookletUtils {
//
public static IBookletPage findFirstPageForStack(ItemStack stack) { // public static IBookletPage findFirstPageForStack(ItemStack stack) {
for (IBookletPage page : ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA) { // for (IBookletPage page : ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA) {
List<ItemStack> stacks = NonNullList.create(); // List<ItemStack> stacks = NonNullList.create();
page.getItemStacksForPage(stacks); // page.getItemStacksForPage(stacks);
if (stacks != null && !stacks.isEmpty()) { // if (stacks != null && !stacks.isEmpty()) {
for (ItemStack pageStack : stacks) { // for (ItemStack pageStack : stacks) {
if (ItemUtil.areItemsEqual(pageStack, stack, true)) { // if (ItemUtil.areItemsEqual(pageStack, stack, true)) {
return page; // return page;
} // }
} // }
} // }
} // }
return null; // return null;
} // }
//
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public static GuiPage createBookletGuiFromPage(Screen previousScreen, IBookletPage page) { // public static GuiPage createBookletGuiFromPage(Screen previousScreen, IBookletPage page) {
GuiMainPage mainPage = new GuiMainPage(previousScreen); // GuiMainPage mainPage = new GuiMainPage(previousScreen);
//
IBookletChapter chapter = page.getChapter(); // IBookletChapter chapter = page.getChapter();
GuiEntry entry = new GuiEntry(previousScreen, mainPage, chapter.getEntry(), chapter, "", false); // GuiEntry entry = new GuiEntry(previousScreen, mainPage, chapter.getEntry(), chapter, "", false);
//
return createPageGui(previousScreen, entry, page); // return createPageGui(previousScreen, entry, page);
} // }
//
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public static GuiPage createPageGui(Screen previousScreen, GuiBookletBase parentPage, IBookletPage page) { // public static GuiPage createPageGui(Screen previousScreen, GuiBookletBase parentPage, IBookletPage page) {
IBookletChapter chapter = page.getChapter(); // IBookletChapter chapter = page.getChapter();
//
IBookletPage[] allPages = chapter.getAllPages(); // IBookletPage[] allPages = chapter.getAllPages();
int pageIndex = chapter.getPageIndex(page); // int pageIndex = chapter.getPageIndex(page);
IBookletPage page1; // IBookletPage page1;
IBookletPage page2; // IBookletPage page2;
//
if (page.shouldBeOnLeftSide()) { // if (page.shouldBeOnLeftSide()) {
page1 = page; // page1 = page;
page2 = pageIndex >= allPages.length - 1 // page2 = pageIndex >= allPages.length - 1
? null // ? null
: allPages[pageIndex + 1]; // : allPages[pageIndex + 1];
} else { // } else {
page1 = pageIndex <= 0 // page1 = pageIndex <= 0
? null // ? null
: allPages[pageIndex - 1]; // : allPages[pageIndex - 1];
page2 = page; // page2 = page;
} // }
//
return new GuiPage(previousScreen, parentPage, page1, page2); // return new GuiPage(previousScreen, parentPage, page1, page2);
} // }
//
public static IBookletPage getBookletPageById(String id) { // public static IBookletPage getBookletPageById(String id) {
if (id != null) { // if (id != null) {
for (IBookletChapter chapter : ActuallyAdditionsAPI.ALL_CHAPTERS) { // for (IBookletChapter chapter : ActuallyAdditionsAPI.ALL_CHAPTERS) {
for (IBookletPage page : chapter.getAllPages()) { // for (IBookletPage page : chapter.getAllPages()) {
if (id.equals(page.getIdentifier())) { // if (id.equals(page.getIdentifier())) {
return page; // return page;
} // }
} // }
} // }
} // }
return null; // return null;
} // }
} //}

View file

@ -1,199 +1,199 @@
/* ///*
* This file ("BookletPage.java") is part of the Actually Additions mod for Minecraft. // * This file ("BookletPage.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed // * It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at // * under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense // * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* // *
* © 2015-2017 Ellpeck // * © 2015-2017 Ellpeck
*/ // */
//
package de.ellpeck.actuallyadditions.mod.booklet.page; //package de.ellpeck.actuallyadditions.mod.booklet.page;
//
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; //import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; //import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; //import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; //import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; //import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.block.Block; //import net.minecraft.block.Block;
import net.minecraft.client.gui.widget.button.Button; //import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.fluid.Fluid; //import net.minecraft.fluid.Fluid;
import net.minecraft.item.ItemStack; //import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextFormatting; //import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.api.distmarker.Dist; //import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; //import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fluids.FluidStack; //import net.minecraftforge.fluids.FluidStack;
//
import java.util.*; //import java.util.*;
//
public class BookletPage implements IBookletPage { //public class BookletPage implements IBookletPage {
//
protected final HashMap<String, String> textReplacements = new HashMap<>(); // protected final HashMap<String, String> textReplacements = new HashMap<>();
protected final int localizationKey; // protected final int localizationKey;
private final int priority; // private final int priority;
private final List<ItemStack> itemsForPage = new ArrayList<>(); // private final List<ItemStack> itemsForPage = new ArrayList<>();
private final List<FluidStack> fluidsForPage = new ArrayList<>(); // private final List<FluidStack> fluidsForPage = new ArrayList<>();
protected IBookletChapter chapter; // protected IBookletChapter chapter;
protected boolean hasNoText; // protected boolean hasNoText;
//
public BookletPage(int localizationKey) { // public BookletPage(int localizationKey) {
this(localizationKey, 0); // this(localizationKey, 0);
} // }
//
public BookletPage(int localizationKey, int priority) { // public BookletPage(int localizationKey, int priority) {
this.localizationKey = localizationKey; // this.localizationKey = localizationKey;
this.priority = priority; // this.priority = priority;
} // }
//
@Override // @Override
public void getItemStacksForPage(List<ItemStack> list) { // public void getItemStacksForPage(List<ItemStack> list) {
list.addAll(this.itemsForPage); // list.addAll(this.itemsForPage);
} // }
//
@Override // @Override
public void getFluidStacksForPage(List<FluidStack> list) { // public void getFluidStacksForPage(List<FluidStack> list) {
list.addAll(this.fluidsForPage); // list.addAll(this.fluidsForPage);
} // }
//
@Override // @Override
public IBookletChapter getChapter() { // public IBookletChapter getChapter() {
return this.chapter; // return this.chapter;
} // }
//
@Override // @Override
public void setChapter(IBookletChapter chapter) { // public void setChapter(IBookletChapter chapter) {
this.chapter = chapter; // this.chapter = chapter;
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public String getInfoText() { // public String getInfoText() {
if (this.hasNoText) { // if (this.hasNoText) {
return null; // return null;
} // }
//
String base = StringUtil.localize(this.getLocalizationKey()); // String base = StringUtil.localize(this.getLocalizationKey());
base = base.replaceAll("<imp>", TextFormatting.DARK_GREEN + ""); // base = base.replaceAll("<imp>", TextFormatting.DARK_GREEN + "");
base = base.replaceAll("<item>", TextFormatting.BLUE + ""); // base = base.replaceAll("<item>", TextFormatting.BLUE + "");
base = base.replaceAll("<r>", TextFormatting.BLACK + ""); // base = base.replaceAll("<r>", TextFormatting.BLACK + "");
base = base.replaceAll("<n>", "\n"); // base = base.replaceAll("<n>", "\n");
base = base.replaceAll("<i>", TextFormatting.ITALIC + ""); // base = base.replaceAll("<i>", TextFormatting.ITALIC + "");
base = base.replaceAll("<tifisgrin>", TextFormatting.DARK_RED + "" + TextFormatting.UNDERLINE); //This is fucking important so go read it now // base = base.replaceAll("<tifisgrin>", TextFormatting.DARK_RED + "" + TextFormatting.UNDERLINE); //This is fucking important so go read it now
//
for (Map.Entry<String, String> entry : this.textReplacements.entrySet()) { // for (Map.Entry<String, String> entry : this.textReplacements.entrySet()) {
base = base.replaceAll(entry.getKey(), entry.getValue()); // base = base.replaceAll(entry.getKey(), entry.getValue());
} // }
return base; // return base;
} // }
//
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
protected String getLocalizationKey() { // protected String getLocalizationKey() {
return "booklet." + ActuallyAdditions.MODID + ".chapter." + this.chapter.getIdentifier() + ".text." + this.localizationKey; // return "booklet." + ActuallyAdditions.MODID + ".chapter." + this.chapter.getIdentifier() + ".text." + this.localizationKey;
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public void mouseClicked(GuiBookletBase gui, int mouseX, int mouseY, int mouseButton) { // public void mouseClicked(GuiBookletBase gui, int mouseX, int mouseY, int mouseButton) {
//
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public void mouseReleased(GuiBookletBase gui, int mouseX, int mouseY, int state) { // public void mouseReleased(GuiBookletBase gui, int mouseX, int mouseY, int state) {
//
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public void mouseClickMove(GuiBookletBase gui, int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) { // public void mouseClickMove(GuiBookletBase gui, int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
//
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public void actionPerformed(GuiBookletBase gui, Button button) { // public void actionPerformed(GuiBookletBase gui, Button button) {
//
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public void init(GuiBookletBase gui, int startX, int startY) { // public void init(GuiBookletBase gui, int startX, int startY) {
//
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public void updateScreen(GuiBookletBase gui, int startX, int startY, int pageTimer) { // public void updateScreen(GuiBookletBase gui, int startX, int startY, int pageTimer) {
//
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { // public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
//
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public void drawScreenPost(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { // public void drawScreenPost(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
//
} // }
//
@Override // @Override
public boolean shouldBeOnLeftSide() { // public boolean shouldBeOnLeftSide() {
return (this.chapter.getPageIndex(this) + 1) % 2 != 0; // return (this.chapter.getPageIndex(this) + 1) % 2 != 0;
} // }
//
@Override // @Override
public String getIdentifier() { // public String getIdentifier() {
return this.chapter.getIdentifier() + "." + this.chapter.getPageIndex(this); // return this.chapter.getIdentifier() + "." + this.chapter.getPageIndex(this);
} // }
//
@Override // @Override
public String getWebLink() { // public String getWebLink() {
return "http://ellpeck.de/actaddmanual#" + this.chapter.getIdentifier(); // return "http://ellpeck.de/actaddmanual#" + this.chapter.getIdentifier();
} // }
//
public BookletPage setNoText() { // public BookletPage setNoText() {
this.hasNoText = true; // this.hasNoText = true;
return this; // return this;
} // }
//
public BookletPage addFluidToPage(Fluid fluid) { // public BookletPage addFluidToPage(Fluid fluid) {
this.fluidsForPage.add(new FluidStack(fluid, 1)); // this.fluidsForPage.add(new FluidStack(fluid, 1));
return this; // return this;
} // }
//
public BookletPage addItemsToPage(Block... blocks) { // public BookletPage addItemsToPage(Block... blocks) {
for (Block block : blocks) { // for (Block block : blocks) {
this.addItemsToPage(new ItemStack(block)); // this.addItemsToPage(new ItemStack(block));
} // }
return this; // return this;
} // }
//
public BookletPage addItemsToPage(ItemStack... stacks) { // public BookletPage addItemsToPage(ItemStack... stacks) {
Collections.addAll(this.itemsForPage, stacks); // Collections.addAll(this.itemsForPage, stacks);
return this; // return this;
} // }
//
@Override // @Override
public BookletPage addTextReplacement(String key, String value) { // public BookletPage addTextReplacement(String key, String value) {
this.textReplacements.put(key, value); // this.textReplacements.put(key, value);
return this; // return this;
} // }
//
@Override // @Override
public BookletPage addTextReplacement(String key, float value) { // public BookletPage addTextReplacement(String key, float value) {
return this.addTextReplacement(key, Float.toString(value)); // return this.addTextReplacement(key, Float.toString(value));
} // }
//
@Override // @Override
public BookletPage addTextReplacement(String key, int value) { // public BookletPage addTextReplacement(String key, int value) {
return this.addTextReplacement(key, Integer.toString(value)); // return this.addTextReplacement(key, Integer.toString(value));
} // }
//
@Override // @Override
public int getSortingPriority() { // public int getSortingPriority() {
return this.priority; // return this.priority;
} // }
} //}

View file

@ -1,99 +1,99 @@
/* ///*
* This file ("ItemDisplay.java") is part of the Actually Additions mod for Minecraft. // * This file ("ItemDisplay.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed // * It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at // * under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense // * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* // *
* © 2015-2017 Ellpeck // * © 2015-2017 Ellpeck
*/ // */
//
package de.ellpeck.actuallyadditions.mod.booklet.page; //package de.ellpeck.actuallyadditions.mod.booklet.page;
//
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage; //import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; //import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; //import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiPage; //import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiPage;
import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils; //import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; //import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; //import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.Minecraft; //import net.minecraft.client.Minecraft;
import net.minecraft.client.util.ITooltipFlag.TooltipFlags; //import net.minecraft.client.util.ITooltipFlag.TooltipFlags;
import net.minecraft.item.ItemStack; //import net.minecraft.item.ItemStack;
import net.minecraft.util.SoundEvents; //import net.minecraft.util.SoundEvents;
import net.minecraft.util.text.TextFormatting; //import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.api.distmarker.Dist; //import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; //import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.client.gui.GuiUtils; //import net.minecraftforge.fml.client.gui.GuiUtils;
//
import java.util.List; //import java.util.List;
//
public class ItemDisplay { //public class ItemDisplay {
//
public final int x; // public final int x;
public final int y; // public final int y;
public final float scale; // public final float scale;
private final GuiPage gui; // private final GuiPage gui;
private final IBookletPage page; // private final IBookletPage page;
public ItemStack stack; // public ItemStack stack;
//
public ItemDisplay(GuiPage gui, int x, int y, float scale, ItemStack stack, boolean shouldTryTransfer) { // public ItemDisplay(GuiPage gui, int x, int y, float scale, ItemStack stack, boolean shouldTryTransfer) {
this.gui = gui; // this.gui = gui;
this.x = x; // this.x = x;
this.y = y; // this.y = y;
this.scale = scale; // this.scale = scale;
this.stack = stack; // this.stack = stack;
this.page = shouldTryTransfer // this.page = shouldTryTransfer
? BookletUtils.findFirstPageForStack(stack) // ? BookletUtils.findFirstPageForStack(stack)
: null; // : null;
} // }
//
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public void drawPre() { // public void drawPre() {
AssetUtil.renderStackToGui(this.stack, this.x, this.y, this.scale); // AssetUtil.renderStackToGui(this.stack, this.x, this.y, this.scale);
} // }
//
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public void drawPost(int mouseX, int mouseY) { // public void drawPost(int mouseX, int mouseY) {
if (this.isHovered(mouseX, mouseY)) { // if (this.isHovered(mouseX, mouseY)) {
Minecraft mc = this.gui.mc; // Minecraft mc = this.gui.mc;
boolean flagBefore = mc.font.getUnicodeFlag(); // boolean flagBefore = mc.font.getUnicodeFlag();
mc.font.setUnicodeFlag(false); // mc.font.setUnicodeFlag(false);
//
List<String> list = this.stack.getTooltipLines(mc.player, mc.options.advancedItemTooltips // List<String> list = this.stack.getTooltipLines(mc.player, mc.options.advancedItemTooltips
? TooltipFlags.ADVANCED // ? TooltipFlags.ADVANCED
: TooltipFlags.NORMAL); // : TooltipFlags.NORMAL);
//
for (int k = 0; k < list.size(); ++k) { // for (int k = 0; k < list.size(); ++k) {
if (k == 0) { // if (k == 0) {
list.set(k, this.stack.getItem().getForgeRarity(this.stack).getColor() + list.get(k)); // list.set(k, this.stack.getItem().getForgeRarity(this.stack).getColor() + list.get(k));
} else { // } else {
list.set(k, TextFormatting.GRAY + list.get(k)); // list.set(k, TextFormatting.GRAY + list.get(k));
} // }
} // }
//
if (this.page != null && this.page != this.gui.pages[0] && this.page != this.gui.pages[1]) { // if (this.page != null && this.page != this.gui.pages[0] && this.page != this.gui.pages[1]) {
list.add(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".clickToSeeRecipe")); // list.add(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".clickToSeeRecipe"));
} // }
//
GuiUtils.drawHoveringText(list, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.font); // GuiUtils.drawHoveringText(list, mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.font);
//
mc.font.setUnicodeFlag(flagBefore); // mc.font.setUnicodeFlag(flagBefore);
} // }
} // }
//
public void onMousePress(int button, int mouseX, int mouseY) { // public void onMousePress(int button, int mouseX, int mouseY) {
if (button == 0 && this.isHovered(mouseX, mouseY)) { // if (button == 0 && this.isHovered(mouseX, mouseY)) {
if (this.page != null && this.page != this.gui.pages[0] && this.page != this.gui.pages[1]) { // if (this.page != null && this.page != this.gui.pages[0] && this.page != this.gui.pages[1]) {
this.gui.mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F)); // this.gui.mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));
//
GuiBooklet gui = BookletUtils.createPageGui(this.gui.previousScreen, this.gui, this.page); // GuiBooklet gui = BookletUtils.createPageGui(this.gui.previousScreen, this.gui, this.page);
this.gui.mc.displayGuiScreen(gui); // this.gui.mc.displayGuiScreen(gui);
} // }
} // }
} // }
//
public boolean isHovered(int mouseX, int mouseY) { // public boolean isHovered(int mouseX, int mouseY) {
return mouseX >= this.x && mouseY >= this.y && mouseX < this.x + 16 * this.scale && mouseY < this.y + 16 * this.scale; // return mouseX >= this.x && mouseY >= this.y && mouseX < this.x + 16 * this.scale && mouseY < this.y + 16 * this.scale;
} // }
} //}

View file

@ -1,78 +1,78 @@
/* ///*
* This file ("PageCoffeeMachine.java") is part of the Actually Additions mod for Minecraft. // * This file ("PageCoffeeMachine.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed // * It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at // * under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense // * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* // *
* © 2015-2017 Ellpeck // * © 2015-2017 Ellpeck
*/ // */
//
package de.ellpeck.actuallyadditions.mod.booklet.page; //package de.ellpeck.actuallyadditions.mod.booklet.page;
//
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; //import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; //import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient; //import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; //import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; //import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import net.minecraft.item.ItemStack; //import net.minecraft.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist; //import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; //import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.client.gui.GuiUtils; //import net.minecraftforge.fml.client.gui.GuiUtils;
//
import java.util.List; //import java.util.List;
//
public class PageCoffeeMachine extends BookletPage { //public class PageCoffeeMachine extends BookletPage {
//
private final CoffeeIngredient ingredient; // private final CoffeeIngredient ingredient;
private final ItemStack outcome; // private final ItemStack outcome;
private int counter = 0; // private int counter = 0;
private int rotate = 0; // private int rotate = 0;
private final ItemStack[] stacks; // private final ItemStack[] stacks;
//
public PageCoffeeMachine(int localizationKey, CoffeeIngredient ingredient) { // public PageCoffeeMachine(int localizationKey, CoffeeIngredient ingredient) {
super(localizationKey); // super(localizationKey);
this.ingredient = ingredient; // this.ingredient = ingredient;
this.stacks = ingredient.getInput().getItems(); // this.stacks = ingredient.getInput().getItems();
//
this.outcome = new ItemStack(ActuallyItems.COFFEE.get()); // this.outcome = new ItemStack(ActuallyItems.COFFEE.get());
ActuallyAdditionsAPI.methodHandler.addEffectToStack(this.outcome, this.ingredient); // ActuallyAdditionsAPI.methodHandler.addEffectToStack(this.outcome, this.ingredient);
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { // public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); // super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
//
gui.getMinecraft().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS); // gui.getMinecraft().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS);
GuiUtils.drawTexturedModalRect(startX + 5, startY + 10, 0, 74, 117, 72, 0); // GuiUtils.drawTexturedModalRect(startX + 5, startY + 10, 0, 74, 117, 72, 0);
//
gui.renderScaledAsciiString("(Coffee Maker Recipe)", startX + 6, startY + 78, 0, false, gui.getMediumFontSize()); // gui.renderScaledAsciiString("(Coffee Maker Recipe)", startX + 6, startY + 78, 0, false, gui.getMediumFontSize());
gui.renderSplitScaledAsciiString("Hover over this to see the effect!", startX + 5, startY + 51, 0, false, gui.getSmallFontSize(), 35); // gui.renderSplitScaledAsciiString("Hover over this to see the effect!", startX + 5, startY + 51, 0, false, gui.getSmallFontSize(), 35);
//
PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 90); // PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 90);
//
if (this.counter++ % 50 == 0) { // if (this.counter++ % 50 == 0) {
gui.addOrModifyItemRenderer(this.stacks[this.rotate++ % this.stacks.length], startX + 5 + 82, startY + 10 + 1, 1F, true); // gui.addOrModifyItemRenderer(this.stacks[this.rotate++ % this.stacks.length], startX + 5 + 82, startY + 10 + 1, 1F, true);
} // }
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public void init(GuiBookletBase gui, int startX, int startY) { // public void init(GuiBookletBase gui, int startX, int startY) {
super.init(gui, startX, startY); // super.init(gui, startX, startY);
//
gui.addOrModifyItemRenderer(this.stacks[0], startX + 5 + 82, startY + 10 + 1, 1F, true); // gui.addOrModifyItemRenderer(this.stacks[0], startX + 5 + 82, startY + 10 + 1, 1F, true);
gui.addOrModifyItemRenderer(this.outcome, startX + 5 + 36, startY + 10 + 42, 1F, false); // gui.addOrModifyItemRenderer(this.outcome, startX + 5 + 36, startY + 10 + 42, 1F, false);
//
gui.addOrModifyItemRenderer(new ItemStack(ActuallyItems.COFFEE_CUP.get()), startX + 5 + 37, startY + 10 + 1, 1F, true); // gui.addOrModifyItemRenderer(new ItemStack(ActuallyItems.COFFEE_CUP.get()), startX + 5 + 37, startY + 10 + 1, 1F, true);
gui.addOrModifyItemRenderer(new ItemStack(ActuallyItems.COFFEE.get()), startX + 5 + 1, startY + 10 + 1, 1F, true); // gui.addOrModifyItemRenderer(new ItemStack(ActuallyItems.COFFEE.get()), startX + 5 + 1, startY + 10 + 1, 1F, true);
} // }
//
@Override // @Override
public void getItemStacksForPage(List<ItemStack> list) { // public void getItemStacksForPage(List<ItemStack> list) {
super.getItemStacksForPage(list); // super.getItemStacksForPage(list);
//
list.add(this.outcome); // list.add(this.outcome);
} // }
} //}

View file

@ -1,194 +1,194 @@
/* ///*
* This file ("PageCrafting.java") is part of the Actually Additions mod for Minecraft. // * This file ("PageCrafting.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed // * It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at // * under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense // * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* // *
* © 2015-2017 Ellpeck // * © 2015-2017 Ellpeck
*/ // */
//
package de.ellpeck.actuallyadditions.mod.booklet.page; //package de.ellpeck.actuallyadditions.mod.booklet.page;
//
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; //import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; //import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; //import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
import de.ellpeck.actuallyadditions.mod.util.RefHelp; //import de.ellpeck.actuallyadditions.mod.util.RefHelp;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; //import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; //import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import de.ellpeck.actuallyadditions.mod.util.Util; //import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.item.ItemStack; //import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe; //import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.Ingredient; //import net.minecraft.item.crafting.Ingredient;
import net.minecraftforge.api.distmarker.Dist; //import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; //import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.client.gui.GuiUtils; //import net.minecraftforge.fml.client.gui.GuiUtils;
//
import java.util.Arrays; //import java.util.Arrays;
import java.util.List; //import java.util.List;
//
public class PageCrafting extends BookletPage { //public class PageCrafting extends BookletPage {
//
private final List<IRecipe> recipes; // private final List<IRecipe> recipes;
private int recipeAt; // private int recipeAt;
private String recipeTypeLocKey; // private String recipeTypeLocKey;
private boolean isWildcard; // private boolean isWildcard;
//
public PageCrafting(int localizationKey, int priority, List<IRecipe> recipes) { // public PageCrafting(int localizationKey, int priority, List<IRecipe> recipes) {
super(localizationKey, priority); // super(localizationKey, priority);
this.recipes = recipes; // this.recipes = recipes;
} // }
//
public PageCrafting(int localizationKey, List<IRecipe> recipes) { // public PageCrafting(int localizationKey, List<IRecipe> recipes) {
this(localizationKey, 0, recipes); // this(localizationKey, 0, recipes);
} // }
//
public PageCrafting(int localizationKey, IRecipe... recipes) { // public PageCrafting(int localizationKey, IRecipe... recipes) {
this(localizationKey, 0, recipes); // this(localizationKey, 0, recipes);
} // }
//
public PageCrafting(int localizationKey, int priority, IRecipe... recipes) { // public PageCrafting(int localizationKey, int priority, IRecipe... recipes) {
this(localizationKey, priority, Arrays.asList(recipes)); // this(localizationKey, priority, Arrays.asList(recipes));
} // }
//
public BookletPage setWildcard() { // public BookletPage setWildcard() {
this.isWildcard = true; // this.isWildcard = true;
return this; // return this;
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { // public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); // super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
//
gui.getMinecraft().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS); // gui.getMinecraft().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS);
GuiUtils.drawTexturedModalRect(startX + 5, startY + 6, 20, 0, 116, 54, 0); // GuiUtils.drawTexturedModalRect(startX + 5, startY + 6, 20, 0, 116, 54, 0);
//
if (this.recipeTypeLocKey != null) { // if (this.recipeTypeLocKey != null) {
gui.renderScaledAsciiString("(" + StringUtil.localize(this.recipeTypeLocKey) + ")", startX + 6, startY + 65, 0, false, gui.getMediumFontSize()); // gui.renderScaledAsciiString("(" + StringUtil.localize(this.recipeTypeLocKey) + ")", startX + 6, startY + 65, 0, false, gui.getMediumFontSize());
} // }
//
PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 80); // PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 80);
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public void updateScreen(GuiBookletBase gui, int startX, int startY, int pageTimer) { // public void updateScreen(GuiBookletBase gui, int startX, int startY, int pageTimer) {
super.updateScreen(gui, startX, startY, pageTimer); // super.updateScreen(gui, startX, startY, pageTimer);
//
if (pageTimer % 20 == 0) { // if (pageTimer % 20 == 0) {
this.findRecipe(gui, startX, startY); // this.findRecipe(gui, startX, startY);
} // }
} // }
//
private void findRecipe(GuiBookletBase gui, int startX, int startY) { // private void findRecipe(GuiBookletBase gui, int startX, int startY) {
if (!this.recipes.isEmpty()) { // if (!this.recipes.isEmpty()) {
IRecipe recipe = this.recipes.get(this.recipeAt); // IRecipe recipe = this.recipes.get(this.recipeAt);
if (recipe != null) { // if (recipe != null) {
this.setupRecipe(gui, recipe, startX, startY); // this.setupRecipe(gui, recipe, startX, startY);
} // }
//
this.recipeAt++; // this.recipeAt++;
if (this.recipeAt >= this.recipes.size()) { // if (this.recipeAt >= this.recipes.size()) {
this.recipeAt = 0; // this.recipeAt = 0;
} // }
} // }
} // }
//
@Override // @Override
public void init(GuiBookletBase gui, int startX, int startY) { // public void init(GuiBookletBase gui, int startX, int startY) {
super.init(gui, startX, startY); // super.init(gui, startX, startY);
this.findRecipe(gui, startX, startY); // this.findRecipe(gui, startX, startY);
} // }
//
@Override // @Override
public void getItemStacksForPage(List<ItemStack> list) { // public void getItemStacksForPage(List<ItemStack> list) {
super.getItemStacksForPage(list); // super.getItemStacksForPage(list);
//
if (!this.recipes.isEmpty()) { // if (!this.recipes.isEmpty()) {
for (IRecipe recipe : this.recipes) { // for (IRecipe recipe : this.recipes) {
if (recipe != null) { // if (recipe != null) {
ItemStack output = recipe.getResultItem(); // ItemStack output = recipe.getResultItem();
if (StackUtil.isValid(output)) { // if (StackUtil.isValid(output)) {
ItemStack copy = output.copy(); // ItemStack copy = output.copy();
/* // /*
if (this.isWildcard) { // if (this.isWildcard) {
copy.setItemDamage(Util.WILDCARD); // copy.setItemDamage(Util.WILDCARD);
} // }
//
*/ // */
list.add(copy); // list.add(copy);
} // }
} // }
} // }
} // }
} // }
//
private void setupRecipe(GuiBookletBase gui, IRecipe recipe, int startX, int startY) { // private void setupRecipe(GuiBookletBase gui, IRecipe recipe, int startX, int startY) {
Ingredient[] ings = new Ingredient[9]; // Ingredient[] ings = new Ingredient[9];
int width = 3; // int width = 3;
int height = 3; // int height = 3;
/* ///*
if (recipe instanceof BlankRecipe) { // if (recipe instanceof BlankRecipe) {
this.recipeTypeLocKey = "tooltip." + ActuallyAdditions.MODID + ".disabled"; // this.recipeTypeLocKey = "tooltip." + ActuallyAdditions.MODID + ".disabled";
gui.addOrModifyItemRenderer(recipe.getResultItem(), startX + 100, startY + 25, 1F, false); // gui.addOrModifyItemRenderer(recipe.getResultItem(), startX + 100, startY + 25, 1F, false);
return; // return;
} else if (recipe instanceof ShapedRecipes) { // } else if (recipe instanceof ShapedRecipes) {
ShapedRecipes shaped = (ShapedRecipes) recipe; // ShapedRecipes shaped = (ShapedRecipes) recipe;
width = shaped.recipeWidth; // width = shaped.recipeWidth;
height = shaped.recipeHeight; // height = shaped.recipeHeight;
ings = shaped.recipeItems.toArray(new Ingredient[shaped.recipeItems.size()]); // ings = shaped.recipeItems.toArray(new Ingredient[shaped.recipeItems.size()]);
this.recipeTypeLocKey = "booklet." + ActuallyAdditions.MODID + ".shapedRecipe"; // this.recipeTypeLocKey = "booklet." + ActuallyAdditions.MODID + ".shapedRecipe";
} else if (recipe instanceof ShapelessRecipes) { // } else if (recipe instanceof ShapelessRecipes) {
ShapelessRecipes shapeless = (ShapelessRecipes) recipe; // ShapelessRecipes shapeless = (ShapelessRecipes) recipe;
for (int i = 0; i < shapeless.recipeItems.size(); i++) { // for (int i = 0; i < shapeless.recipeItems.size(); i++) {
ings[i] = shapeless.recipeItems.get(i); // ings[i] = shapeless.recipeItems.get(i);
} // }
this.recipeTypeLocKey = "booklet." + ActuallyAdditions.MODID + ".shapelessRecipe"; // this.recipeTypeLocKey = "booklet." + ActuallyAdditions.MODID + ".shapelessRecipe";
} else if (recipe instanceof ShapedOreRecipe) { // } else if (recipe instanceof ShapedOreRecipe) {
ShapedOreRecipe shaped = (ShapedOreRecipe) recipe; // ShapedOreRecipe shaped = (ShapedOreRecipe) recipe;
try { // try {
width = RefHelp.getPrivateValue(ShapedOreRecipe.class, shaped, 4); // width = RefHelp.getPrivateValue(ShapedOreRecipe.class, shaped, 4);
height = RefHelp.getPrivateValue(ShapedOreRecipe.class, shaped, 5); // height = RefHelp.getPrivateValue(ShapedOreRecipe.class, shaped, 5);
} catch (Exception e) { // } catch (Exception e) {
ActuallyAdditions.LOGGER.error("Something went wrong trying to get the Crafting Recipe in the booklet to display!", e); // ActuallyAdditions.LOGGER.error("Something went wrong trying to get the Crafting Recipe in the booklet to display!", e);
} // }
for (int i = 0; i < shaped.getIngredients().size(); i++) { // for (int i = 0; i < shaped.getIngredients().size(); i++) {
ings[i] = shaped.getIngredients().get(i); // ings[i] = shaped.getIngredients().get(i);
} // }
this.recipeTypeLocKey = "booklet." + ActuallyAdditions.MODID + ".shapedOreRecipe"; // this.recipeTypeLocKey = "booklet." + ActuallyAdditions.MODID + ".shapedOreRecipe";
} else if (recipe instanceof ShapelessOreRecipe) { // } else if (recipe instanceof ShapelessOreRecipe) {
ShapelessOreRecipe shapeless = (ShapelessOreRecipe) recipe; // ShapelessOreRecipe shapeless = (ShapelessOreRecipe) recipe;
for (int i = 0; i < shapeless.getIngredients().size(); i++) { // for (int i = 0; i < shapeless.getIngredients().size(); i++) {
ings[i] = shapeless.getIngredients().get(i); // ings[i] = shapeless.getIngredients().get(i);
} // }
this.recipeTypeLocKey = "booklet." + ActuallyAdditions.MODID + ".shapelessOreRecipe"; // this.recipeTypeLocKey = "booklet." + ActuallyAdditions.MODID + ".shapelessOreRecipe";
} // }
//
//
*/ // */
for (int x = 0; x < width; x++) { // for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) { // for (int y = 0; y < height; y++) {
Ingredient ing = ings[y * width + x]; // Ingredient ing = ings[y * width + x];
if (ing != null) { // if (ing != null) {
ItemStack[] stacks = ing.getItems(); // ItemStack[] stacks = ing.getItems();
if (stacks != null && stacks.length > 0) { // if (stacks != null && stacks.length > 0) {
ItemStack stack = stacks[0]; // ItemStack stack = stacks[0];
if (StackUtil.isValid(stack)) { // if (StackUtil.isValid(stack)) {
ItemStack copy = stack.copy(); // ItemStack copy = stack.copy();
copy.setCount(1); // copy.setCount(1);
/* // /*
if (copy.getItemDamage() == Util.WILDCARD) { // if (copy.getItemDamage() == Util.WILDCARD) {
copy.setItemDamage(0); // copy.setItemDamage(0);
} // }
*/ // */
gui.addOrModifyItemRenderer(copy, startX + 6 + x * 18, startY + 7 + y * 18, 1F, true); // gui.addOrModifyItemRenderer(copy, startX + 6 + x * 18, startY + 7 + y * 18, 1F, true);
} // }
} // }
} // }
} // }
} // }
//
gui.addOrModifyItemRenderer(recipe.getResultItem(), startX + 100, startY + 25, 1F, false); // gui.addOrModifyItemRenderer(recipe.getResultItem(), startX + 100, startY + 25, 1F, false);
} // }
} //}

View file

@ -1,83 +1,83 @@
/* ///*
* This file ("PageCrusherRecipe.java") is part of the Actually Additions mod for Minecraft. // * This file ("PageCrusherRecipe.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed // * It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at // * under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense // * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* // *
* © 2015-2017 Ellpeck // * © 2015-2017 Ellpeck
*/ // */
//
package de.ellpeck.actuallyadditions.mod.booklet.page; //package de.ellpeck.actuallyadditions.mod.booklet.page;
//
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; //import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; //import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; //import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
import de.ellpeck.actuallyadditions.mod.crafting.CrushingRecipe; //import de.ellpeck.actuallyadditions.mod.crafting.CrushingRecipe;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; //import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; //import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.item.ItemStack; //import net.minecraft.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist; //import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; //import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.client.gui.GuiUtils; //import net.minecraftforge.fml.client.gui.GuiUtils;
//
import java.util.List; //import java.util.List;
//
public class PageCrusherRecipe extends BookletPage { //public class PageCrusherRecipe extends BookletPage {
//
private final CrushingRecipe recipe; // private final CrushingRecipe recipe;
private int counter = 0; // private int counter = 0;
private int rotate = 0; // private int rotate = 0;
private final ItemStack[] stacks; // private final ItemStack[] stacks;
//
public PageCrusherRecipe(int localizationKey, CrushingRecipe recipe) { // public PageCrusherRecipe(int localizationKey, CrushingRecipe recipe) {
super(localizationKey); // super(localizationKey);
this.recipe = recipe; // this.recipe = recipe;
this.stacks = recipe.getInput().getItems(); // this.stacks = recipe.getInput().getItems();
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { // public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); // super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
//
gui.getMinecraft().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS); // gui.getMinecraft().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS);
GuiUtils.drawTexturedModalRect(startX + 38, startY + 6, 136, 0, 52, 74, 0); // GuiUtils.drawTexturedModalRect(startX + 38, startY + 6, 136, 0, 52, 74, 0);
//
gui.renderScaledAsciiString("(" + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".crusherRecipe") + ")", startX + 36, startY + 85, 0, false, gui.getMediumFontSize()); // gui.renderScaledAsciiString("(" + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".crusherRecipe") + ")", startX + 36, startY + 85, 0, false, gui.getMediumFontSize());
//
PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 100); // PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 100);
//
if (this.counter++ % 50 == 0) { // if (this.counter++ % 50 == 0) {
gui.addOrModifyItemRenderer(this.stacks[this.rotate++ % this.stacks.length], startX + 38 + 18, startY + 6 + 1, 1F, true); // gui.addOrModifyItemRenderer(this.stacks[this.rotate++ % this.stacks.length], startX + 38 + 18, startY + 6 + 1, 1F, true);
} // }
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public void init(GuiBookletBase gui, int startX, int startY) { // public void init(GuiBookletBase gui, int startX, int startY) {
super.init(gui, startX, startY); // super.init(gui, startX, startY);
//
if (this.recipe != null) { // if (this.recipe != null) {
gui.addOrModifyItemRenderer(this.stacks[this.rotate++ % this.stacks.length], startX + 38 + 18, startY + 6 + 1, 1F, true); // gui.addOrModifyItemRenderer(this.stacks[this.rotate++ % this.stacks.length], startX + 38 + 18, startY + 6 + 1, 1F, true);
gui.addOrModifyItemRenderer(this.recipe.getOutputOne(), startX + 38 + 4, startY + 6 + 53, 1F, false); // gui.addOrModifyItemRenderer(this.recipe.getOutputOne(), startX + 38 + 4, startY + 6 + 53, 1F, false);
//
if (StackUtil.isValid(this.recipe.getOutputTwo())) { // if (StackUtil.isValid(this.recipe.getOutputTwo())) {
gui.addOrModifyItemRenderer(this.recipe.getOutputTwo(), startX + 38 + 30, startY + 6 + 53, 1F, false); // gui.addOrModifyItemRenderer(this.recipe.getOutputTwo(), startX + 38 + 30, startY + 6 + 53, 1F, false);
} // }
} // }
} // }
//
@Override // @Override
public void getItemStacksForPage(List<ItemStack> list) { // public void getItemStacksForPage(List<ItemStack> list) {
super.getItemStacksForPage(list); // super.getItemStacksForPage(list);
//
if (this.recipe != null) { // if (this.recipe != null) {
list.add(this.recipe.getOutputOne()); // list.add(this.recipe.getOutputOne());
//
if (StackUtil.isValid(this.recipe.getOutputTwo())) { // if (StackUtil.isValid(this.recipe.getOutputTwo())) {
list.add(this.recipe.getOutputTwo()); // list.add(this.recipe.getOutputTwo());
} // }
} // }
} // }
} //}

View file

@ -1,105 +1,105 @@
/* ///*
* This file ("PageEmpowerer.java") is part of the Actually Additions mod for Minecraft. // * This file ("PageEmpowerer.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed // * It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at // * under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense // * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* // *
* © 2015-2017 Ellpeck // * © 2015-2017 Ellpeck
*/ // */
//
package de.ellpeck.actuallyadditions.mod.booklet.page; //package de.ellpeck.actuallyadditions.mod.booklet.page;
//
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; //import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; //import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; //import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
import de.ellpeck.actuallyadditions.mod.crafting.EmpowererRecipe; //import de.ellpeck.actuallyadditions.mod.crafting.EmpowererRecipe;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; //import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.item.ItemStack; //import net.minecraft.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist; //import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; //import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.client.gui.GuiUtils; //import net.minecraftforge.fml.client.gui.GuiUtils;
//
import java.util.List; //import java.util.List;
//
public class PageEmpowerer extends BookletPage { //public class PageEmpowerer extends BookletPage {
//
private final EmpowererRecipe recipe; // private final EmpowererRecipe recipe;
private int counter = 0; // private int counter = 0;
private int rotate = 0; // private int rotate = 0;
ItemStack[] inputs; // ItemStack[] inputs;
ItemStack[] stand1; // ItemStack[] stand1;
ItemStack[] stand2; // ItemStack[] stand2;
ItemStack[] stand3; // ItemStack[] stand3;
ItemStack[] stand4; // ItemStack[] stand4;
//
public PageEmpowerer(int localizationKey, EmpowererRecipe recipe) { // public PageEmpowerer(int localizationKey, EmpowererRecipe recipe) {
super(localizationKey); // super(localizationKey);
this.recipe = recipe; // this.recipe = recipe;
if (recipe != null) { // if (recipe != null) {
this.inputs = recipe.getInput().getItems(); // this.inputs = recipe.getInput().getItems();
this.stand1 = recipe.getStandOne().getItems(); // this.stand1 = recipe.getStandOne().getItems();
this.stand2 = recipe.getStandTwo().getItems(); // this.stand2 = recipe.getStandTwo().getItems();
this.stand3 = recipe.getStandThree().getItems(); // this.stand3 = recipe.getStandThree().getItems();
this.stand4 = recipe.getStandFour().getItems(); // this.stand4 = recipe.getStandFour().getItems();
} // }
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { // public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); // super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
//
gui.getMinecraft().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS); // gui.getMinecraft().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS);
GuiUtils.drawTexturedModalRect(startX + 5, startY + 10, 117, 74, 116, 72, 0); // GuiUtils.drawTexturedModalRect(startX + 5, startY + 10, 117, 74, 116, 72, 0);
//
gui.renderScaledAsciiString("(" + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".empowererRecipe") + ")", startX + 6, startY + 85, 0, false, gui.getMediumFontSize()); // gui.renderScaledAsciiString("(" + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".empowererRecipe") + ")", startX + 6, startY + 85, 0, false, gui.getMediumFontSize());
//
PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 100); // PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 100);
if (this.recipe != null) { // if (this.recipe != null) {
this.updateInputs(gui, startX, startY); // this.updateInputs(gui, startX, startY);
} // }
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public void init(GuiBookletBase gui, int startX, int startY) { // public void init(GuiBookletBase gui, int startX, int startY) {
super.init(gui, startX, startY); // super.init(gui, startX, startY);
//
if (this.recipe != null) { // if (this.recipe != null) {
gui.addOrModifyItemRenderer(this.stand1[0], startX + 5 + 26, startY + 10 + 1, 1F, true); // gui.addOrModifyItemRenderer(this.stand1[0], startX + 5 + 26, startY + 10 + 1, 1F, true);
gui.addOrModifyItemRenderer(this.stand2[0], startX + 5 + 1, startY + 10 + 26, 1F, true); // gui.addOrModifyItemRenderer(this.stand2[0], startX + 5 + 1, startY + 10 + 26, 1F, true);
gui.addOrModifyItemRenderer(this.stand3[0], startX + 5 + 51, startY + 10 + 26, 1F, true); // gui.addOrModifyItemRenderer(this.stand3[0], startX + 5 + 51, startY + 10 + 26, 1F, true);
gui.addOrModifyItemRenderer(this.stand4[0], startX + 5 + 26, startY + 10 + 51, 1F, true); // gui.addOrModifyItemRenderer(this.stand4[0], startX + 5 + 26, startY + 10 + 51, 1F, true);
//
gui.addOrModifyItemRenderer(this.inputs[0], startX + 5 + 26, startY + 10 + 26, 1F, true); // gui.addOrModifyItemRenderer(this.inputs[0], startX + 5 + 26, startY + 10 + 26, 1F, true);
gui.addOrModifyItemRenderer(this.recipe.getOutput(), startX + 5 + 96, startY + 10 + 26, 1F, false); // gui.addOrModifyItemRenderer(this.recipe.getOutput(), startX + 5 + 96, startY + 10 + 26, 1F, false);
} // }
} // }
//
private void updateInputs(GuiBookletBase gui, int startX, int startY) { // private void updateInputs(GuiBookletBase gui, int startX, int startY) {
if (this.counter++ % 50 == 0) { // if (this.counter++ % 50 == 0) {
this.rotate++; // this.rotate++;
gui.addOrModifyItemRenderer(this.stand1[this.rotate % this.stand1.length], startX + 5 + 26, startY + 10 + 1, 1F, true); // gui.addOrModifyItemRenderer(this.stand1[this.rotate % this.stand1.length], startX + 5 + 26, startY + 10 + 1, 1F, true);
gui.addOrModifyItemRenderer(this.stand2[this.rotate % this.stand2.length], startX + 5 + 1, startY + 10 + 26, 1F, true); // gui.addOrModifyItemRenderer(this.stand2[this.rotate % this.stand2.length], startX + 5 + 1, startY + 10 + 26, 1F, true);
gui.addOrModifyItemRenderer(this.stand3[this.rotate % this.stand3.length], startX + 5 + 51, startY + 10 + 26, 1F, true); // gui.addOrModifyItemRenderer(this.stand3[this.rotate % this.stand3.length], startX + 5 + 51, startY + 10 + 26, 1F, true);
gui.addOrModifyItemRenderer(this.stand4[this.rotate % this.stand4.length], startX + 5 + 26, startY + 10 + 51, 1F, true); // gui.addOrModifyItemRenderer(this.stand4[this.rotate % this.stand4.length], startX + 5 + 26, startY + 10 + 51, 1F, true);
//
gui.addOrModifyItemRenderer(this.inputs[this.rotate % this.inputs.length], startX + 5 + 26, startY + 10 + 26, 1F, true); // gui.addOrModifyItemRenderer(this.inputs[this.rotate % this.inputs.length], startX + 5 + 26, startY + 10 + 26, 1F, true);
} // }
} // }
//
@Override // @Override
public void getItemStacksForPage(List<ItemStack> list) { // public void getItemStacksForPage(List<ItemStack> list) {
super.getItemStacksForPage(list); // super.getItemStacksForPage(list);
//
if (this.recipe != null) { // if (this.recipe != null) {
list.add(this.recipe.getOutput()); // list.add(this.recipe.getOutput());
} // }
} // }
//
@Override // @Override
public int getSortingPriority() { // public int getSortingPriority() {
return 20; // return 20;
} // }
} //}

View file

@ -1,82 +1,82 @@
/* ///*
* This file ("PageFurnace.java") is part of the Actually Additions mod for Minecraft. // * This file ("PageFurnace.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed // * It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at // * under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense // * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* // *
* © 2015-2017 Ellpeck // * © 2015-2017 Ellpeck
*/ // */
//
package de.ellpeck.actuallyadditions.mod.booklet.page; //package de.ellpeck.actuallyadditions.mod.booklet.page;
//
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; //import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; //import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; //import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; //import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; //import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.item.ItemStack; //import net.minecraft.item.ItemStack;
import net.minecraft.util.datafix.fixes.FurnaceRecipes; //import net.minecraft.util.datafix.fixes.FurnaceRecipes;
import net.minecraftforge.api.distmarker.Dist; //import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; //import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.client.gui.GuiUtils; //import net.minecraftforge.fml.client.gui.GuiUtils;
//
import java.util.List; //import java.util.List;
import java.util.Map; //import java.util.Map;
//
public class PageFurnace extends BookletPage { //public class PageFurnace extends BookletPage {
//
private final ItemStack input; // private final ItemStack input;
private final ItemStack output; // private final ItemStack output;
//
public PageFurnace(int localizationKey, ItemStack output) { // public PageFurnace(int localizationKey, ItemStack output) {
this(localizationKey, output, 0); // this(localizationKey, output, 0);
} // }
//
public PageFurnace(int localizationKey, ItemStack output, int priority) { // public PageFurnace(int localizationKey, ItemStack output, int priority) {
super(localizationKey, priority); // super(localizationKey, priority);
this.output = output; // this.output = output;
this.input = getInputForOutput(output); // this.input = getInputForOutput(output);
} // }
//
private static ItemStack getInputForOutput(ItemStack output) { // private static ItemStack getInputForOutput(ItemStack output) {
for (Map.Entry<ItemStack, ItemStack> entry : FurnaceRecipes.instance().getSmeltingList().entrySet()) { // for (Map.Entry<ItemStack, ItemStack> entry : FurnaceRecipes.instance().getSmeltingList().entrySet()) {
ItemStack stack = entry.getValue(); // ItemStack stack = entry.getValue();
if (StackUtil.isValid(stack)) { // if (StackUtil.isValid(stack)) {
if (stack.sameItem(output)) { // if (stack.sameItem(output)) {
return entry.getKey(); // return entry.getKey();
} // }
} // }
} // }
return ItemStack.EMPTY; // return ItemStack.EMPTY;
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { // public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); // super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
//
gui.getMinecraft().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS); // gui.getMinecraft().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS);
GuiUtils.drawTexturedModalRect(startX + 23, startY + 10, 0, 146, 80, 26, 0); // GuiUtils.drawTexturedModalRect(startX + 23, startY + 10, 0, 146, 80, 26, 0);
//
gui.renderScaledAsciiString("(" + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".furnaceRecipe") + ")", startX + 32, startY + 42, 0, false, gui.getMediumFontSize()); // gui.renderScaledAsciiString("(" + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".furnaceRecipe") + ")", startX + 32, startY + 42, 0, false, gui.getMediumFontSize());
//
PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 57); // PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 57);
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public void init(GuiBookletBase gui, int startX, int startY) { // public void init(GuiBookletBase gui, int startX, int startY) {
super.init(gui, startX, startY); // super.init(gui, startX, startY);
//
gui.addOrModifyItemRenderer(this.input, startX + 23 + 1, startY + 10 + 5, 1F, true); // gui.addOrModifyItemRenderer(this.input, startX + 23 + 1, startY + 10 + 5, 1F, true);
gui.addOrModifyItemRenderer(this.output, startX + 23 + 59, startY + 10 + 5, 1F, false); // gui.addOrModifyItemRenderer(this.output, startX + 23 + 59, startY + 10 + 5, 1F, false);
} // }
//
@Override // @Override
public void getItemStacksForPage(List<ItemStack> list) { // public void getItemStacksForPage(List<ItemStack> list) {
super.getItemStacksForPage(list); // super.getItemStacksForPage(list);
//
list.add(this.output); // list.add(this.output);
} // }
} //}

View file

@ -1,68 +1,68 @@
/* ///*
* This file ("PageLinkButton.java") is part of the Actually Additions mod for Minecraft. // * This file ("PageLinkButton.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed // * It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at // * under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense // * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* // *
* © 2015-2017 Ellpeck // * © 2015-2017 Ellpeck
*/ // */
//
package de.ellpeck.actuallyadditions.mod.booklet.page; //package de.ellpeck.actuallyadditions.mod.booklet.page;
//
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; //import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; //import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; //import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.gui.widget.button.Button; //import net.minecraft.client.gui.widget.button.Button;
import net.minecraftforge.api.distmarker.Dist; //import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; //import net.minecraftforge.api.distmarker.OnlyIn;
//
import java.awt.*; //import java.awt.*;
import java.net.URI; //import java.net.URI;
//
public class PageLinkButton extends BookletPage { //public class PageLinkButton extends BookletPage {
//
public static int nextButtonId = 23782; // public static int nextButtonId = 23782;
private final int buttonId; // private final int buttonId;
//
private final String link; // private final String link;
//
public PageLinkButton(int localizationKey, String link) { // public PageLinkButton(int localizationKey, String link) {
super(localizationKey); // super(localizationKey);
this.link = link; // this.link = link;
//
this.buttonId = nextButtonId; // this.buttonId = nextButtonId;
nextButtonId++; // nextButtonId++;
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public void init(GuiBookletBase gui, int startX, int startY) { // public void init(GuiBookletBase gui, int startX, int startY) {
super.init(gui, startX, startY); // super.init(gui, startX, startY);
//
gui.getButtonList().add(new Button(this.buttonId, startX + 125 / 2 - 50, startY + 130, 100, 20, StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".chapter." + this.chapter.getIdentifier() + ".button." + this.localizationKey))); // gui.getButtonList().add(new Button(this.buttonId, startX + 125 / 2 - 50, startY + 130, 100, 20, StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".chapter." + this.chapter.getIdentifier() + ".button." + this.localizationKey)));
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { // public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); // super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 5); // PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 5);
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public void actionPerformed(GuiBookletBase gui, Button button) { // public void actionPerformed(GuiBookletBase gui, Button button) {
if (button.id == this.buttonId) { // if (button.id == this.buttonId) {
if (Desktop.isDesktopSupported()) { // if (Desktop.isDesktopSupported()) {
try { // try {
Desktop.getDesktop().browse(new URI(this.link)); // Desktop.getDesktop().browse(new URI(this.link));
} catch (Exception e) { // } catch (Exception e) {
ActuallyAdditions.LOGGER.error("Couldn't open website from Link Button page!", e); // ActuallyAdditions.LOGGER.error("Couldn't open website from Link Button page!", e);
} // }
} // }
} else { // } else {
super.actionPerformed(gui, button); // super.actionPerformed(gui, button);
} // }
} // }
} //}

View file

@ -1,59 +1,59 @@
/* ///*
* This file ("PagePicture.java") is part of the Actually Additions mod for Minecraft. // * This file ("PagePicture.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed // * It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at // * under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense // * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* // *
* © 2015-2017 Ellpeck // * © 2015-2017 Ellpeck
*/ // */
//
package de.ellpeck.actuallyadditions.mod.booklet.page; //package de.ellpeck.actuallyadditions.mod.booklet.page;
//
import com.mojang.blaze3d.systems.RenderSystem; //import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; //import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; //import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.util.ResourceLocation; //import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist; //import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; //import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.client.gui.GuiUtils; //import net.minecraftforge.fml.client.gui.GuiUtils;
//
public class PagePicture extends BookletPage { //public class PagePicture extends BookletPage {
//
private final ResourceLocation resLoc; // private final ResourceLocation resLoc;
private final int yTextOffset; // private final int yTextOffset;
//
public PagePicture(int localizationKey, ResourceLocation resLoc, int yTextOffset, int priority) { // public PagePicture(int localizationKey, ResourceLocation resLoc, int yTextOffset, int priority) {
super(localizationKey, priority); // super(localizationKey, priority);
this.resLoc = resLoc; // this.resLoc = resLoc;
this.yTextOffset = yTextOffset; // this.yTextOffset = yTextOffset;
} // }
//
public PagePicture(int localizationKey, ResourceLocation resLoc, int yTextOffset) { // public PagePicture(int localizationKey, ResourceLocation resLoc, int yTextOffset) {
super(localizationKey); // super(localizationKey);
this.yTextOffset = yTextOffset; // this.yTextOffset = yTextOffset;
this.resLoc = resLoc; // this.resLoc = resLoc;
} // }
//
public PagePicture(int localizationKey, String pictureLocation, int yTextOffset) { // public PagePicture(int localizationKey, String pictureLocation, int yTextOffset) {
this(localizationKey, AssetUtil.getBookletGuiLocation(pictureLocation), yTextOffset); // this(localizationKey, AssetUtil.getBookletGuiLocation(pictureLocation), yTextOffset);
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { // public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); // super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
//
gui.getMinecraft().getTextureManager().bind(this.resLoc); // gui.getMinecraft().getTextureManager().bind(this.resLoc);
//
RenderSystem.pushMatrix(); // RenderSystem.pushMatrix();
RenderSystem.enableBlend(); // RenderSystem.enableBlend();
RenderSystem.disableAlphaTest(); // RenderSystem.disableAlphaTest();
GuiUtils.drawTexturedModalRect(startX - 6, startY - 7, 0, 0, 256, 256, 0); // GuiUtils.drawTexturedModalRect(startX - 6, startY - 7, 0, 0, 256, 256, 0);
RenderSystem.disableBlend(); // RenderSystem.disableBlend();
RenderSystem.enableAlphaTest(); // RenderSystem.enableAlphaTest();
RenderSystem.popMatrix(); // RenderSystem.popMatrix();
//
PageTextOnly.renderTextToPage(gui, this, startX + 6, startY - 7 + this.yTextOffset); // PageTextOnly.renderTextToPage(gui, this, startX + 6, startY - 7 + this.yTextOffset);
} // }
} //}

View file

@ -1,93 +1,93 @@
/* ///*
* This file ("PageReconstructor.java") is part of the Actually Additions mod for Minecraft. // * This file ("PageReconstructor.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed // * It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at // * under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense // * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* // *
* © 2015-2017 Ellpeck // * © 2015-2017 Ellpeck
*/ // */
//
package de.ellpeck.actuallyadditions.mod.booklet.page; //package de.ellpeck.actuallyadditions.mod.booklet.page;
//
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; //import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe; //import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; //import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; //import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; //import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import de.ellpeck.actuallyadditions.mod.util.Util; //import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.item.ItemStack; //import net.minecraft.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist; //import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; //import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.client.gui.GuiUtils; //import net.minecraftforge.fml.client.gui.GuiUtils;
//
import java.util.List; //import java.util.List;
//
public class PageReconstructor extends BookletPage { //public class PageReconstructor extends BookletPage {
//
private final LensConversionRecipe recipe; // private final LensConversionRecipe recipe;
private boolean isWildcard; // private boolean isWildcard;
private int counter = 0; // private int counter = 0;
private int rotate = 0; // private int rotate = 0;
private ItemStack[] stacks; // private ItemStack[] stacks;
//
public PageReconstructor(int localizationKey, LensConversionRecipe recipe) { // public PageReconstructor(int localizationKey, LensConversionRecipe recipe) {
super(localizationKey); // super(localizationKey);
this.recipe = recipe; // this.recipe = recipe;
if (recipe != null) { // if (recipe != null) {
this.stacks = recipe.getInput().getItems(); // this.stacks = recipe.getInput().getItems();
} // }
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { // public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); // super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
//
gui.getMinecraft().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS); // gui.getMinecraft().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS);
GuiUtils.drawTexturedModalRect(startX + 30, startY + 10, 80, 146, 68, 48, 0); // GuiUtils.drawTexturedModalRect(startX + 30, startY + 10, 80, 146, 68, 48, 0);
//
gui.renderScaledAsciiString("(" + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".reconstructorRecipe") + ")", startX + 6, startY + 63, 0, false, gui.getMediumFontSize()); // gui.renderScaledAsciiString("(" + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".reconstructorRecipe") + ")", startX + 6, startY + 63, 0, false, gui.getMediumFontSize());
//
PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 88); // PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 88);
if (this.recipe != null) { // if (this.recipe != null) {
if (this.counter++ % 50 == 0) { // if (this.counter++ % 50 == 0) {
gui.addOrModifyItemRenderer(this.stacks[this.rotate++ % this.stacks.length], startX + 30 + 1, startY + 10 + 13, 1F, true); // gui.addOrModifyItemRenderer(this.stacks[this.rotate++ % this.stacks.length], startX + 30 + 1, startY + 10 + 13, 1F, true);
} // }
} // }
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public void init(GuiBookletBase gui, int startX, int startY) { // public void init(GuiBookletBase gui, int startX, int startY) {
super.init(gui, startX, startY); // super.init(gui, startX, startY);
//
if (this.recipe != null) { // if (this.recipe != null) {
gui.addOrModifyItemRenderer(this.stacks[0], startX + 30 + 1, startY + 10 + 13, 1F, true); // gui.addOrModifyItemRenderer(this.stacks[0], startX + 30 + 1, startY + 10 + 13, 1F, true);
gui.addOrModifyItemRenderer(this.recipe.getOutput(), startX + 30 + 47, startY + 10 + 13, 1F, false); // gui.addOrModifyItemRenderer(this.recipe.getOutput(), startX + 30 + 47, startY + 10 + 13, 1F, false);
} // }
} // }
//
@Override // @Override
public void getItemStacksForPage(List<ItemStack> list) { // public void getItemStacksForPage(List<ItemStack> list) {
super.getItemStacksForPage(list); // super.getItemStacksForPage(list);
//
if (this.recipe != null) { // if (this.recipe != null) {
ItemStack copy = this.recipe.getOutput().copy(); // ItemStack copy = this.recipe.getOutput().copy();
if (this.isWildcard) { // if (this.isWildcard) {
copy.setDamageValue(Util.WILDCARD); // copy.setDamageValue(Util.WILDCARD);
} // }
list.add(copy); // list.add(copy);
} // }
} // }
//
public BookletPage setWildcard() { // public BookletPage setWildcard() {
this.isWildcard = true; // this.isWildcard = true;
return this; // return this;
} // }
//
@Override // @Override
public int getSortingPriority() { // public int getSortingPriority() {
return 20; // return 20;
} // }
} //}

View file

@ -1,41 +1,41 @@
/* ///*
* This file ("PageTextOnly.java") is part of the Actually Additions mod for Minecraft. // * This file ("PageTextOnly.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed // * It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at // * under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense // * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* // *
* © 2015-2017 Ellpeck // * © 2015-2017 Ellpeck
*/ // */
//
package de.ellpeck.actuallyadditions.mod.booklet.page; //package de.ellpeck.actuallyadditions.mod.booklet.page;
//
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; //import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import net.minecraftforge.api.distmarker.Dist; //import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; //import net.minecraftforge.api.distmarker.OnlyIn;
//
public class PageTextOnly extends BookletPage { //public class PageTextOnly extends BookletPage {
//
public PageTextOnly(int localizationKey, int priority) { // public PageTextOnly(int localizationKey, int priority) {
super(localizationKey, priority); // super(localizationKey, priority);
} // }
//
public PageTextOnly(int localizationKey) { // public PageTextOnly(int localizationKey) {
super(localizationKey); // super(localizationKey);
} // }
//
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public static void renderTextToPage(GuiBookletBase gui, BookletPage page, int x, int y) { // public static void renderTextToPage(GuiBookletBase gui, BookletPage page, int x, int y) {
String text = page.getInfoText(); // String text = page.getInfoText();
if (text != null && !text.isEmpty()) { // if (text != null && !text.isEmpty()) {
gui.renderSplitScaledAsciiString(text, x, y, 0, false, gui.getMediumFontSize(), 120); // gui.renderSplitScaledAsciiString(text, x, y, 0, false, gui.getMediumFontSize(), 120);
} // }
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { // public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); // super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
renderTextToPage(gui, this, startX + 6, startY + 5); // renderTextToPage(gui, this, startX + 6, startY + 5);
} // }
} //}

View file

@ -1,109 +1,109 @@
/* ///*
* This file ("PageTrials.java") is part of the Actually Additions mod for Minecraft. // * This file ("PageTrials.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed // * It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at // * under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense // * http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* // *
* © 2015-2017 Ellpeck // * © 2015-2017 Ellpeck
*/ // */
//
package de.ellpeck.actuallyadditions.mod.booklet.page; //package de.ellpeck.actuallyadditions.mod.booklet.page;
//
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; //import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; //import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.data.PlayerData; //import de.ellpeck.actuallyadditions.mod.data.PlayerData;
import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave; //import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper; //import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; //import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.Minecraft; //import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.widget.button.Button; //import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.entity.player.PlayerEntity; //import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.text.TextFormatting; //import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.api.distmarker.Dist; //import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; //import net.minecraftforge.api.distmarker.OnlyIn;
//
public class PageTrials extends BookletPage { //public class PageTrials extends BookletPage {
//
private final int buttonId; // private final int buttonId;
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
private Button button; // private Button button;
//
public PageTrials(int localizationKey, boolean button, boolean text) { // public PageTrials(int localizationKey, boolean button, boolean text) {
super(localizationKey); // super(localizationKey);
//
if (!text) { // if (!text) {
this.setNoText(); // this.setNoText();
} // }
//
if (button) { // if (button) {
this.buttonId = PageLinkButton.nextButtonId; // this.buttonId = PageLinkButton.nextButtonId;
PageLinkButton.nextButtonId++; // PageLinkButton.nextButtonId++;
} else { // } else {
this.buttonId = -1; // this.buttonId = -1;
} // }
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public void init(GuiBookletBase gui, int startX, int startY) { // public void init(GuiBookletBase gui, int startX, int startY) {
super.init(gui, startX, startY); // super.init(gui, startX, startY);
//
if (this.buttonId >= 0) { // if (this.buttonId >= 0) {
this.button = new Button(this.buttonId, startX + 125 / 2 - 50, startY + 120, 100, 20, ""); // this.button = new Button(this.buttonId, startX + 125 / 2 - 50, startY + 120, 100, 20, "");
gui.getButtonList().add(this.button); // gui.getButtonList().add(this.button);
this.updateButton(); // this.updateButton();
} // }
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) { // public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks); // super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 5); // PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 5);
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
protected String getLocalizationKey() { // protected String getLocalizationKey() {
return "booklet." + ActuallyAdditions.MODID + ".trials." + this.chapter.getIdentifier() + ".text." + this.localizationKey; // return "booklet." + ActuallyAdditions.MODID + ".trials." + this.chapter.getIdentifier() + ".text." + this.localizationKey;
} // }
//
@Override // @Override
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public void actionPerformed(GuiBookletBase gui, Button button) { // public void actionPerformed(GuiBookletBase gui, Button button) {
if (this.buttonId >= 0 && button.id == this.buttonId) { // if (this.buttonId >= 0 && button.id == this.buttonId) {
PlayerEntity player = Minecraft.getInstance().player; // PlayerEntity player = Minecraft.getInstance().player;
PlayerSave data = PlayerData.getDataFromPlayer(player); // PlayerSave data = PlayerData.getDataFromPlayer(player);
String id = this.chapter.getIdentifier(); // String id = this.chapter.getIdentifier();
//
boolean completed = data.completedTrials.contains(id); // boolean completed = data.completedTrials.contains(id);
if (completed) { // if (completed) {
data.completedTrials.remove(id); // data.completedTrials.remove(id);
} else { // } else {
data.completedTrials.add(id); // data.completedTrials.add(id);
} // }
this.updateButton(); // this.updateButton();
//
PacketHandlerHelper.sendPlayerDataToServer(false, 2); // PacketHandlerHelper.sendPlayerDataToServer(false, 2);
} else { // } else {
super.actionPerformed(gui, button); // super.actionPerformed(gui, button);
} // }
} // }
//
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
private void updateButton() { // private void updateButton() {
if (this.buttonId >= 0 && this.button != null) { // if (this.buttonId >= 0 && this.button != null) {
PlayerEntity player = Minecraft.getInstance().player; // PlayerEntity player = Minecraft.getInstance().player;
PlayerSave data = PlayerData.getDataFromPlayer(player); // PlayerSave data = PlayerData.getDataFromPlayer(player);
//
boolean completed = data.completedTrials.contains(this.chapter.getIdentifier()); // boolean completed = data.completedTrials.contains(this.chapter.getIdentifier());
if (completed) { // if (completed) {
this.button.displayString = TextFormatting.DARK_GREEN + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".trialFinishButton.completed.name"); // this.button.displayString = TextFormatting.DARK_GREEN + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".trialFinishButton.completed.name");
} else { // } else {
this.button.displayString = TextFormatting.DARK_RED + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".trialFinishButton.uncompleted.name"); // this.button.displayString = TextFormatting.DARK_RED + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".trialFinishButton.uncompleted.name");
} // }
//
} // }
} // }
} //}

View file

@ -10,6 +10,7 @@
package de.ellpeck.actuallyadditions.mod.tile; package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
@ -18,8 +19,6 @@ import net.minecraftforge.energy.IEnergyStorage;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
public class TileEntityShockSuppressor extends TileEntityBase implements IEnergyDisplay { public class TileEntityShockSuppressor extends TileEntityBase implements IEnergyDisplay {
public static final List<TileEntityShockSuppressor> SUPPRESSORS = new ArrayList<>(); public static final List<TileEntityShockSuppressor> SUPPRESSORS = new ArrayList<>();
@ -32,7 +31,7 @@ public class TileEntityShockSuppressor extends TileEntityBase implements IEnergy
private int oldEnergy; private int oldEnergy;
public TileEntityShockSuppressor() { public TileEntityShockSuppressor() {
super(ActuallyTiles.SHOCKSUPPRESSOR_TILE.get()); super(ActuallyBlocks.SHOCK_SUPPRESSOR.getTileEntityType());
} }
@Override @Override

View file

@ -28,7 +28,9 @@ import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.particles.IParticleData;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@ -165,60 +167,60 @@ public final class AssetUtil {
GlStateManager.enableTexture2D(); GlStateManager.enableTexture2D();
} }
@OnlyIn(Dist.CLIENT) // @OnlyIn(Dist.CLIENT)
public static void renderNameTag(String tag, double x, double y, double z) { // public static void renderNameTag(String tag, double x, double y, double z) {
FontRenderer fontrenderer = Minecraft.getInstance().font; // FontRenderer fontrenderer = Minecraft.getInstance().font;
float f = 1.6F; // float f = 1.6F;
float f1 = 0.016666668F * f; // float f1 = 0.016666668F * f;
GlStateManager._pushMatrix(); // GlStateManager._pushMatrix();
GlStateManager.translate(x, y, z); // GlStateManager.translate(x, y, z);
GL11.glNormal3f(0.0F, 1.0F, 0.0F); // GL11.glNormal3f(0.0F, 1.0F, 0.0F);
GlStateManager.rotate(-Minecraft.getInstance().getEntityRenderDispatcher().playerViewY, 0.0F, 1.0F, 0.0F); // GlStateManager.rotate(-Minecraft.getInstance().getEntityRenderDispatcher().playerViewY, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(Minecraft.getInstance().getEntityRenderDispatcher().playerViewX, 1.0F, 0.0F, 0.0F); // GlStateManager.rotate(Minecraft.getInstance().getEntityRenderDispatcher().playerViewX, 1.0F, 0.0F, 0.0F);
GlStateManager.scale(-f1, -f1, f1); // GlStateManager.scale(-f1, -f1, f1);
GlStateManager._disableLighting(); // GlStateManager._disableLighting();
GlStateManager._depthMask(false); // GlStateManager._depthMask(false);
GlStateManager.disableDepth(); // GlStateManager.disableDepth();
GlStateManager._enableBlend(); // GlStateManager._enableBlend();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); // GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
Tessellator tessellator = Tessellator.getInstance(); // Tessellator tessellator = Tessellator.getInstance();
BufferBuilder renderer = tessellator.getBuilder(); // BufferBuilder renderer = tessellator.getBuilder();
int i = 0; // int i = 0;
int j = fontrenderer.width(tag) / 2; // int j = fontrenderer.width(tag) / 2;
GlStateManager.disableTexture2D(); // GlStateManager.disableTexture2D();
renderer.begin(7, DefaultVertexFormats.POSITION_COLOR); // renderer.begin(7, DefaultVertexFormats.POSITION_COLOR);
renderer.vertex(-j - 1, -1 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); // renderer.vertex(-j - 1, -1 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
renderer.vertex(-j - 1, 8 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); // renderer.vertex(-j - 1, 8 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
renderer.vertex(j + 1, 8 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); // renderer.vertex(j + 1, 8 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
renderer.vertex(j + 1, -1 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); // renderer.vertex(j + 1, -1 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
tessellator.end(); // tessellator.end();
GlStateManager.enableTexture2D(); // GlStateManager.enableTexture2D();
fontrenderer.draw(tag, -fontrenderer.width(tag) / 2, i, 553648127); // fontrenderer.draw(tag, -fontrenderer.width(tag) / 2, i, 553648127);
GlStateManager.enableDepth(); // GlStateManager.enableDepth();
GlStateManager._depthMask(true); // GlStateManager._depthMask(true);
fontrenderer.draw(tag, -fontrenderer.width(tag) / 2, i, -1); // fontrenderer.draw(tag, -fontrenderer.width(tag) / 2, i, -1);
GlStateManager._enableLighting(); // GlStateManager._enableLighting();
GlStateManager._disableBlend(); // GlStateManager._disableBlend();
GlStateManager.color3arg(1.0F, 1.0F, 1.0F, 1.0F); // GlStateManager.color3arg(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager._popMatrix(); // GlStateManager._popMatrix();
} // }
public static void spawnLaserWithTimeServer(World world, double startX, double startY, double startZ, double endX, double endY, double endZ, float[] color, int maxAge, double rotationTime, float size, float alpha) { public static void spawnLaserWithTimeServer(World world, double startX, double startY, double startZ, double endX, double endY, double endZ, float[] color, int maxAge, double rotationTime, float size, float alpha) {
if (!world.isClientSide) { if (!world.isClientSide) {
CompoundNBT data = new CompoundNBT(); CompoundNBT data = new CompoundNBT();
data.setDouble("StartX", startX); data.putDouble("StartX", startX);
data.setDouble("StartY", startY); data.putDouble("StartY", startY);
data.setDouble("StartZ", startZ); data.putDouble("StartZ", startZ);
data.setDouble("EndX", endX); data.putDouble("EndX", endX);
data.setDouble("EndY", endY); data.putDouble("EndY", endY);
data.setDouble("EndZ", endZ); data.putDouble("EndZ", endZ);
data.setFloat("Color1", color[0]); data.putFloat("Color1", color[0]);
data.setFloat("Color2", color[1]); data.putFloat("Color2", color[1]);
data.setFloat("Color3", color[2]); data.putFloat("Color3", color[2]);
data.setDouble("RotationTime", rotationTime); data.putDouble("RotationTime", rotationTime);
data.setFloat("Size", size); data.putFloat("Size", size);
data.setInteger("MaxAge", maxAge); data.putInt("MaxAge", maxAge);
data.setFloat("Alpha", alpha); data.putFloat("Alpha", alpha);
PacketHandler.THE_NETWORK.sendToAllAround(new PacketServerToClient(data, PacketHandler.LASER_HANDLER), new NetworkRegistry.TargetPoint(world.provider.getDimension(), startX, startY, startZ, 96)); PacketHandler.THE_NETWORK.sendToAllAround(new PacketServerToClient(data, PacketHandler.LASER_HANDLER), new NetworkRegistry.TargetPoint(world.provider.getDimension(), startX, startY, startZ, 96));
} }
} }
@ -227,9 +229,9 @@ public final class AssetUtil {
public static void spawnLaserWithTimeClient(double startX, double startY, double startZ, double endX, double endY, double endZ, float[] color, int maxAge, double rotationTime, float size, float alpha) { public static void spawnLaserWithTimeClient(double startX, double startY, double startZ, double endX, double endY, double endZ, float[] color, int maxAge, double rotationTime, float size, float alpha) {
Minecraft mc = Minecraft.getInstance(); Minecraft mc = Minecraft.getInstance();
if (mc.player.distanceTo(startX, startY, startZ) <= 64 || mc.player.distanceTo(endX, endY, endZ) <= 64) { if (mc.player.distanceToSqr(startX, startY, startZ) <= 64 || mc.player.distanceToSqr(endX, endY, endZ) <= 64) {
Particle fx = new ParticleBeam(mc.level, startX, startY, startZ, endX, endY, endZ, color, maxAge, rotationTime, size, alpha); Particle fx = new ParticleBeam(mc.level, startX, startY, startZ, endX, endY, endZ, color, maxAge, rotationTime, size, alpha);
mc.effectRenderer.addEffect(fx); mc.level.addParticle((IParticleData) fx, startX, startY, startZ, 0, 0, 0);
} }
} }
@ -245,12 +247,12 @@ public final class AssetUtil {
float g = color[1]; float g = color[1];
float b = color[2]; float b = color[2];
Vec3d vec1 = new Vec3d(firstX, firstY, firstZ); Vector3d vec1 = new Vector3d(firstX, firstY, firstZ);
Vec3d vec2 = new Vec3d(secondX, secondY, secondZ); Vector3d vec2 = new Vector3d(secondX, secondY, secondZ);
Vec3d combinedVec = vec2.subtract(vec1); Vector3d combinedVec = vec2.subtract(vec1);
double rot = rotationTime > 0 double rot = rotationTime > 0
? 360D * (world.getTotalWorldTime() % rotationTime / rotationTime) ? 360D * (world.getGameTime() % rotationTime / rotationTime)
: 0; : 0;
double pitch = Math.atan2(combinedVec.y, Math.sqrt(combinedVec.x * combinedVec.x + combinedVec.z * combinedVec.z)); double pitch = Math.atan2(combinedVec.y, Math.sqrt(combinedVec.x * combinedVec.x + combinedVec.z * combinedVec.z));
double yaw = Math.atan2(-combinedVec.z, combinedVec.x); double yaw = Math.atan2(-combinedVec.z, combinedVec.x);
@ -261,7 +263,7 @@ public final class AssetUtil {
GlStateManager._disableLighting(); GlStateManager._disableLighting();
GlStateManager._enableBlend(); GlStateManager._enableBlend();
GlStateManager._blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE); GlStateManager._blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE);
int func = GL11.glGetInteger(GL11.GL_ALPHA_TEST_FUNC); int func = GL11.glGetInteger(GL11.GL_ALPHA_TEST_FUNC);
float ref = GL11.glGetFloat(GL11.GL_ALPHA_TEST_REF); float ref = GL11.glGetFloat(GL11.GL_ALPHA_TEST_REF);
GlStateManager._alphaFunc(GL11.GL_ALWAYS, 0); GlStateManager._alphaFunc(GL11.GL_ALWAYS, 0);

View file

@ -10,17 +10,13 @@
package de.ellpeck.actuallyadditions.mod.util; package de.ellpeck.actuallyadditions.mod.util;
import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.I18n;
import net.minecraft.util.text.LanguageMap; import net.minecraft.util.text.LanguageMap;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.ForgeI18n;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.util.List;
public final class StringUtil { public final class StringUtil {
@ -28,6 +24,8 @@ public final class StringUtil {
public static final int DECIMAL_COLOR_GRAY_TEXT = 4210752; public static final int DECIMAL_COLOR_GRAY_TEXT = 4210752;
public static final String BUGGED_ITEM_NAME = ActuallyAdditions.MODID + ".lolWutHowUDoDis"; public static final String BUGGED_ITEM_NAME = ActuallyAdditions.MODID + ".lolWutHowUDoDis";
//TODO: Remove
static LanguageMap cancerino;
/** /**
* Localizes a given String * Localizes a given String
@ -48,58 +46,59 @@ public final class StringUtil {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
//TODO: delete this shit and move ItemPotionRing's getItemStackDisplayName into getUnlocalizedName //TODO: delete this shit and move ItemPotionRing's getItemStackDisplayName into getUnlocalizedName
public static String localizeIllegallyOnTheServerDontUseMePls(String langKey) { public static String localizeIllegallyOnTheServerDontUseMePls(String langKey) {
return net.minecraft.util.text.translation.I18n.translateToLocal(langKey); return I18n.get(langKey);
} }
// TODO: Move to official
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static void drawSplitString(FontRenderer renderer, String strg, int x, int y, int width, int color, boolean shadow) { public static void drawSplitString(FontRenderer renderer, String strg, int x, int y, int width, int color, boolean shadow) {
List<String> list = renderer.listFormattedStringToWidth(strg, width); // ResourcePackList <- holds the correct way
for (int i = 0; i < list.size(); i++) { // List<String> list = renderer.listFormattedStringToWidth(strg, width);
String s1 = list.get(i); // for (int i = 0; i < list.size(); i++) {
renderer.draw(s1, x, y + i * renderer.lineHeight, color, shadow); // String s1 = list.get(i);
} // renderer.draw(s1, x, y + i * renderer.lineHeight, color, shadow);
// }
} }
// @OnlyIn(Dist.CLIENT)
// public static void renderSplitScaledAsciiString(FontRenderer font, String text, int x, int y, int color, boolean shadow, float scale, int length) {
// List<String> lines = font.listFormattedStringToWidth(text, (int) (length / scale));
// for (int i = 0; i < lines.size(); i++) {
// renderScaledAsciiString(font, lines.get(i), x, y + i * (int) (font.lineHeight * scale + 3), color, shadow, scale);
// }
// }
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static void renderScaledAsciiString(FontRenderer font, String text, float x, float y, int color, boolean shadow, float scale) { public static void renderScaledAsciiString(FontRenderer font, String text, float x, float y, int color, boolean shadow, float scale) {
GlStateManager._pushMatrix(); // GlStateManager._pushMatrix();
GlStateManager.scale(scale, scale, scale); // GlStateManager.scale(scale, scale, scale);
boolean oldUnicode = font.getUnicodeFlag(); // boolean oldUnicode = font.getUnicodeFlag();
font.setUnicodeFlag(false); // font.setUnicodeFlag(false);
//
font.draw(text, x / scale, y / scale, color, shadow); // font.draw(text, x / scale, y / scale, color, shadow);
//
font.setUnicodeFlag(oldUnicode); // font.setUnicodeFlag(oldUnicode);
GlStateManager._popMatrix(); // GlStateManager._popMatrix();
} }
@OnlyIn(Dist.CLIENT) // static void setupLangMap() {
public static void renderSplitScaledAsciiString(FontRenderer font, String text, int x, int y, int color, boolean shadow, float scale, int length) { // try {
List<String> lines = font.listFormattedStringToWidth(text, (int) (length / scale)); // Method m = LanguageMap.class.getDeclaredMethod("inject", LanguageMap.class, InputStream.class);
for (int i = 0; i < lines.size(); i++) { // m.setAccessible(true);
renderScaledAsciiString(font, lines.get(i), x, y + i * (int) (font.lineHeight * scale + 3), color, shadow, scale); // m.invoke(null, cancerino = new LanguageMap(), ActuallyAdditions.class.getResourceAsStream("/assets/actuallyadditions/lang/en_US.lang"));
} // } catch (Exception e) {
} // e.printStackTrace();
// throw new RuntimeException("Actually Additions failed to access LanguageMap.inject. Report this!");
//TODO: Remove // }
static LanguageMap cancerino; // }
static void setupLangMap() {
try {
Method m = LanguageMap.class.getDeclaredMethod("inject", LanguageMap.class, InputStream.class);
m.setAccessible(true);
m.invoke(null, cancerino = new LanguageMap(), ActuallyAdditions.class.getResourceAsStream("/assets/actuallyadditions/lang/en_US.lang"));
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("Actually Additions failed to access LanguageMap.inject. Report this!");
}
}
// TODO: This might be wrong
public static String badTranslate(String someUnlocAAItemName) { public static String badTranslate(String someUnlocAAItemName) {
if (cancerino == null) { // if (cancerino == null) {
cancerino = new LanguageMap(); // cancerino = new LanguageMap();
setupLangMap(); // setupLangMap();
} // }
return cancerino.translateKey("item.actuallyadditions." + someUnlocAAItemName + ".name"); // return cancerino.translateKey("item.actuallyadditions." + someUnlocAAItemName + ".name");
return ForgeI18n.parseFormat("item.actuallyadditions." + someUnlocAAItemName + ".name");
} }
} }

View file

@ -1,9 +1,9 @@
package de.ellpeck.actuallyadditions.mod.util; package de.ellpeck.actuallyadditions.mod.util;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.server.ServerWorld; import net.minecraft.world.server.ServerWorld;
public final class VanillaPacketDispatcher { public final class VanillaPacketDispatcher {
@ -11,16 +11,11 @@ public final class VanillaPacketDispatcher {
//Don't call from the client. //Don't call from the client.
public static void dispatchTEToNearbyPlayers(TileEntity tile) { public static void dispatchTEToNearbyPlayers(TileEntity tile) {
ServerWorld world = (ServerWorld) tile.getLevel(); ServerWorld world = (ServerWorld) tile.getLevel();
PlayerChunkMapEntry entry = world.getPlayerChunkMap().getEntry(tile.getBlockPos().getX() >> 4, tile.getBlockPos().getZ() >> 4); Chunk chunk = world.getChunk(tile.getBlockPos().getX() >> 4, tile.getBlockPos().getZ() >> 4);
if (entry == null) {
return;
}
for (ServerPlayerEntity player : entry.getWatchingPlayers()) {
player.connection.send(tile.getUpdatePacket());
}
world.getChunkSource().chunkMap.getPlayers(chunk.getPos(), false).forEach(e -> {
e.connection.send(tile.getUpdatePacket());
});
} }
public static void dispatchTEToNearbyPlayers(World world, BlockPos pos) { public static void dispatchTEToNearbyPlayers(World world, BlockPos pos) {

View file

@ -28,6 +28,7 @@ import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld; import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.ForgeHooks;
@ -116,8 +117,8 @@ public final class WorldUtil {
public static void doEnergyInteraction(TileEntity tileFrom, TileEntity tileTo, Direction sideTo, int maxTransfer) { public static void doEnergyInteraction(TileEntity tileFrom, TileEntity tileTo, Direction sideTo, int maxTransfer) {
if (maxTransfer > 0) { if (maxTransfer > 0) {
Direction opp = sideTo == null Direction opp = sideTo == null
? null ? null
: sideTo.getOpposite(); : sideTo.getOpposite();
IEnergyStorage handlerFrom = tileFrom.getCapability(CapabilityEnergy.ENERGY, sideTo); IEnergyStorage handlerFrom = tileFrom.getCapability(CapabilityEnergy.ENERGY, sideTo);
IEnergyStorage handlerTo = tileTo.getCapability(CapabilityEnergy.ENERGY, opp); IEnergyStorage handlerTo = tileTo.getCapability(CapabilityEnergy.ENERGY, opp);
if (handlerFrom != null && handlerTo != null) { if (handlerFrom != null && handlerTo != null) {
@ -151,7 +152,6 @@ public final class WorldUtil {
* @param positions The Positions, an array of {x, y, z} arrays containing Positions * @param positions The Positions, an array of {x, y, z} arrays containing Positions
* @param block The Block * @param block The Block
* @param world The World * @param world The World
*
* @return Is every block present? * @return Is every block present?
*/ */
public static boolean hasBlocksInPlacesGiven(BlockPos[] positions, Block block, World world) { public static boolean hasBlocksInPlacesGiven(BlockPos[] positions, Block block, World world) {
@ -258,14 +258,14 @@ public final class WorldUtil {
double d0 = player.posX; double d0 = player.posX;
double d1 = player.posY + player.getEyeHeight(); double d1 = player.posY + player.getEyeHeight();
double d2 = player.posZ; double d2 = player.posZ;
Vec3d vec3 = new Vec3d(d0, d1, d2); Vector3d vec3 = new Vector3d(d0, d1, d2);
float f2 = MathHelper.cos(-f1 * 0.017453292F - (float) Math.PI); float f2 = MathHelper.cos(-f1 * 0.017453292F - (float) Math.PI);
float f3 = MathHelper.sin(-f1 * 0.017453292F - (float) Math.PI); float f3 = MathHelper.sin(-f1 * 0.017453292F - (float) Math.PI);
float f4 = -MathHelper.cos(-f * 0.017453292F); float f4 = -MathHelper.cos(-f * 0.017453292F);
float f5 = MathHelper.sin(-f * 0.017453292F); float f5 = MathHelper.sin(-f * 0.017453292F);
float f6 = f3 * f4; float f6 = f3 * f4;
float f7 = f2 * f4; float f7 = f2 * f4;
Vec3d vec31 = vec3.add(f6 * distance, f5 * distance, f7 * distance); Vector3d vec31 = vec3.add(f6 * distance, f5 * distance, f7 * distance);
return world.clipWithInteractionOverride(vec3, vec31, p1, p2, p3); return world.clipWithInteractionOverride(vec3, vec31, p1, p2, p3);
} }
@ -308,7 +308,6 @@ public final class WorldUtil {
* @param world The player's world. * @param world The player's world.
* @param player The player that is breaking this block. * @param player The player that is breaking this block.
* @param pos The pos to break. * @param pos The pos to break.
*
* @return If the break was successful. * @return If the break was successful.
*/ */
public static boolean breakExtraBlock(ItemStack stack, World world, PlayerEntity player, BlockPos pos) { public static boolean breakExtraBlock(ItemStack stack, World world, PlayerEntity player, BlockPos pos) {