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.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheColoredLampColors;
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapter;
import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapterCoffee;
import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapterCrusher;
import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapterTrials;
import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntry;
import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryAllItems;
import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryTrials;
import de.ellpeck.actuallyadditions.mod.booklet.page.*;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
import de.ellpeck.actuallyadditions.mod.crafting.*;
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import de.ellpeck.actuallyadditions.mod.items.ItemWingsOfTheBats;
import de.ellpeck.actuallyadditions.mod.items.lens.LensDisenchanting;
import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods;
import de.ellpeck.actuallyadditions.mod.tile.*;
import de.ellpeck.actuallyadditions.mod.update.UpdateChecker;
import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.block.Blocks;
import net.minecraft.fluid.Fluid;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.Ingredient;
import net.minecraftforge.fluids.FluidAttributes;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidUtil;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public final class InitBooklet {
public static BookletChapter[] chaptersIntroduction = new BookletChapter[11];
public static void init() {
ActuallyAdditionsAPI.entryAllAndSearch = new BookletEntryAllItems("allAndSearch").setImportant();
ActuallyAdditionsAPI.entryTrials = new BookletEntryTrials("trials");
ActuallyAdditionsAPI.entryGettingStarted = new BookletEntry("gettingStarted").setImportant();
ActuallyAdditionsAPI.entryReconstruction = new BookletEntry("reconstruction");
ActuallyAdditionsAPI.entryLaserRelays = new BookletEntry("laserRelays").setSpecial();
ActuallyAdditionsAPI.entryFunctionalNonRF = new BookletEntry("functionalNoRF");
ActuallyAdditionsAPI.entryFunctionalRF = new BookletEntry("functionalRF");
ActuallyAdditionsAPI.entryGeneratingRF = new BookletEntry("generatingRF");
ActuallyAdditionsAPI.entryItemsNonRF = new BookletEntry("itemsNoRF");
ActuallyAdditionsAPI.entryItemsRF = new BookletEntry("itemsRF");
ActuallyAdditionsAPI.entryMisc = new BookletEntry("misc");
ActuallyAdditionsAPI.entryUpdatesAndInfos = new BookletEntry("updatesAndInfos").setSpecial();
initChapters();
int chapCount = 0;
int pageCount = 0;
int infoCount = 0;
for (IBookletEntry entry : ActuallyAdditionsAPI.BOOKLET_ENTRIES) {
for (IBookletChapter chapter : entry.getAllChapters()) {
if (!ActuallyAdditionsAPI.ALL_CHAPTERS.contains(chapter)) {
ActuallyAdditionsAPI.ALL_CHAPTERS.add(chapter);
chapCount++;
for (IBookletPage page : chapter.getAllPages()) {
pageCount++;
List<ItemStack> items = new ArrayList<>();
page.getItemStacksForPage(items);
List<FluidStack> fluids = new ArrayList<>();
page.getFluidStacksForPage(fluids);
if (items != null && !items.isEmpty() || fluids != null && !fluids.isEmpty()) {
if (!ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA.contains(page)) {
ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA.add(page);
infoCount++;
}
}
}
}
}
}
Collections.sort(ActuallyAdditionsAPI.BOOKLET_ENTRIES, (entry1, entry2) -> {
Integer prio1 = entry1.getSortingPriority();
Integer prio2 = entry2.getSortingPriority();
return prio2.compareTo(prio1);
});
Collections.sort(ActuallyAdditionsAPI.ALL_CHAPTERS, (chapter1, chapter2) -> {
Integer prio1 = chapter1.getSortingPriority();
Integer prio2 = chapter2.getSortingPriority();
return prio2.compareTo(prio1);
});
Collections.sort(ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA, (page1, page2) -> {
Integer prio1 = page1.getSortingPriority();
Integer prio2 = page2.getSortingPriority();
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!");
}
private static void initChapters() {
/*
//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[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));
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()));
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 PageCrafting(crystalPages.size() + 1, MiscCrafting.RECIPES_CRYSTALS).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[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());
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)));
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 PageCrafting(empowererPages.size() + 1, MiscCrafting.RECIPES_EMPOWERED_CRYSTALS).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("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();
//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("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("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());
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("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<>();
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());
for (IRecipe recipe : BlockCrafting.RECIPES_LAMPS) {
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("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("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("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("tinyTorch", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyBlocks.TINY_TORCH.get()), new PageCrafting(1, BlockCrafting.recipesTinyTorch).setWildcard()).setSpecial();
//Reconstruction
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("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("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("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("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
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("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("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("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("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
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("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("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("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("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("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
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("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 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.add(new PageTextOnly(1).addTextReplacement("<rf>", TileEntityCrusher.ENERGY_USE));
list.add(new PageCrafting(2, BlockCrafting.recipeCrusher).setWildcard().setNoText());
list.add(new PageCrafting(3, BlockCrafting.recipeDoubleCrusher).setWildcard().setNoText());
if (CrusherCrafting.recipeIronHorseArmor != null) {
list.add(new PageCrusherRecipe(4, CrusherCrafting.recipeIronHorseArmor).setNoText());
}
if (CrusherCrafting.recipeGoldHorseArmor != null) {
list.add(new PageCrusherRecipe(5, CrusherCrafting.recipeGoldHorseArmor).setNoText());
}
if (CrusherCrafting.recipeDiamondHorseArmor != null) {
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 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("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("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("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));
//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("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("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();
//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();
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("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("playerProbe", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.PLAYER_PROBE.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipePlayerProbe).setNoText()).setSpecial();
ArrayList<BookletPage> aiotPages = new ArrayList<>();
aiotPages.add(new PageTextOnly(aiotPages.size() + 1));
for (IRecipe recipe : ToolCrafting.RECIPES_PAXELS) {
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("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<>();
potionRingPages.add(new PageTextOnly(potionRingPages.size() + 1));
for (IRecipe recipe : ItemCrafting.RECIPES_POTION_RINGS) {
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("itemFilter", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyItems.FILTER.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeFilter).setNoText()).setImportant();
//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("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("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("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());
//Updates and infos
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("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"));
//Trials
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("leatherProduction", new ItemStack(Items.LEATHER), 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("empoweredOil", FluidUtil.getFilledBucket(new FluidStack(InitFluids.fluidEmpoweredOil, FluidAttributes.BUCKET_VOLUME)), false);
new BookletChapterTrials("mobFarm", new ItemStack(Items.ROTTEN_FLESH), false);
new BookletChapterTrials("empowererAutomation", new ItemStack(ActuallyBlocks.EMPOWERER.get()), false);
*/
}
}
///*
// * This file ("InitBooklet.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// *
// * © 2015-2017 Ellpeck
// */
//
//package de.ellpeck.actuallyadditions.mod.booklet;
//
//import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
//import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
//import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheColoredLampColors;
//import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
//import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapter;
//import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapterCoffee;
//import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapterCrusher;
//import de.ellpeck.actuallyadditions.mod.booklet.chapter.BookletChapterTrials;
//import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntry;
//import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryAllItems;
//import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryTrials;
//import de.ellpeck.actuallyadditions.mod.booklet.page.*;
//import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
//import de.ellpeck.actuallyadditions.mod.crafting.*;
//import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
//import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
//import de.ellpeck.actuallyadditions.mod.items.ItemWingsOfTheBats;
//import de.ellpeck.actuallyadditions.mod.items.lens.LensDisenchanting;
//import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler;
//import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods;
//import de.ellpeck.actuallyadditions.mod.tile.*;
//import de.ellpeck.actuallyadditions.mod.update.UpdateChecker;
//import de.ellpeck.actuallyadditions.mod.util.Util;
//import net.minecraft.block.Blocks;
//import net.minecraft.fluid.Fluid;
//import net.minecraft.item.ItemStack;
//import net.minecraft.item.Items;
//import net.minecraft.item.crafting.IRecipe;
//import net.minecraft.item.crafting.Ingredient;
//import net.minecraftforge.fluids.FluidAttributes;
//import net.minecraftforge.fluids.FluidStack;
//import net.minecraftforge.fluids.FluidUtil;
//
//import java.util.ArrayList;
//import java.util.Arrays;
//import java.util.Collections;
//import java.util.List;
//
//public final class InitBooklet {
//
// public static BookletChapter[] chaptersIntroduction = new BookletChapter[11];
//
// public static void init() {
// ActuallyAdditionsAPI.entryAllAndSearch = new BookletEntryAllItems("allAndSearch").setImportant();
// ActuallyAdditionsAPI.entryTrials = new BookletEntryTrials("trials");
//
// ActuallyAdditionsAPI.entryGettingStarted = new BookletEntry("gettingStarted").setImportant();
// ActuallyAdditionsAPI.entryReconstruction = new BookletEntry("reconstruction");
// ActuallyAdditionsAPI.entryLaserRelays = new BookletEntry("laserRelays").setSpecial();
// ActuallyAdditionsAPI.entryFunctionalNonRF = new BookletEntry("functionalNoRF");
// ActuallyAdditionsAPI.entryFunctionalRF = new BookletEntry("functionalRF");
// ActuallyAdditionsAPI.entryGeneratingRF = new BookletEntry("generatingRF");
// ActuallyAdditionsAPI.entryItemsNonRF = new BookletEntry("itemsNoRF");
// ActuallyAdditionsAPI.entryItemsRF = new BookletEntry("itemsRF");
// ActuallyAdditionsAPI.entryMisc = new BookletEntry("misc");
// ActuallyAdditionsAPI.entryUpdatesAndInfos = new BookletEntry("updatesAndInfos").setSpecial();
//
// initChapters();
//
// int chapCount = 0;
// int pageCount = 0;
// int infoCount = 0;
// for (IBookletEntry entry : ActuallyAdditionsAPI.BOOKLET_ENTRIES) {
// for (IBookletChapter chapter : entry.getAllChapters()) {
// if (!ActuallyAdditionsAPI.ALL_CHAPTERS.contains(chapter)) {
// ActuallyAdditionsAPI.ALL_CHAPTERS.add(chapter);
// chapCount++;
//
// for (IBookletPage page : chapter.getAllPages()) {
// pageCount++;
//
// List<ItemStack> items = new ArrayList<>();
// page.getItemStacksForPage(items);
// List<FluidStack> fluids = new ArrayList<>();
// page.getFluidStacksForPage(fluids);
//
// if (items != null && !items.isEmpty() || fluids != null && !fluids.isEmpty()) {
// if (!ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA.contains(page)) {
// ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA.add(page);
// infoCount++;
// }
// }
// }
// }
// }
// }
//
// Collections.sort(ActuallyAdditionsAPI.BOOKLET_ENTRIES, (entry1, entry2) -> {
// Integer prio1 = entry1.getSortingPriority();
// Integer prio2 = entry2.getSortingPriority();
// return prio2.compareTo(prio1);
// });
// Collections.sort(ActuallyAdditionsAPI.ALL_CHAPTERS, (chapter1, chapter2) -> {
// Integer prio1 = chapter1.getSortingPriority();
// Integer prio2 = chapter2.getSortingPriority();
// return prio2.compareTo(prio1);
// });
// Collections.sort(ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA, (page1, page2) -> {
// Integer prio1 = page1.getSortingPriority();
// Integer prio2 = page2.getSortingPriority();
// 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!");
// }
//
// private static void initChapters() {
// /*
// //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[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));
// 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()));
// 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 PageCrafting(crystalPages.size() + 1, MiscCrafting.RECIPES_CRYSTALS).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[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());
// 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)));
// 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 PageCrafting(empowererPages.size() + 1, MiscCrafting.RECIPES_EMPOWERED_CRYSTALS).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("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();
//
// //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("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("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());
// 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("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<>();
// 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());
// for (IRecipe recipe : BlockCrafting.RECIPES_LAMPS) {
// 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("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("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("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("tinyTorch", ActuallyAdditionsAPI.entryMisc, new ItemStack(ActuallyBlocks.TINY_TORCH.get()), new PageCrafting(1, BlockCrafting.recipesTinyTorch).setWildcard()).setSpecial();
//
// //Reconstruction
// 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("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("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("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("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
// 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("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("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("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("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
// 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("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("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("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("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("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
// 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("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 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.add(new PageTextOnly(1).addTextReplacement("<rf>", TileEntityCrusher.ENERGY_USE));
// list.add(new PageCrafting(2, BlockCrafting.recipeCrusher).setWildcard().setNoText());
// list.add(new PageCrafting(3, BlockCrafting.recipeDoubleCrusher).setWildcard().setNoText());
// if (CrusherCrafting.recipeIronHorseArmor != null) {
// list.add(new PageCrusherRecipe(4, CrusherCrafting.recipeIronHorseArmor).setNoText());
// }
// if (CrusherCrafting.recipeGoldHorseArmor != null) {
// list.add(new PageCrusherRecipe(5, CrusherCrafting.recipeGoldHorseArmor).setNoText());
// }
// if (CrusherCrafting.recipeDiamondHorseArmor != null) {
// 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 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("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("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("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));
//
// //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("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("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();
//
// //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();
// 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("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("playerProbe", ActuallyAdditionsAPI.entryItemsNonRF, new ItemStack(ActuallyItems.PLAYER_PROBE.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipePlayerProbe).setNoText()).setSpecial();
// ArrayList<BookletPage> aiotPages = new ArrayList<>();
// aiotPages.add(new PageTextOnly(aiotPages.size() + 1));
// for (IRecipe recipe : ToolCrafting.RECIPES_PAXELS) {
// 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("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<>();
// potionRingPages.add(new PageTextOnly(potionRingPages.size() + 1));
// for (IRecipe recipe : ItemCrafting.RECIPES_POTION_RINGS) {
// 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("itemFilter", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(ActuallyItems.FILTER.get()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeFilter).setNoText()).setImportant();
//
// //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("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("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("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());
//
// //Updates and infos
// 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("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"));
//
// //Trials
// 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("leatherProduction", new ItemStack(Items.LEATHER), 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("empoweredOil", FluidUtil.getFilledBucket(new FluidStack(InitFluids.fluidEmpoweredOil, FluidAttributes.BUCKET_VOLUME)), false);
// new BookletChapterTrials("mobFarm", new ItemStack(Items.ROTTEN_FLESH), 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.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.button;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiPage;
import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.client.gui.GuiUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@OnlyIn(Dist.CLIENT)
public class BookmarkButton extends Button {
private final GuiBooklet booklet;
public IBookletPage assignedPage;
public BookmarkButton(int x, int y, GuiBooklet booklet) {
super(x, y, 16, 16, StringTextComponent.EMPTY, btn -> {
BookmarkButton button = (BookmarkButton) btn;
if (button.assignedPage != null) {
if (Screen.hasShiftDown()) {
button.assignedPage = null;
} else if (!(button.booklet instanceof GuiPage) || ((GuiPage) button.booklet).pages[0] != button.assignedPage) {
GuiPage gui = BookletUtils.createPageGui(button.booklet.previousScreen, button.booklet, button.assignedPage);
Minecraft.getInstance().setScreen(gui);
}
} else {
if (button.booklet instanceof GuiPage) {
button.assignedPage = ((GuiPage) button.booklet).pages[0];
}
}
});
this.booklet = booklet;
}
@Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) {
if (this.visible) {
Minecraft.getInstance().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS);
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;
int offset = this.isHovered
? 1
: 0;
GlStateManager._enableBlend();
GlStateManager._blendFuncSeparate(770, 771, 1, 0);
GlStateManager._blendFunc(770, 771);
int renderHeight = 25;
this.blit(matrices, this.x, this.y, 224 + (this.assignedPage == null
? 0
: 16), 14 - renderHeight + offset * renderHeight, this.width, renderHeight);
// TODO: FIX THIS
// this.mouseDragged(minecraft, mouseX, mouseY);
if (this.assignedPage != null) {
ItemStack display = this.assignedPage.getChapter().getDisplayItemStack();
if (StackUtil.isValid(display)) {
GlStateManager._pushMatrix();
AssetUtil.renderStackToGui(display, this.x + 2, this.y + 1, 0.725F);
GlStateManager._popMatrix();
}
}
}
}
public void drawHover(MatrixStack stack, int mouseX, int mouseY) {
if (this.isMouseOver(mouseX, mouseY)) {
List<String> list = new ArrayList<>();
if (this.assignedPage != null) {
IBookletChapter chapter = this.assignedPage.getChapter();
list.add(TextFormatting.GOLD + chapter.getLocalizedName() + ", Page " + (chapter.getPageIndex(this.assignedPage) + 1));
list.add(StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.bookmark.openDesc"));
list.add(TextFormatting.ITALIC + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.bookmark.removeDesc"));
} else {
list.add(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.noBookmark.name"));
if (this.booklet instanceof GuiPage) {
list.add(StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.noBookmark.pageDesc"));
} else {
list.add(StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.noBookmark.notPageDesc"));
}
}
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);
}
}
}
///*
// * This file ("BookmarkButton.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// *
// * © 2015-2017 Ellpeck
// */
//
//package de.ellpeck.actuallyadditions.mod.booklet.button;
//
//import com.mojang.blaze3d.matrix.MatrixStack;
//import com.mojang.blaze3d.platform.GlStateManager;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
//import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiPage;
//import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
//import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
//import de.ellpeck.actuallyadditions.mod.util.StackUtil;
//import de.ellpeck.actuallyadditions.mod.util.StringUtil;
//import net.minecraft.client.Minecraft;
//import net.minecraft.client.gui.screen.Screen;
//import net.minecraft.client.gui.widget.button.Button;
//import net.minecraft.item.ItemStack;
//import net.minecraft.util.text.StringTextComponent;
//import net.minecraft.util.text.TextFormatting;
//import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn;
//import net.minecraftforge.fml.client.gui.GuiUtils;
//
//import java.util.ArrayList;
//import java.util.List;
//import java.util.stream.Collectors;
//
//@OnlyIn(Dist.CLIENT)
//public class BookmarkButton extends Button {
//
// private final GuiBooklet booklet;
// public IBookletPage assignedPage;
//
// public BookmarkButton(int x, int y, GuiBooklet booklet) {
// super(x, y, 16, 16, StringTextComponent.EMPTY, btn -> {
// BookmarkButton button = (BookmarkButton) btn;
// if (button.assignedPage != null) {
// if (Screen.hasShiftDown()) {
// button.assignedPage = null;
// } else if (!(button.booklet instanceof GuiPage) || ((GuiPage) button.booklet).pages[0] != button.assignedPage) {
// GuiPage gui = BookletUtils.createPageGui(button.booklet.previousScreen, button.booklet, button.assignedPage);
// Minecraft.getInstance().setScreen(gui);
// }
// } else {
// if (button.booklet instanceof GuiPage) {
// button.assignedPage = ((GuiPage) button.booklet).pages[0];
// }
// }
// });
// this.booklet = booklet;
// }
//
// @Override
// public void render(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) {
// if (this.visible) {
// Minecraft.getInstance().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS);
// 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;
// int offset = this.isHovered
// ? 1
// : 0;
//
// GlStateManager._enableBlend();
// GlStateManager._blendFuncSeparate(770, 771, 1, 0);
// GlStateManager._blendFunc(770, 771);
// int renderHeight = 25;
// this.blit(matrices, this.x, this.y, 224 + (this.assignedPage == null
// ? 0
// : 16), 14 - renderHeight + offset * renderHeight, this.width, renderHeight);
//
// // TODO: FIX THIS
// // this.mouseDragged(minecraft, mouseX, mouseY);
//
// if (this.assignedPage != null) {
// ItemStack display = this.assignedPage.getChapter().getDisplayItemStack();
// if (StackUtil.isValid(display)) {
// GlStateManager._pushMatrix();
// AssetUtil.renderStackToGui(display, this.x + 2, this.y + 1, 0.725F);
// GlStateManager._popMatrix();
// }
// }
// }
// }
//
// public void drawHover(MatrixStack stack, int mouseX, int mouseY) {
// if (this.isMouseOver(mouseX, mouseY)) {
// List<String> list = new ArrayList<>();
//
// if (this.assignedPage != null) {
// IBookletChapter chapter = this.assignedPage.getChapter();
//
// list.add(TextFormatting.GOLD + chapter.getLocalizedName() + ", Page " + (chapter.getPageIndex(this.assignedPage) + 1));
// list.add(StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.bookmark.openDesc"));
// list.add(TextFormatting.ITALIC + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.bookmark.removeDesc"));
// } else {
// list.add(TextFormatting.GOLD + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.noBookmark.name"));
//
// if (this.booklet instanceof GuiPage) {
// list.add(StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.noBookmark.pageDesc"));
// } else {
// list.add(StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".bookmarkButton.noBookmark.notPageDesc"));
// }
// }
//
// 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);
// }
// }
//}

View file

@ -1,67 +1,67 @@
/*
* This file ("EntryButton.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.button;
import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT)
public class EntryButton extends Button {
private final GuiBookletBase gui;
private final 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);
this.gui = gui;
StackUtil.isValid(stackToRender);
this.stackToRender = stackToRender;
}
@Override
public void drawButton(Minecraft minecraft, int mouseX, int mouseY, float f) {
if (this.visible) {
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;
GlStateManager._enableBlend();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GlStateManager._blendFunc(770, 771);
this.mouseDragged(minecraft, mouseX, mouseY);
int textOffsetX = 0;
if (StackUtil.isValid(this.stackToRender)) {
GlStateManager._pushMatrix();
AssetUtil.renderStackToGui(this.stackToRender, this.x - 4, this.y, 0.725F);
GlStateManager._popMatrix();
textOffsetX = 10;
}
float scale = this.gui.getMediumFontSize();
if (this.hovered) {
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);
GlStateManager._popMatrix();
}
StringUtil.renderScaledAsciiString(minecraft.font, this.displayString, this.x + textOffsetX, this.y + 2 + (this.height - 8) / 2, 0, false, scale);
}
}
}
///*
// * This file ("EntryButton.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// *
// * © 2015-2017 Ellpeck
// */
//
//package de.ellpeck.actuallyadditions.mod.booklet.button;
//
//import com.mojang.blaze3d.platform.GlStateManager;
//import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
//import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
//import de.ellpeck.actuallyadditions.mod.util.StackUtil;
//import de.ellpeck.actuallyadditions.mod.util.StringUtil;
//import net.minecraft.client.Minecraft;
//import net.minecraft.client.gui.widget.button.Button;
//import net.minecraft.item.ItemStack;
//import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn;
//
//
//@OnlyIn(Dist.CLIENT)
//public class EntryButton extends Button {
//
// private final GuiBookletBase gui;
// private final 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);
// this.gui = gui;
// StackUtil.isValid(stackToRender);
// this.stackToRender = stackToRender;
// }
//
// @Override
// public void drawButton(Minecraft minecraft, int mouseX, int mouseY, float f) {
// if (this.visible) {
// 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;
// GlStateManager._enableBlend();
// GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
// GlStateManager._blendFunc(770, 771);
// this.mouseDragged(minecraft, mouseX, mouseY);
//
// int textOffsetX = 0;
// if (StackUtil.isValid(this.stackToRender)) {
// GlStateManager._pushMatrix();
// AssetUtil.renderStackToGui(this.stackToRender, this.x - 4, this.y, 0.725F);
// GlStateManager._popMatrix();
// textOffsetX = 10;
// }
//
// float scale = this.gui.getMediumFontSize();
//
// if (this.hovered) {
// 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);
// GlStateManager._popMatrix();
// }
//
// 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.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.button;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
import de.ellpeck.actuallyadditions.mod.inventory.gui.TexturedButton;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.widget.button.Button.IPressable;
public class TrialsButton extends TexturedButton {
private final boolean isTrials;
public TrialsButton(GuiBooklet gui, IPressable action) {
super(GuiBooklet.RES_LOC_GADGETS, gui.getGuiLeft() + gui.getSizeX(), gui.getGuiTop() + 10, 0, 204, 52, 16, action);
this.isTrials = gui.areTrialsOpened();
this.active = !this.isTrials;
}
@Override
public void drawButton(Minecraft minecraft, int x, int y, float f) {
super.drawButton(minecraft, x, y, f);
if (this.visible) {
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);
}
}
}
@Override
protected int getHoverState(boolean mouseOver) {
if (mouseOver || this.isTrials) {
return 2;
} else if (!this.active) {
return 0;
} else {
return 1;
}
}
}
///*
// * This file ("TrialsButton.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// *
// * © 2015-2017 Ellpeck
// */
//
//package de.ellpeck.actuallyadditions.mod.booklet.button;
//
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
//import de.ellpeck.actuallyadditions.mod.inventory.gui.TexturedButton;
//import de.ellpeck.actuallyadditions.mod.util.StringUtil;
//import net.minecraft.client.Minecraft;
//
//import net.minecraft.client.gui.widget.button.Button.IPressable;
//
//public class TrialsButton extends TexturedButton {
//
// private final boolean isTrials;
//
// public TrialsButton(GuiBooklet gui, IPressable action) {
// super(GuiBooklet.RES_LOC_GADGETS, gui.getGuiLeft() + gui.getSizeX(), gui.getGuiTop() + 10, 0, 204, 52, 16, action);
// this.isTrials = gui.areTrialsOpened();
// this.active = !this.isTrials;
// }
//
// @Override
// public void drawButton(Minecraft minecraft, int x, int y, float f) {
// super.drawButton(minecraft, x, y, f);
//
// if (this.visible) {
// 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);
// }
// }
// }
//
// @Override
// protected int getHoverState(boolean mouseOver) {
// if (mouseOver || this.isTrials) {
// return 2;
// } else if (!this.active) {
// return 0;
// } else {
// return 1;
// }
// }
//}

View file

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

View file

@ -1,46 +1,46 @@
/*
* This file ("BookletChapterCoffee.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.chapter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
import de.ellpeck.actuallyadditions.mod.booklet.page.BookletPage;
import de.ellpeck.actuallyadditions.mod.booklet.page.PageCoffeeMachine;
import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
import net.minecraft.item.ItemStack;
public class BookletChapterCoffee extends BookletChapter {
public BookletChapterCoffee(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages) {
super(identifier, entry, displayStack, getPages(pages));
}
private static IBookletPage[] getPages(IBookletPage... pages) {
List<IBookletPage> allPages = new ArrayList<>();
allPages.addAll(Arrays.asList(pages));
for (CoffeeIngredient ingredient : ActuallyAdditionsAPI.COFFEE_MACHINE_INGREDIENTS) {
BookletPage page = new PageCoffeeMachine(allPages.size() + 1, ingredient);
if (!(ingredient instanceof ItemCoffee.MilkIngredient)) {
page.setNoText();
}
allPages.add(page);
}
return allPages.toArray(new IBookletPage[allPages.size()]);
}
}
///*
// * This file ("BookletChapterCoffee.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// *
// * © 2015-2017 Ellpeck
// */
//
//package de.ellpeck.actuallyadditions.mod.booklet.chapter;
//
//import java.util.ArrayList;
//import java.util.Arrays;
//import java.util.List;
//
//import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
//import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
//import de.ellpeck.actuallyadditions.mod.booklet.page.BookletPage;
//import de.ellpeck.actuallyadditions.mod.booklet.page.PageCoffeeMachine;
//import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
//import net.minecraft.item.ItemStack;
//
//public class BookletChapterCoffee extends BookletChapter {
//
// public BookletChapterCoffee(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages) {
// super(identifier, entry, displayStack, getPages(pages));
// }
//
// private static IBookletPage[] getPages(IBookletPage... pages) {
// List<IBookletPage> allPages = new ArrayList<>();
// allPages.addAll(Arrays.asList(pages));
//
// for (CoffeeIngredient ingredient : ActuallyAdditionsAPI.COFFEE_MACHINE_INGREDIENTS) {
// BookletPage page = new PageCoffeeMachine(allPages.size() + 1, ingredient);
// if (!(ingredient instanceof ItemCoffee.MilkIngredient)) {
// page.setNoText();
// }
// allPages.add(page);
// }
//
// 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.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.chapter;
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
import de.ellpeck.actuallyadditions.mod.booklet.page.PageCrusherRecipe;
import de.ellpeck.actuallyadditions.mod.crafting.CrusherCrafting;
import de.ellpeck.actuallyadditions.mod.crafting.CrushingRecipe;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class BookletChapterCrusher extends BookletChapter {
public BookletChapterCrusher(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages) {
super(identifier, entry, displayStack, getPages(pages));
}
private static IBookletPage[] getPages(IBookletPage... pages) {
List<IBookletPage> allPages = new ArrayList<>();
allPages.addAll(Arrays.asList(pages));
for (CrushingRecipe recipe : CrusherCrafting.MISC_RECIPES) {
allPages.add(new PageCrusherRecipe(allPages.size() + 1, recipe).setNoText());
}
return allPages.toArray(new IBookletPage[allPages.size()]);
}
}
///*
// * This file ("BookletChapterCrusher.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// *
// * © 2015-2017 Ellpeck
// */
//
//package de.ellpeck.actuallyadditions.mod.booklet.chapter;
//
//import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
//import de.ellpeck.actuallyadditions.mod.booklet.page.PageCrusherRecipe;
//import de.ellpeck.actuallyadditions.mod.crafting.CrusherCrafting;
//import de.ellpeck.actuallyadditions.mod.crafting.CrushingRecipe;
//import net.minecraft.item.ItemStack;
//
//import java.util.ArrayList;
//import java.util.Arrays;
//import java.util.List;
//
//public class BookletChapterCrusher extends BookletChapter {
//
// public BookletChapterCrusher(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages) {
// super(identifier, entry, displayStack, getPages(pages));
// }
//
// private static IBookletPage[] getPages(IBookletPage... pages) {
// List<IBookletPage> allPages = new ArrayList<>();
// allPages.addAll(Arrays.asList(pages));
//
// for (CrushingRecipe recipe : CrusherCrafting.MISC_RECIPES) {
// allPages.add(new PageCrusherRecipe(allPages.size() + 1, recipe).setNoText());
// }
//
// 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.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.chapter;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.booklet.page.PageTrials;
import de.ellpeck.actuallyadditions.mod.data.PlayerData;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class BookletChapterTrials extends BookletChapter {
public BookletChapterTrials(String identifier, ItemStack displayStack, boolean secondPageText) {
super(identifier, ActuallyAdditionsAPI.entryTrials, displayStack, new PageTrials(1, false, true), new PageTrials(2, true, secondPageText));
}
@Override
@OnlyIn(Dist.CLIENT)
public String getLocalizedName() {
return StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".trials." + this.getIdentifier() + ".name");
}
@Override
@OnlyIn(Dist.CLIENT)
public String getLocalizedNameWithFormatting() {
PlayerEntity player = Minecraft.getInstance().player;
PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player);
boolean completed = data.completedTrials.contains(this.getIdentifier());
return (completed
? TextFormatting.DARK_GREEN
: TextFormatting.DARK_RED) + TextFormatting.ITALIC.toString() + this.getLocalizedName();
}
}
///*
// * This file ("BookletChapterTrials.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// *
// * © 2015-2017 Ellpeck
// */
//
//package de.ellpeck.actuallyadditions.mod.booklet.chapter;
//
//import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.booklet.page.PageTrials;
//import de.ellpeck.actuallyadditions.mod.data.PlayerData;
//import de.ellpeck.actuallyadditions.mod.util.StringUtil;
//import net.minecraft.client.Minecraft;
//import net.minecraft.entity.player.PlayerEntity;
//import net.minecraft.item.ItemStack;
//import net.minecraft.util.text.TextFormatting;
//import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn;
//
//public class BookletChapterTrials extends BookletChapter {
//
// public BookletChapterTrials(String identifier, ItemStack displayStack, boolean secondPageText) {
// super(identifier, ActuallyAdditionsAPI.entryTrials, displayStack, new PageTrials(1, false, true), new PageTrials(2, true, secondPageText));
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
// public String getLocalizedName() {
// return StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".trials." + this.getIdentifier() + ".name");
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
// public String getLocalizedNameWithFormatting() {
// PlayerEntity player = Minecraft.getInstance().player;
// PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player);
// boolean completed = data.completedTrials.contains(this.getIdentifier());
//
// return (completed
// ? TextFormatting.DARK_GREEN
// : 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.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.entry;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fluids.FluidStack;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
public class BookletEntry implements IBookletEntry {
private final String identifier;
private final int priority;
private final List<IBookletChapter> chapters = new ArrayList<>();
private TextFormatting color;
public BookletEntry(String identifier) {
this(identifier, 0);
}
public BookletEntry(String identifier, int prio) {
this.identifier = identifier;
this.priority = prio;
ActuallyAdditionsAPI.addBookletEntry(this);
this.color = TextFormatting.RESET;
}
@OnlyIn(Dist.CLIENT)
private static boolean fitsFilter(IBookletPage page, String searchBarText) {
Minecraft mc = Minecraft.getInstance();
List<ItemStack> items = new ArrayList<>();
page.getItemStacksForPage(items);
if (!items.isEmpty()) {
for (ItemStack stack : items) {
if (StackUtil.isValid(stack)) {
List<String> tooltip = stack.getTooltipLines(mc.player, mc.options.advancedItemTooltips
? ITooltipFlag.TooltipFlags.ADVANCED
: ITooltipFlag.TooltipFlags.NORMAL);
for (String strg : tooltip) {
if (strg != null && strg.toLowerCase(Locale.ROOT).contains(searchBarText)) {
return true;
}
}
}
}
}
List<FluidStack> fluids = new ArrayList<>();
page.getFluidStacksForPage(fluids);
if (!fluids.isEmpty()) {
for (FluidStack stack : fluids) {
if (stack != null) {
String strg = stack.getLocalizedName();
if (strg != null && strg.toLowerCase(Locale.ROOT).contains(searchBarText)) {
return true;
}
}
}
}
return false;
}
@Override
public List<IBookletChapter> getAllChapters() {
return this.chapters;
}
@Override
public String getIdentifier() {
return this.identifier;
}
@Override
@OnlyIn(Dist.CLIENT)
public String getLocalizedName() {
return StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".indexEntry." + this.getIdentifier() + ".name");
}
@Override
@OnlyIn(Dist.CLIENT)
public String getLocalizedNameWithFormatting() {
return this.color + this.getLocalizedName();
}
@Override
public void addChapter(IBookletChapter chapter) {
this.chapters.add(chapter);
}
@Override
@OnlyIn(Dist.CLIENT)
public List<IBookletChapter> getChaptersForDisplay(String searchBarText) {
if (searchBarText != null && !searchBarText.isEmpty()) {
String search = searchBarText.toLowerCase(Locale.ROOT);
List<IBookletChapter> fittingChapters = new ArrayList<>();
for (IBookletChapter chapter : this.getAllChapters()) {
if (chapter.getLocalizedName().toLowerCase(Locale.ROOT).contains(search)) {
fittingChapters.add(chapter);
} else {
for (IBookletPage page : chapter.getAllPages()) {
if (fitsFilter(page, search)) {
fittingChapters.add(chapter);
break;
}
}
}
}
return fittingChapters;
} else {
return this.getAllChapters();
}
}
@Override
public int getSortingPriority() {
return this.priority;
}
@Override
@OnlyIn(Dist.CLIENT)
public boolean visibleOnFrontPage() {
return true;
}
public BookletEntry setImportant() {
this.color = TextFormatting.DARK_GREEN;
return this;
}
public BookletEntry setSpecial() {
this.color = TextFormatting.DARK_PURPLE;
return this;
}
}
///*
// * This file ("BookletEntry.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// *
// * © 2015-2017 Ellpeck
// */
//
//package de.ellpeck.actuallyadditions.mod.booklet.entry;
//
//import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.util.StackUtil;
//import de.ellpeck.actuallyadditions.mod.util.StringUtil;
//import net.minecraft.client.Minecraft;
//import net.minecraft.client.util.ITooltipFlag;
//import net.minecraft.item.ItemStack;
//import net.minecraft.util.text.TextFormatting;
//import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn;
//import net.minecraftforge.fluids.FluidStack;
//
//import java.util.ArrayList;
//import java.util.List;
//import java.util.Locale;
//
//public class BookletEntry implements IBookletEntry {
//
// private final String identifier;
// private final int priority;
// private final List<IBookletChapter> chapters = new ArrayList<>();
// private TextFormatting color;
//
// public BookletEntry(String identifier) {
// this(identifier, 0);
// }
//
// public BookletEntry(String identifier, int prio) {
// this.identifier = identifier;
// this.priority = prio;
// ActuallyAdditionsAPI.addBookletEntry(this);
//
// this.color = TextFormatting.RESET;
// }
//
// @OnlyIn(Dist.CLIENT)
// private static boolean fitsFilter(IBookletPage page, String searchBarText) {
// Minecraft mc = Minecraft.getInstance();
//
// List<ItemStack> items = new ArrayList<>();
// page.getItemStacksForPage(items);
// if (!items.isEmpty()) {
// for (ItemStack stack : items) {
// if (StackUtil.isValid(stack)) {
// List<String> tooltip = stack.getTooltipLines(mc.player, mc.options.advancedItemTooltips
// ? ITooltipFlag.TooltipFlags.ADVANCED
// : ITooltipFlag.TooltipFlags.NORMAL);
// for (String strg : tooltip) {
// if (strg != null && strg.toLowerCase(Locale.ROOT).contains(searchBarText)) {
// return true;
// }
// }
// }
// }
// }
//
// List<FluidStack> fluids = new ArrayList<>();
// page.getFluidStacksForPage(fluids);
// if (!fluids.isEmpty()) {
// for (FluidStack stack : fluids) {
// if (stack != null) {
// String strg = stack.getLocalizedName();
// if (strg != null && strg.toLowerCase(Locale.ROOT).contains(searchBarText)) {
// return true;
// }
// }
// }
// }
//
// return false;
// }
//
// @Override
// public List<IBookletChapter> getAllChapters() {
// return this.chapters;
// }
//
// @Override
// public String getIdentifier() {
// return this.identifier;
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
// public String getLocalizedName() {
// return StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".indexEntry." + this.getIdentifier() + ".name");
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
// public String getLocalizedNameWithFormatting() {
// return this.color + this.getLocalizedName();
// }
//
// @Override
// public void addChapter(IBookletChapter chapter) {
// this.chapters.add(chapter);
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
// public List<IBookletChapter> getChaptersForDisplay(String searchBarText) {
// if (searchBarText != null && !searchBarText.isEmpty()) {
// String search = searchBarText.toLowerCase(Locale.ROOT);
//
// List<IBookletChapter> fittingChapters = new ArrayList<>();
// for (IBookletChapter chapter : this.getAllChapters()) {
// if (chapter.getLocalizedName().toLowerCase(Locale.ROOT).contains(search)) {
// fittingChapters.add(chapter);
// } else {
// for (IBookletPage page : chapter.getAllPages()) {
// if (fitsFilter(page, search)) {
// fittingChapters.add(chapter);
// break;
// }
// }
// }
// }
//
// return fittingChapters;
// } else {
// return this.getAllChapters();
// }
// }
//
// @Override
// public int getSortingPriority() {
// return this.priority;
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
// public boolean visibleOnFrontPage() {
// return true;
// }
//
// public BookletEntry setImportant() {
// this.color = TextFormatting.DARK_GREEN;
// return this;
// }
//
// public BookletEntry setSpecial() {
// this.color = TextFormatting.DARK_PURPLE;
// return this;
// }
//
//}

View file

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

View file

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

View file

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

View file

@ -1,170 +1,170 @@
/*
* This file ("GuiEntry.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.gui;
import com.mojang.blaze3d.matrix.MatrixStack;
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import de.ellpeck.actuallyadditions.mod.booklet.button.EntryButton;
import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryTrials;
import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import java.io.IOException;
import java.util.List;
@OnlyIn(Dist.CLIENT)
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.
private final int entryPage;
private final int pageAmount;
private final IBookletEntry entry;
private final List<IBookletChapter> chapters;
private final String searchText;
private final boolean focusSearch;
public GuiEntry(Screen previousScreen, GuiBookletBase parentPage, IBookletEntry entry, int entryPage, String search, boolean focusSearch) {
super(previousScreen, parentPage);
this.entryPage = entryPage;
this.entry = entry;
this.searchText = search;
this.focusSearch = focusSearch;
this.chapters = entry.getChaptersForDisplay(search);
if (!this.chapters.isEmpty()) {
IBookletChapter lastChap = this.chapters.get(this.chapters.size() - 1);
this.pageAmount = lastChap == null
? 1
: calcEntryPage(this.entry, lastChap, this.searchText) + 1;
} else {
this.pageAmount = 1;
}
}
public GuiEntry(Screen previousScreen, GuiBookletBase parentPage, IBookletEntry entry, IBookletChapter chapterForPageCalc, String search, boolean focusSearch) {
this(previousScreen, parentPage, entry, calcEntryPage(entry, chapterForPageCalc, search), search, focusSearch);
}
private static int calcEntryPage(IBookletEntry entry, IBookletChapter chapterForPageCalc, String search) {
int index = entry.getChaptersForDisplay(search).indexOf(chapterForPageCalc);
return index / (BUTTONS_PER_PAGE * 2);
}
@Override
public void drawScreenPre(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) {
super.drawScreenPre(matrices, mouseX, mouseY, partialTicks);
String name = this.entry.getLocalizedName();
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++) {
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());
}
}
@Override
public void init() {
super.init();
if (this.hasSearchBar() && this.searchText != null) {
this.searchField.setValue(this.searchText);
if (this.focusSearch) {
this.searchField.setFocus(true);
}
}
int idOffset = this.entryPage * BUTTONS_PER_PAGE * 2;
for (int x = 0; x < 2; x++) {
for (int y = 0; y < BUTTONS_PER_PAGE; y++) {
int id = y + x * BUTTONS_PER_PAGE;
if (this.chapters.size() > 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()));
} else {
return;
}
}
}
}
/*
@Override
protected void actionPerformed(Button button) throws IOException {
if (button instanceof EntryButton) {
int actualId = button.id + this.entryPage * BUTTONS_PER_PAGE * 2;
if (this.chapters.size() > actualId) {
IBookletChapter chapter = this.chapters.get(actualId);
if (chapter != null) {
IBookletPage[] pages = chapter.getAllPages();
if (pages != null && pages.length > 0) {
this.minecraft.setScreen(BookletUtils.createPageGui(this.previousScreen, this, pages[0]));
}
}
}
} else {
super.actionPerformed(button);
}
}
*/
@Override
public void addOrModifyItemRenderer(ItemStack renderedStack, int x, int y, float scale, boolean shouldTryTransfer) {
}
@Override
public boolean hasPageLeftButton() {
return this.entryPage > 0;
}
@Override
public void onPageLeftButtonPressed() {
this.minecraft.setScreen(new GuiEntry(this.previousScreen, this.parentPage, this.entry, this.entryPage - 1, this.searchText, this.searchField.isFocused()));
}
@Override
public boolean hasPageRightButton() {
return !this.chapters.isEmpty() && this.entryPage < this.pageAmount - 1;
}
@Override
public void onPageRightButtonPressed() {
this.minecraft.setScreen(new GuiEntry(this.previousScreen, this.parentPage, this.entry, this.entryPage + 1, this.searchText, this.searchField.isFocused()));
}
@Override
public boolean hasBackButton() {
return true;
}
@Override
public void onBackButtonPressed() {
if (!hasShiftDown()) {
this.minecraft.setScreen(this.parentPage);
} else {
super.onBackButtonPressed();
}
}
@Override
public boolean areTrialsOpened() {
return this.entry instanceof BookletEntryTrials;
}
}
///*
// * This file ("GuiEntry.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// *
// * © 2015-2017 Ellpeck
// */
//
//package de.ellpeck.actuallyadditions.mod.booklet.gui;
//
//import com.mojang.blaze3d.matrix.MatrixStack;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
//import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
//import de.ellpeck.actuallyadditions.mod.booklet.button.EntryButton;
//import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryTrials;
//import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
//import net.minecraft.client.gui.screen.Screen;
//import net.minecraft.client.gui.widget.button.Button;
//import net.minecraft.item.ItemStack;
//import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn;
//
//import java.io.IOException;
//import java.util.List;
//
//@OnlyIn(Dist.CLIENT)
//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.
// private final int entryPage;
// private final int pageAmount;
// private final IBookletEntry entry;
// private final List<IBookletChapter> chapters;
// private final String searchText;
// private final boolean focusSearch;
//
// public GuiEntry(Screen previousScreen, GuiBookletBase parentPage, IBookletEntry entry, int entryPage, String search, boolean focusSearch) {
// super(previousScreen, parentPage);
// this.entryPage = entryPage;
// this.entry = entry;
// this.searchText = search;
// this.focusSearch = focusSearch;
// this.chapters = entry.getChaptersForDisplay(search);
//
// if (!this.chapters.isEmpty()) {
// IBookletChapter lastChap = this.chapters.get(this.chapters.size() - 1);
// this.pageAmount = lastChap == null
// ? 1
// : calcEntryPage(this.entry, lastChap, this.searchText) + 1;
// } else {
// this.pageAmount = 1;
// }
// }
//
// public GuiEntry(Screen previousScreen, GuiBookletBase parentPage, IBookletEntry entry, IBookletChapter chapterForPageCalc, String search, boolean focusSearch) {
// this(previousScreen, parentPage, entry, calcEntryPage(entry, chapterForPageCalc, search), search, focusSearch);
// }
//
// private static int calcEntryPage(IBookletEntry entry, IBookletChapter chapterForPageCalc, String search) {
// int index = entry.getChaptersForDisplay(search).indexOf(chapterForPageCalc);
// return index / (BUTTONS_PER_PAGE * 2);
// }
//
// @Override
// public void drawScreenPre(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) {
// super.drawScreenPre(matrices, mouseX, mouseY, partialTicks);
//
// String name = this.entry.getLocalizedName();
// 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++) {
// 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());
// }
// }
//
// @Override
// public void init() {
// super.init();
//
// if (this.hasSearchBar() && this.searchText != null) {
// this.searchField.setValue(this.searchText);
// if (this.focusSearch) {
// this.searchField.setFocus(true);
// }
// }
//
// int idOffset = this.entryPage * BUTTONS_PER_PAGE * 2;
// for (int x = 0; x < 2; x++) {
// for (int y = 0; y < BUTTONS_PER_PAGE; y++) {
// int id = y + x * BUTTONS_PER_PAGE;
// if (this.chapters.size() > 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()));
// } else {
// return;
// }
// }
// }
// }
///*
// @Override
// protected void actionPerformed(Button button) throws IOException {
// if (button instanceof EntryButton) {
// int actualId = button.id + this.entryPage * BUTTONS_PER_PAGE * 2;
//
// if (this.chapters.size() > actualId) {
// IBookletChapter chapter = this.chapters.get(actualId);
// if (chapter != null) {
// IBookletPage[] pages = chapter.getAllPages();
// if (pages != null && pages.length > 0) {
// this.minecraft.setScreen(BookletUtils.createPageGui(this.previousScreen, this, pages[0]));
// }
// }
// }
// } else {
// super.actionPerformed(button);
// }
// }
//
// */
//
// @Override
// public void addOrModifyItemRenderer(ItemStack renderedStack, int x, int y, float scale, boolean shouldTryTransfer) {
//
// }
//
// @Override
// public boolean hasPageLeftButton() {
// return this.entryPage > 0;
// }
//
// @Override
// public void onPageLeftButtonPressed() {
// this.minecraft.setScreen(new GuiEntry(this.previousScreen, this.parentPage, this.entry, this.entryPage - 1, this.searchText, this.searchField.isFocused()));
// }
//
// @Override
// public boolean hasPageRightButton() {
// return !this.chapters.isEmpty() && this.entryPage < this.pageAmount - 1;
// }
//
// @Override
// public void onPageRightButtonPressed() {
// this.minecraft.setScreen(new GuiEntry(this.previousScreen, this.parentPage, this.entry, this.entryPage + 1, this.searchText, this.searchField.isFocused()));
// }
//
// @Override
// public boolean hasBackButton() {
// return true;
// }
//
// @Override
// public void onBackButtonPressed() {
// if (!hasShiftDown()) {
// this.minecraft.setScreen(this.parentPage);
// } else {
// super.onBackButtonPressed();
// }
// }
//
// @Override
// public boolean areTrialsOpened() {
// return this.entry instanceof BookletEntryTrials;
// }
//}

View file

@ -1,240 +1,240 @@
/*
* This file ("GuiMainPage.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.gui;
import com.mojang.blaze3d.matrix.MatrixStack;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.booklet.InitBooklet;
import de.ellpeck.actuallyadditions.mod.booklet.button.EntryButton;
import de.ellpeck.actuallyadditions.mod.data.PlayerData;
import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave;
import de.ellpeck.actuallyadditions.mod.inventory.gui.TexturedButton;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
//TODO Fix achievement button
@OnlyIn(Dist.CLIENT)
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 TexturedButton achievementButton;
private TexturedButton configButton;
private Button tutorialButton;
private boolean showTutorial;
private String bookletName;
private String bookletEdition;
private List<String> quote;
private String quoteGuy;
public GuiMainPage(Screen previousScreen) {
super(previousScreen, null);
}
private static List<IBookletEntry> getDisplayedEntries() {
List<IBookletEntry> displayed = new ArrayList<>();
for (IBookletEntry entry : ActuallyAdditionsAPI.BOOKLET_ENTRIES) {
if (entry.visibleOnFrontPage()) {
displayed.add(entry);
}
}
return displayed;
}
@Override
public void init() {
super.init();
int flavor = 1;
if (this.getMinecraft().level.random.nextFloat() <= 0.1) {
flavor = MathHelper.nextInt(this.getMinecraft().level.random, 2, 7);
}
this.bookletName = "info." + ActuallyAdditions.MODID + ".booklet.manualName.1." + flavor;
String usedQuote = QUOTES[this.getMinecraft().level.random.nextInt(QUOTES.length)];
String[] quoteSplit = usedQuote.split("@");
if (quoteSplit.length == 2) {
//this.quote = this.font.listFormattedStringToWidth(quoteSplit[0], 120); //TODO wut
this.quoteGuy = quoteSplit[1];
}
String playerName = this.getMinecraft().player.getName().getString();
if (playerName.equalsIgnoreCase("dqmhose")) {
this.bookletEdition = "Pants Edition";
} else if (playerName.equalsIgnoreCase("TwoOfEight") || playerName.equalsIgnoreCase("BootyToast")) {
this.bookletEdition = "Illustrator's Edition";
} else if (playerName.equalsIgnoreCase("KittyVanCat")) {
this.bookletEdition = "Cat's Edition";
} else if (playerName.equalsIgnoreCase("canitzp")) {
this.bookletEdition = "P's Edition";
} else if (playerName.equalsIgnoreCase("direwolf20")) {
this.bookletEdition = "Edition 20";
} else if (playerName.equalsIgnoreCase("dannydjdk") || playerName.equalsIgnoreCase("andrew_period")) {
this.bookletEdition = "Derp's Edition";
} else if (playerName.equalsIgnoreCase("mezz")) {
this.bookletEdition = "Just Enough Editions";
} else if (playerName.equalsIgnoreCase("amadornes")) {
this.bookletEdition = "Beard's Edition";
} else if (playerName.equalsIgnoreCase("raoul")) {
this.bookletEdition = "Giraffe's Edition";
} else if (playerName.equalsIgnoreCase("ellpeck") || playerName.equalsIgnoreCase("profprospector")) {
String[] colors = new String[15];
for (int i = 0; i < colors.length; i++) {
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);
} else if (playerName.equalsIgnoreCase("oitsjustjose")) {
this.bookletEdition = "oitsjustanedition";
} else if (playerName.equalsIgnoreCase("xbony2")) {
this.bookletEdition = "Naughty Edition";
} else if (playerName.equalsIgnoreCase("themattabase")) {
this.bookletEdition = "Withered Edition";
} else if (playerName.equalsIgnoreCase("robsonld04")) {
this.bookletEdition = "Modpack Edition";
} else if (playerName.equalsIgnoreCase("snowshock35")) {
this.bookletEdition = "Edition 35";
} else if (playerName.equalsIgnoreCase("asiekierka")) {
this.bookletEdition = "‽ Edition";
} else if (playerName.equalsIgnoreCase("elucent")) {
this.bookletEdition = "";
} else {
if (Util.isDevVersion()) {
this.bookletEdition = "Dev's Edition";
} else {
this.bookletEdition = StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.edition") + " " + Util.getMajorModVersion();
}
}
List<String> configText = new ArrayList<>();
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
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);
List<String> achievementText = new ArrayList<>();
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
//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);
PlayerSave data = PlayerData.getDataFromPlayer(this.getMinecraft().player);
if (!data.didBookTutorial) {
this.showTutorial = true;
//this.tutorialButton = new GuiButton(666666, this.guiLeft + 140 / 2 - 50, this.guiTop + 146, 100, 20, "Please click me <3");
this.addButton(this.tutorialButton);
this.configButton.visible = false;
//this.achievementButton.visible = false;
}
for (int i = 0; i < BUTTONS_PER_PAGE; i++) {
List<IBookletEntry> displayed = getDisplayedEntries();
if (displayed.size() > 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));
} else {
return;
}
}
}
/*
@Override
protected void actionPerformed(GuiButton button) throws IOException {
if (button instanceof EntryButton) {
List<IBookletEntry> displayed = getDisplayedEntries();
if (displayed.size() > button.id) {
IBookletEntry entry = displayed.get(button.id);
if (entry != null) {
this.getMinecraft().setScreen(new GuiEntry(this.previousScreen, this, entry, 0, "", false));
}
}
}
/*else if(button == this.achievementButton){
GuiScreen achievements = new GuiAAAchievements(this, this.getMinecraft().player.getStatFileWriter());
this.getMinecraft().displayGuiScreen(achievements);
}*/
/*
else if (button == this.configButton) {
GuiScreen config = new GuiConfiguration(this);
this.getMinecraft().setScreen(config);
} else if (this.showTutorial && button == this.tutorialButton) {
if (this.hasBookmarkButtons()) {
if (!isShiftKeyDown()) {
for (int i = 0; i < InitBooklet.chaptersIntroduction.length; i++) {
this.bookmarkButtons[i].assignedPage = InitBooklet.chaptersIntroduction[i].getAllPages()[0];
}
}
this.showTutorial = false;
this.tutorialButton.visible = false;
this.configButton.visible = true;
//this.achievementButton.visible = true;
PlayerSave data = PlayerData.getDataFromPlayer(this.getMinecraft().player);
data.didBookTutorial = true;
PacketHandlerHelper.sendPlayerDataToServer(false, 1);
}
} else {
super.actionPerformed(button);
}
}
*/
@Override
public void drawScreenPre(MatrixStack stack, int mouseX, int mouseY, float partialTicks) {
super.drawScreenPre(stack, mouseX, mouseY, partialTicks);
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);
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);
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);
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.";
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) {
int quoteSize = this.quote.size();
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("- " + this.quoteGuy, this.guiLeft + 60, this.guiTop + 93 + quoteSize * 8, 0, false, this.getLargeFontSize());
}
}
@Override
public void addOrModifyItemRenderer(ItemStack renderedStack, int x, int y, float scale, boolean shouldTryTransfer) {
}
}
///*
// * This file ("GuiMainPage.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// *
// * © 2015-2017 Ellpeck
// */
//
//package de.ellpeck.actuallyadditions.mod.booklet.gui;
//
//import com.mojang.blaze3d.matrix.MatrixStack;
//import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.booklet.InitBooklet;
//import de.ellpeck.actuallyadditions.mod.booklet.button.EntryButton;
//import de.ellpeck.actuallyadditions.mod.data.PlayerData;
//import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave;
//import de.ellpeck.actuallyadditions.mod.inventory.gui.TexturedButton;
//import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
//import de.ellpeck.actuallyadditions.mod.util.StringUtil;
//import de.ellpeck.actuallyadditions.mod.util.Util;
//import net.minecraft.client.gui.screen.Screen;
//import net.minecraft.client.gui.widget.button.Button;
//import net.minecraft.item.ItemStack;
//import net.minecraft.util.math.MathHelper;
//import net.minecraft.util.text.TextFormatting;
//import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn;
//
//import java.io.IOException;
//import java.util.ArrayList;
//import java.util.List;
//
////TODO Fix achievement button
//@OnlyIn(Dist.CLIENT)
//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 TexturedButton achievementButton;
// private TexturedButton configButton;
//
// private Button tutorialButton;
// private boolean showTutorial;
//
// private String bookletName;
// private String bookletEdition;
//
// private List<String> quote;
// private String quoteGuy;
//
// public GuiMainPage(Screen previousScreen) {
// super(previousScreen, null);
// }
//
// private static List<IBookletEntry> getDisplayedEntries() {
// List<IBookletEntry> displayed = new ArrayList<>();
//
// for (IBookletEntry entry : ActuallyAdditionsAPI.BOOKLET_ENTRIES) {
// if (entry.visibleOnFrontPage()) {
// displayed.add(entry);
// }
// }
//
// return displayed;
// }
//
// @Override
// public void init() {
// super.init();
//
// int flavor = 1;
// if (this.getMinecraft().level.random.nextFloat() <= 0.1) {
// flavor = MathHelper.nextInt(this.getMinecraft().level.random, 2, 7);
// }
// this.bookletName = "info." + ActuallyAdditions.MODID + ".booklet.manualName.1." + flavor;
//
// String usedQuote = QUOTES[this.getMinecraft().level.random.nextInt(QUOTES.length)];
// String[] quoteSplit = usedQuote.split("@");
// if (quoteSplit.length == 2) {
// //this.quote = this.font.listFormattedStringToWidth(quoteSplit[0], 120); //TODO wut
// this.quoteGuy = quoteSplit[1];
// }
//
// String playerName = this.getMinecraft().player.getName().getString();
// if (playerName.equalsIgnoreCase("dqmhose")) {
// this.bookletEdition = "Pants Edition";
// } else if (playerName.equalsIgnoreCase("TwoOfEight") || playerName.equalsIgnoreCase("BootyToast")) {
// this.bookletEdition = "Illustrator's Edition";
// } else if (playerName.equalsIgnoreCase("KittyVanCat")) {
// this.bookletEdition = "Cat's Edition";
// } else if (playerName.equalsIgnoreCase("canitzp")) {
// this.bookletEdition = "P's Edition";
// } else if (playerName.equalsIgnoreCase("direwolf20")) {
// this.bookletEdition = "Edition 20";
// } else if (playerName.equalsIgnoreCase("dannydjdk") || playerName.equalsIgnoreCase("andrew_period")) {
// this.bookletEdition = "Derp's Edition";
// } else if (playerName.equalsIgnoreCase("mezz")) {
// this.bookletEdition = "Just Enough Editions";
// } else if (playerName.equalsIgnoreCase("amadornes")) {
// this.bookletEdition = "Beard's Edition";
// } else if (playerName.equalsIgnoreCase("raoul")) {
// this.bookletEdition = "Giraffe's Edition";
// } else if (playerName.equalsIgnoreCase("ellpeck") || playerName.equalsIgnoreCase("profprospector")) {
// String[] colors = new String[15];
// for (int i = 0; i < colors.length; i++) {
// 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);
// } else if (playerName.equalsIgnoreCase("oitsjustjose")) {
// this.bookletEdition = "oitsjustanedition";
// } else if (playerName.equalsIgnoreCase("xbony2")) {
// this.bookletEdition = "Naughty Edition";
// } else if (playerName.equalsIgnoreCase("themattabase")) {
// this.bookletEdition = "Withered Edition";
// } else if (playerName.equalsIgnoreCase("robsonld04")) {
// this.bookletEdition = "Modpack Edition";
// } else if (playerName.equalsIgnoreCase("snowshock35")) {
// this.bookletEdition = "Edition 35";
// } else if (playerName.equalsIgnoreCase("asiekierka")) {
// this.bookletEdition = "‽ Edition";
// } else if (playerName.equalsIgnoreCase("elucent")) {
// this.bookletEdition = "";
// } else {
// if (Util.isDevVersion()) {
// this.bookletEdition = "Dev's Edition";
// } else {
// this.bookletEdition = StringUtil.localize("info." + ActuallyAdditions.MODID + ".booklet.edition") + " " + Util.getMajorModVersion();
// }
// }
//
// List<String> configText = new ArrayList<>();
// 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
// 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);
//
// List<String> achievementText = new ArrayList<>();
// 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
// //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);
//
// PlayerSave data = PlayerData.getDataFromPlayer(this.getMinecraft().player);
// if (!data.didBookTutorial) {
// this.showTutorial = true;
//
// //this.tutorialButton = new GuiButton(666666, this.guiLeft + 140 / 2 - 50, this.guiTop + 146, 100, 20, "Please click me <3");
// this.addButton(this.tutorialButton);
//
// this.configButton.visible = false;
// //this.achievementButton.visible = false;
// }
//
// for (int i = 0; i < BUTTONS_PER_PAGE; i++) {
// List<IBookletEntry> displayed = getDisplayedEntries();
// if (displayed.size() > 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));
// } else {
// return;
// }
// }
// }
///*
// @Override
// protected void actionPerformed(GuiButton button) throws IOException {
// if (button instanceof EntryButton) {
// List<IBookletEntry> displayed = getDisplayedEntries();
// if (displayed.size() > button.id) {
// IBookletEntry entry = displayed.get(button.id);
// if (entry != null) {
// this.getMinecraft().setScreen(new GuiEntry(this.previousScreen, this, entry, 0, "", false));
// }
// }
// }
// /*else if(button == this.achievementButton){
// GuiScreen achievements = new GuiAAAchievements(this, this.getMinecraft().player.getStatFileWriter());
// this.getMinecraft().displayGuiScreen(achievements);
// }*/
// /*
// else if (button == this.configButton) {
// GuiScreen config = new GuiConfiguration(this);
// this.getMinecraft().setScreen(config);
// } else if (this.showTutorial && button == this.tutorialButton) {
// if (this.hasBookmarkButtons()) {
// if (!isShiftKeyDown()) {
// for (int i = 0; i < InitBooklet.chaptersIntroduction.length; i++) {
// this.bookmarkButtons[i].assignedPage = InitBooklet.chaptersIntroduction[i].getAllPages()[0];
// }
// }
// this.showTutorial = false;
// this.tutorialButton.visible = false;
//
// this.configButton.visible = true;
// //this.achievementButton.visible = true;
//
// PlayerSave data = PlayerData.getDataFromPlayer(this.getMinecraft().player);
// data.didBookTutorial = true;
// PacketHandlerHelper.sendPlayerDataToServer(false, 1);
// }
// } else {
// super.actionPerformed(button);
// }
// }
// */
// @Override
// public void drawScreenPre(MatrixStack stack, int mouseX, int mouseY, float partialTicks) {
// super.drawScreenPre(stack, mouseX, mouseY, partialTicks);
//
// 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);
// 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);
//
// 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);
//
// 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.";
// 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) {
// int quoteSize = this.quote.size();
//
// 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("- " + this.quoteGuy, this.guiLeft + 60, this.guiTop + 93 + quoteSize * 8, 0, false, this.getLargeFontSize());
// }
// }
//
// @Override
// 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.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.gui;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
import de.ellpeck.actuallyadditions.mod.booklet.page.ItemDisplay;
import de.ellpeck.actuallyadditions.mod.inventory.gui.TexturedButton;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import java.awt.*;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@OnlyIn(Dist.CLIENT)
public class GuiPage extends GuiBooklet {
public final IBookletPage[] pages = new IBookletPage[2];
private final List<ItemDisplay> itemDisplays = new ArrayList<>();
private int pageTimer;
private Button buttonViewOnline;
public GuiPage(Screen previousScreen, GuiBookletBase parentPage, IBookletPage page1, IBookletPage page2) {
super(previousScreen, parentPage);
this.pages[0] = page1;
this.pages[1] = page2;
}
@Override
public void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
super.mouseClicked(mouseX, mouseY, mouseButton);
for (ItemDisplay display : this.itemDisplays) {
display.onMousePress(mouseButton, mouseX, mouseY);
}
for (IBookletPage page : this.pages) {
if (page != null) {
page.mouseClicked(this, mouseX, mouseY, mouseButton);
}
}
}
@Override
public void mouseReleased(int mouseX, int mouseY, int state) {
super.mouseReleased(mouseX, mouseY, state);
for (IBookletPage page : this.pages) {
if (page != null) {
page.mouseReleased(this, mouseX, mouseY, state);
}
}
}
@Override
public void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
super.mouseClickMove(mouseX, mouseY, clickedMouseButton, timeSinceLastClick);
for (IBookletPage page : this.pages) {
if (page != null) {
page.mouseClickMove(this, mouseX, mouseY, clickedMouseButton, timeSinceLastClick);
}
}
}
/*
@Override
public void actionPerformed(GuiButton button) throws IOException {
if (button == this.buttonViewOnline) {
List<String> links = this.getWebLinks();
if (Desktop.isDesktopSupported()) {
for (String link : links) {
try {
Desktop.getDesktop().browse(new URI(link));
} catch (Exception e) {
ActuallyAdditions.LOGGER.error("Couldn't open website from Booklet page!", e);
}
}
}
} else {
super.actionPerformed(button);
for (IBookletPage page : this.pages) {
if (page != null) {
page.actionPerformed(this, button);
}
}
}
}
*/
@Override
public void init() {
this.itemDisplays.clear();
super.init();
List<String> links = this.getWebLinks();
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.addButton(this.buttonViewOnline);
}
for (int i = 0; i < this.pages.length; i++) {
IBookletPage page = this.pages[i];
if (page != null) {
page.init(this, this.guiLeft + 6 + i * 142, this.guiTop + 7);
}
}
}
private List<String> getWebLinks() {
List<String> links = new ArrayList<>();
for (IBookletPage page : this.pages) {
if (page != null) {
String link = page.getWebLink();
if (link != null && !links.contains(link)) {
links.add(link);
}
}
}
return links;
}
@Override
public void tick() {
super.tick();
for (int i = 0; i < this.pages.length; i++) {
IBookletPage page = this.pages[i];
if (page != null) {
page.updateScreen(this, this.guiLeft + 6 + i * 142, this.guiTop + 7, this.pageTimer);
}
}
this.pageTimer++;
}
@Override
public void drawScreenPre(MatrixStack stack, int mouseX, int mouseY, float partialTicks) {
super.drawScreenPre(stack, mouseX, mouseY, partialTicks);
if (this.pages[0] != null) {
IBookletChapter chapter = this.pages[0].getChapter();
String name = chapter.getLocalizedName();
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++) {
IBookletPage page = this.pages[i];
if (page != null) {
IBookletChapter chapter = this.pages[i].getChapter();
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());
RenderSystem.color3f(1f, 1f, 1f);
page.drawScreenPre(this, this.guiLeft + 6 + i * 142, this.guiTop + 7, mouseX, mouseY, partialTicks);
}
}
for (ItemDisplay display : this.itemDisplays) {
display.drawPre();
}
}
@Override
public void drawScreenPost(MatrixStack stack, int mouseX, int mouseY, float partialTicks) {
super.drawScreenPost(stack, mouseX, mouseY, partialTicks);
for (int i = 0; i < this.pages.length; i++) {
IBookletPage page = this.pages[i];
if (page != null) {
RenderSystem.color3f(1F, 1F, 1F);
page.drawScreenPost(this, this.guiLeft + 6 + i * 142, this.guiTop + 7, mouseX, mouseY, partialTicks);
}
}
for (ItemDisplay display : this.itemDisplays) {
display.drawPost(mouseX, mouseY);
}
}
@Override
public void addOrModifyItemRenderer(ItemStack renderedStack, int x, int y, float scale, boolean shouldTryTransfer) {
for (ItemDisplay display : this.itemDisplays) {
if (display.x == x && display.y == y && display.scale == scale) {
display.stack = renderedStack;
return;
}
}
this.itemDisplays.add(new ItemDisplay(this, x, y, scale, renderedStack, shouldTryTransfer));
}
@Override
public boolean hasPageLeftButton() {
IBookletPage page = this.pages[0];
if (page != null) {
IBookletChapter chapter = page.getChapter();
if (chapter != null) {
return chapter.getPageIndex(page) > 0;
}
}
return false;
}
@Override
public void onPageLeftButtonPressed() {
IBookletPage page = this.pages[0];
if (page != null) {
IBookletChapter chapter = page.getChapter();
if (chapter != null) {
IBookletPage[] pages = chapter.getAllPages();
int pageNumToOpen = chapter.getPageIndex(page) - 1;
if (pageNumToOpen >= 0 && pageNumToOpen < pages.length) {
this.minecraft.setScreen(BookletUtils.createPageGui(this.previousScreen, this.parentPage, pages[pageNumToOpen]));
}
}
}
}
@Override
public boolean hasPageRightButton() {
IBookletPage page = this.pages[1];
if (page != null) {
IBookletChapter chapter = page.getChapter();
if (chapter != null) {
int pageIndex = chapter.getPageIndex(page);
int pageAmount = chapter.getAllPages().length;
return pageIndex + 1 < pageAmount;
}
}
return false;
}
@Override
public void onPageRightButtonPressed() {
IBookletPage page = this.pages[1];
if (page != null) {
IBookletChapter chapter = page.getChapter();
if (chapter != null) {
IBookletPage[] pages = chapter.getAllPages();
int pageNumToOpen = chapter.getPageIndex(page) + 1;
if (pageNumToOpen >= 0 && pageNumToOpen < pages.length) {
this.minecraft.setScreen(BookletUtils.createPageGui(this.previousScreen, this.parentPage, pages[pageNumToOpen]));
}
}
}
}
@Override
public boolean hasBackButton() {
return true;
}
@Override
public void onBackButtonPressed() {
if (!hasShiftDown()) {
this.minecraft.setScreen(this.parentPage);
} else {
super.onBackButtonPressed();
}
}
}
///*
// * This file ("GuiPage.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// *
// * © 2015-2017 Ellpeck
// */
//
//package de.ellpeck.actuallyadditions.mod.booklet.gui;
//
//import com.mojang.blaze3d.matrix.MatrixStack;
//import com.mojang.blaze3d.platform.GlStateManager;
//import com.mojang.blaze3d.systems.RenderSystem;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
//import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
//import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
//import de.ellpeck.actuallyadditions.mod.booklet.page.ItemDisplay;
//import de.ellpeck.actuallyadditions.mod.inventory.gui.TexturedButton;
//import de.ellpeck.actuallyadditions.mod.util.StringUtil;
//import net.minecraft.client.gui.screen.Screen;
//import net.minecraft.client.gui.widget.button.Button;
//import net.minecraft.item.ItemStack;
//import net.minecraft.util.text.TextFormatting;
//import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn;
//
//import java.awt.*;
//import java.io.IOException;
//import java.net.URI;
//import java.util.ArrayList;
//import java.util.Collections;
//import java.util.List;
//
//@OnlyIn(Dist.CLIENT)
//public class GuiPage extends GuiBooklet {
//
// public final IBookletPage[] pages = new IBookletPage[2];
// private final List<ItemDisplay> itemDisplays = new ArrayList<>();
// private int pageTimer;
//
// private Button buttonViewOnline;
//
// public GuiPage(Screen previousScreen, GuiBookletBase parentPage, IBookletPage page1, IBookletPage page2) {
// super(previousScreen, parentPage);
//
// this.pages[0] = page1;
// this.pages[1] = page2;
// }
//
// @Override
// public void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
// super.mouseClicked(mouseX, mouseY, mouseButton);
//
// for (ItemDisplay display : this.itemDisplays) {
// display.onMousePress(mouseButton, mouseX, mouseY);
// }
//
// for (IBookletPage page : this.pages) {
// if (page != null) {
// page.mouseClicked(this, mouseX, mouseY, mouseButton);
// }
// }
// }
//
// @Override
// public void mouseReleased(int mouseX, int mouseY, int state) {
// super.mouseReleased(mouseX, mouseY, state);
//
// for (IBookletPage page : this.pages) {
// if (page != null) {
// page.mouseReleased(this, mouseX, mouseY, state);
// }
// }
// }
//
// @Override
// public void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
// super.mouseClickMove(mouseX, mouseY, clickedMouseButton, timeSinceLastClick);
//
// for (IBookletPage page : this.pages) {
// if (page != null) {
// page.mouseClickMove(this, mouseX, mouseY, clickedMouseButton, timeSinceLastClick);
// }
// }
// }
///*
// @Override
// public void actionPerformed(GuiButton button) throws IOException {
// if (button == this.buttonViewOnline) {
// List<String> links = this.getWebLinks();
// if (Desktop.isDesktopSupported()) {
// for (String link : links) {
// try {
// Desktop.getDesktop().browse(new URI(link));
// } catch (Exception e) {
// ActuallyAdditions.LOGGER.error("Couldn't open website from Booklet page!", e);
// }
// }
// }
// } else {
// super.actionPerformed(button);
//
// for (IBookletPage page : this.pages) {
// if (page != null) {
// page.actionPerformed(this, button);
// }
// }
// }
// }
// */
// @Override
// public void init() {
// this.itemDisplays.clear();
// super.init();
//
// List<String> links = this.getWebLinks();
// 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.addButton(this.buttonViewOnline);
// }
//
// for (int i = 0; i < this.pages.length; i++) {
// IBookletPage page = this.pages[i];
// if (page != null) {
// page.init(this, this.guiLeft + 6 + i * 142, this.guiTop + 7);
// }
// }
// }
//
// private List<String> getWebLinks() {
// List<String> links = new ArrayList<>();
//
// for (IBookletPage page : this.pages) {
// if (page != null) {
// String link = page.getWebLink();
// if (link != null && !links.contains(link)) {
// links.add(link);
// }
// }
// }
//
// return links;
// }
//
// @Override
// public void tick() {
// super.tick();
//
// for (int i = 0; i < this.pages.length; i++) {
// IBookletPage page = this.pages[i];
// if (page != null) {
// page.updateScreen(this, this.guiLeft + 6 + i * 142, this.guiTop + 7, this.pageTimer);
// }
// }
//
// this.pageTimer++;
// }
//
// @Override
// public void drawScreenPre(MatrixStack stack, int mouseX, int mouseY, float partialTicks) {
// super.drawScreenPre(stack, mouseX, mouseY, partialTicks);
//
// if (this.pages[0] != null) {
// IBookletChapter chapter = this.pages[0].getChapter();
// String name = chapter.getLocalizedName();
// 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++) {
// IBookletPage page = this.pages[i];
// if (page != null) {
// IBookletChapter chapter = this.pages[i].getChapter();
// 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());
//
// RenderSystem.color3f(1f, 1f, 1f);
// page.drawScreenPre(this, this.guiLeft + 6 + i * 142, this.guiTop + 7, mouseX, mouseY, partialTicks);
// }
// }
// for (ItemDisplay display : this.itemDisplays) {
// display.drawPre();
// }
// }
//
// @Override
// public void drawScreenPost(MatrixStack stack, int mouseX, int mouseY, float partialTicks) {
// super.drawScreenPost(stack, mouseX, mouseY, partialTicks);
//
// for (int i = 0; i < this.pages.length; i++) {
// IBookletPage page = this.pages[i];
// if (page != null) {
// RenderSystem.color3f(1F, 1F, 1F);
// page.drawScreenPost(this, this.guiLeft + 6 + i * 142, this.guiTop + 7, mouseX, mouseY, partialTicks);
// }
// }
// for (ItemDisplay display : this.itemDisplays) {
// display.drawPost(mouseX, mouseY);
// }
// }
//
// @Override
// public void addOrModifyItemRenderer(ItemStack renderedStack, int x, int y, float scale, boolean shouldTryTransfer) {
// for (ItemDisplay display : this.itemDisplays) {
// if (display.x == x && display.y == y && display.scale == scale) {
// display.stack = renderedStack;
// return;
// }
// }
//
// this.itemDisplays.add(new ItemDisplay(this, x, y, scale, renderedStack, shouldTryTransfer));
// }
//
// @Override
// public boolean hasPageLeftButton() {
// IBookletPage page = this.pages[0];
// if (page != null) {
// IBookletChapter chapter = page.getChapter();
// if (chapter != null) {
// return chapter.getPageIndex(page) > 0;
// }
// }
// return false;
// }
//
// @Override
// public void onPageLeftButtonPressed() {
// IBookletPage page = this.pages[0];
// if (page != null) {
// IBookletChapter chapter = page.getChapter();
// if (chapter != null) {
// IBookletPage[] pages = chapter.getAllPages();
//
// int pageNumToOpen = chapter.getPageIndex(page) - 1;
// if (pageNumToOpen >= 0 && pageNumToOpen < pages.length) {
// this.minecraft.setScreen(BookletUtils.createPageGui(this.previousScreen, this.parentPage, pages[pageNumToOpen]));
// }
// }
// }
// }
//
// @Override
// public boolean hasPageRightButton() {
// IBookletPage page = this.pages[1];
// if (page != null) {
// IBookletChapter chapter = page.getChapter();
// if (chapter != null) {
// int pageIndex = chapter.getPageIndex(page);
// int pageAmount = chapter.getAllPages().length;
// return pageIndex + 1 < pageAmount;
// }
// }
// return false;
// }
//
// @Override
// public void onPageRightButtonPressed() {
// IBookletPage page = this.pages[1];
// if (page != null) {
// IBookletChapter chapter = page.getChapter();
// if (chapter != null) {
// IBookletPage[] pages = chapter.getAllPages();
//
// int pageNumToOpen = chapter.getPageIndex(page) + 1;
// if (pageNumToOpen >= 0 && pageNumToOpen < pages.length) {
// this.minecraft.setScreen(BookletUtils.createPageGui(this.previousScreen, this.parentPage, pages[pageNumToOpen]));
// }
// }
// }
// }
//
// @Override
// public boolean hasBackButton() {
// return true;
// }
//
// @Override
// public void onBackButtonPressed() {
// if (!hasShiftDown()) {
// this.minecraft.setScreen(this.parentPage);
// } else {
// super.onBackButtonPressed();
// }
// }
//}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,59 +1,59 @@
/*
* This file ("PagePicture.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.page;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.client.gui.GuiUtils;
public class PagePicture extends BookletPage {
private final ResourceLocation resLoc;
private final int yTextOffset;
public PagePicture(int localizationKey, ResourceLocation resLoc, int yTextOffset, int priority) {
super(localizationKey, priority);
this.resLoc = resLoc;
this.yTextOffset = yTextOffset;
}
public PagePicture(int localizationKey, ResourceLocation resLoc, int yTextOffset) {
super(localizationKey);
this.yTextOffset = yTextOffset;
this.resLoc = resLoc;
}
public PagePicture(int localizationKey, String pictureLocation, int yTextOffset) {
this(localizationKey, AssetUtil.getBookletGuiLocation(pictureLocation), yTextOffset);
}
@Override
@OnlyIn(Dist.CLIENT)
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
gui.getMinecraft().getTextureManager().bind(this.resLoc);
RenderSystem.pushMatrix();
RenderSystem.enableBlend();
RenderSystem.disableAlphaTest();
GuiUtils.drawTexturedModalRect(startX - 6, startY - 7, 0, 0, 256, 256, 0);
RenderSystem.disableBlend();
RenderSystem.enableAlphaTest();
RenderSystem.popMatrix();
PageTextOnly.renderTextToPage(gui, this, startX + 6, startY - 7 + this.yTextOffset);
}
}
///*
// * This file ("PagePicture.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// *
// * © 2015-2017 Ellpeck
// */
//
//package de.ellpeck.actuallyadditions.mod.booklet.page;
//
//import com.mojang.blaze3d.systems.RenderSystem;
//import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
//import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
//import net.minecraft.util.ResourceLocation;
//import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn;
//import net.minecraftforge.fml.client.gui.GuiUtils;
//
//public class PagePicture extends BookletPage {
//
// private final ResourceLocation resLoc;
// private final int yTextOffset;
//
// public PagePicture(int localizationKey, ResourceLocation resLoc, int yTextOffset, int priority) {
// super(localizationKey, priority);
// this.resLoc = resLoc;
// this.yTextOffset = yTextOffset;
// }
//
// public PagePicture(int localizationKey, ResourceLocation resLoc, int yTextOffset) {
// super(localizationKey);
// this.yTextOffset = yTextOffset;
// this.resLoc = resLoc;
// }
//
// public PagePicture(int localizationKey, String pictureLocation, int yTextOffset) {
// this(localizationKey, AssetUtil.getBookletGuiLocation(pictureLocation), yTextOffset);
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
// public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
// super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
//
// gui.getMinecraft().getTextureManager().bind(this.resLoc);
//
// RenderSystem.pushMatrix();
// RenderSystem.enableBlend();
// RenderSystem.disableAlphaTest();
// GuiUtils.drawTexturedModalRect(startX - 6, startY - 7, 0, 0, 256, 256, 0);
// RenderSystem.disableBlend();
// RenderSystem.enableAlphaTest();
// RenderSystem.popMatrix();
//
// 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.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.page;
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.client.gui.GuiUtils;
import java.util.List;
public class PageReconstructor extends BookletPage {
private final LensConversionRecipe recipe;
private boolean isWildcard;
private int counter = 0;
private int rotate = 0;
private ItemStack[] stacks;
public PageReconstructor(int localizationKey, LensConversionRecipe recipe) {
super(localizationKey);
this.recipe = recipe;
if (recipe != null) {
this.stacks = recipe.getInput().getItems();
}
}
@Override
@OnlyIn(Dist.CLIENT)
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
gui.getMinecraft().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS);
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());
PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 88);
if (this.recipe != null) {
if (this.counter++ % 50 == 0) {
gui.addOrModifyItemRenderer(this.stacks[this.rotate++ % this.stacks.length], startX + 30 + 1, startY + 10 + 13, 1F, true);
}
}
}
@Override
@OnlyIn(Dist.CLIENT)
public void init(GuiBookletBase gui, int startX, int startY) {
super.init(gui, startX, startY);
if (this.recipe != null) {
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);
}
}
@Override
public void getItemStacksForPage(List<ItemStack> list) {
super.getItemStacksForPage(list);
if (this.recipe != null) {
ItemStack copy = this.recipe.getOutput().copy();
if (this.isWildcard) {
copy.setDamageValue(Util.WILDCARD);
}
list.add(copy);
}
}
public BookletPage setWildcard() {
this.isWildcard = true;
return this;
}
@Override
public int getSortingPriority() {
return 20;
}
}
///*
// * This file ("PageReconstructor.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// *
// * © 2015-2017 Ellpeck
// */
//
//package de.ellpeck.actuallyadditions.mod.booklet.page;
//
//import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
//import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
//import de.ellpeck.actuallyadditions.mod.util.StringUtil;
//import de.ellpeck.actuallyadditions.mod.util.Util;
//import net.minecraft.item.ItemStack;
//import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn;
//import net.minecraftforge.fml.client.gui.GuiUtils;
//
//import java.util.List;
//
//public class PageReconstructor extends BookletPage {
//
// private final LensConversionRecipe recipe;
// private boolean isWildcard;
// private int counter = 0;
// private int rotate = 0;
// private ItemStack[] stacks;
//
// public PageReconstructor(int localizationKey, LensConversionRecipe recipe) {
// super(localizationKey);
// this.recipe = recipe;
// if (recipe != null) {
// this.stacks = recipe.getInput().getItems();
// }
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
// public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
// super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
//
// gui.getMinecraft().getTextureManager().bind(GuiBooklet.RES_LOC_GADGETS);
// 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());
//
// PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 88);
// if (this.recipe != null) {
// if (this.counter++ % 50 == 0) {
// gui.addOrModifyItemRenderer(this.stacks[this.rotate++ % this.stacks.length], startX + 30 + 1, startY + 10 + 13, 1F, true);
// }
// }
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
// public void init(GuiBookletBase gui, int startX, int startY) {
// super.init(gui, startX, startY);
//
// if (this.recipe != null) {
// 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);
// }
// }
//
// @Override
// public void getItemStacksForPage(List<ItemStack> list) {
// super.getItemStacksForPage(list);
//
// if (this.recipe != null) {
// ItemStack copy = this.recipe.getOutput().copy();
// if (this.isWildcard) {
// copy.setDamageValue(Util.WILDCARD);
// }
// list.add(copy);
// }
// }
//
// public BookletPage setWildcard() {
// this.isWildcard = true;
// return this;
// }
//
// @Override
// public int getSortingPriority() {
// return 20;
// }
//}

View file

@ -1,41 +1,41 @@
/*
* This file ("PageTextOnly.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.page;
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class PageTextOnly extends BookletPage {
public PageTextOnly(int localizationKey, int priority) {
super(localizationKey, priority);
}
public PageTextOnly(int localizationKey) {
super(localizationKey);
}
@OnlyIn(Dist.CLIENT)
public static void renderTextToPage(GuiBookletBase gui, BookletPage page, int x, int y) {
String text = page.getInfoText();
if (text != null && !text.isEmpty()) {
gui.renderSplitScaledAsciiString(text, x, y, 0, false, gui.getMediumFontSize(), 120);
}
}
@Override
@OnlyIn(Dist.CLIENT)
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
renderTextToPage(gui, this, startX + 6, startY + 5);
}
}
///*
// * This file ("PageTextOnly.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// *
// * © 2015-2017 Ellpeck
// */
//
//package de.ellpeck.actuallyadditions.mod.booklet.page;
//
//import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
//import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn;
//
//public class PageTextOnly extends BookletPage {
//
// public PageTextOnly(int localizationKey, int priority) {
// super(localizationKey, priority);
// }
//
// public PageTextOnly(int localizationKey) {
// super(localizationKey);
// }
//
// @OnlyIn(Dist.CLIENT)
// public static void renderTextToPage(GuiBookletBase gui, BookletPage page, int x, int y) {
// String text = page.getInfoText();
// if (text != null && !text.isEmpty()) {
// gui.renderSplitScaledAsciiString(text, x, y, 0, false, gui.getMediumFontSize(), 120);
// }
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
// public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
// super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
// 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.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.booklet.page;
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.data.PlayerData;
import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave;
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class PageTrials extends BookletPage {
private final int buttonId;
@OnlyIn(Dist.CLIENT)
private Button button;
public PageTrials(int localizationKey, boolean button, boolean text) {
super(localizationKey);
if (!text) {
this.setNoText();
}
if (button) {
this.buttonId = PageLinkButton.nextButtonId;
PageLinkButton.nextButtonId++;
} else {
this.buttonId = -1;
}
}
@Override
@OnlyIn(Dist.CLIENT)
public void init(GuiBookletBase gui, int startX, int startY) {
super.init(gui, startX, startY);
if (this.buttonId >= 0) {
this.button = new Button(this.buttonId, startX + 125 / 2 - 50, startY + 120, 100, 20, "");
gui.getButtonList().add(this.button);
this.updateButton();
}
}
@Override
@OnlyIn(Dist.CLIENT)
public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 5);
}
@Override
@OnlyIn(Dist.CLIENT)
protected String getLocalizationKey() {
return "booklet." + ActuallyAdditions.MODID + ".trials." + this.chapter.getIdentifier() + ".text." + this.localizationKey;
}
@Override
@OnlyIn(Dist.CLIENT)
public void actionPerformed(GuiBookletBase gui, Button button) {
if (this.buttonId >= 0 && button.id == this.buttonId) {
PlayerEntity player = Minecraft.getInstance().player;
PlayerSave data = PlayerData.getDataFromPlayer(player);
String id = this.chapter.getIdentifier();
boolean completed = data.completedTrials.contains(id);
if (completed) {
data.completedTrials.remove(id);
} else {
data.completedTrials.add(id);
}
this.updateButton();
PacketHandlerHelper.sendPlayerDataToServer(false, 2);
} else {
super.actionPerformed(gui, button);
}
}
@OnlyIn(Dist.CLIENT)
private void updateButton() {
if (this.buttonId >= 0 && this.button != null) {
PlayerEntity player = Minecraft.getInstance().player;
PlayerSave data = PlayerData.getDataFromPlayer(player);
boolean completed = data.completedTrials.contains(this.chapter.getIdentifier());
if (completed) {
this.button.displayString = TextFormatting.DARK_GREEN + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".trialFinishButton.completed.name");
} else {
this.button.displayString = TextFormatting.DARK_RED + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".trialFinishButton.uncompleted.name");
}
}
}
}
///*
// * This file ("PageTrials.java") is part of the Actually Additions mod for Minecraft.
// * It is created and owned by Ellpeck and distributed
// * under the Actually Additions License to be found at
// * http://ellpeck.de/actaddlicense
// * View the source code at https://github.com/Ellpeck/ActuallyAdditions
// *
// * © 2015-2017 Ellpeck
// */
//
//package de.ellpeck.actuallyadditions.mod.booklet.page;
//
//import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.data.PlayerData;
//import de.ellpeck.actuallyadditions.mod.data.PlayerData.PlayerSave;
//import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
//import de.ellpeck.actuallyadditions.mod.util.StringUtil;
//import net.minecraft.client.Minecraft;
//import net.minecraft.client.gui.widget.button.Button;
//import net.minecraft.entity.player.PlayerEntity;
//import net.minecraft.util.text.TextFormatting;
//import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn;
//
//public class PageTrials extends BookletPage {
//
// private final int buttonId;
// @OnlyIn(Dist.CLIENT)
// private Button button;
//
// public PageTrials(int localizationKey, boolean button, boolean text) {
// super(localizationKey);
//
// if (!text) {
// this.setNoText();
// }
//
// if (button) {
// this.buttonId = PageLinkButton.nextButtonId;
// PageLinkButton.nextButtonId++;
// } else {
// this.buttonId = -1;
// }
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
// public void init(GuiBookletBase gui, int startX, int startY) {
// super.init(gui, startX, startY);
//
// if (this.buttonId >= 0) {
// this.button = new Button(this.buttonId, startX + 125 / 2 - 50, startY + 120, 100, 20, "");
// gui.getButtonList().add(this.button);
// this.updateButton();
// }
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
// public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
// super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
// PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 5);
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
// protected String getLocalizationKey() {
// return "booklet." + ActuallyAdditions.MODID + ".trials." + this.chapter.getIdentifier() + ".text." + this.localizationKey;
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
// public void actionPerformed(GuiBookletBase gui, Button button) {
// if (this.buttonId >= 0 && button.id == this.buttonId) {
// PlayerEntity player = Minecraft.getInstance().player;
// PlayerSave data = PlayerData.getDataFromPlayer(player);
// String id = this.chapter.getIdentifier();
//
// boolean completed = data.completedTrials.contains(id);
// if (completed) {
// data.completedTrials.remove(id);
// } else {
// data.completedTrials.add(id);
// }
// this.updateButton();
//
// PacketHandlerHelper.sendPlayerDataToServer(false, 2);
// } else {
// super.actionPerformed(gui, button);
// }
// }
//
// @OnlyIn(Dist.CLIENT)
// private void updateButton() {
// if (this.buttonId >= 0 && this.button != null) {
// PlayerEntity player = Minecraft.getInstance().player;
// PlayerSave data = PlayerData.getDataFromPlayer(player);
//
// boolean completed = data.completedTrials.contains(this.chapter.getIdentifier());
// if (completed) {
// this.button.displayString = TextFormatting.DARK_GREEN + StringUtil.localize("booklet." + ActuallyAdditions.MODID + ".trialFinishButton.completed.name");
// } else {
// 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;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.Direction;
import net.minecraftforge.common.util.LazyOptional;
@ -18,8 +19,6 @@ import net.minecraftforge.energy.IEnergyStorage;
import java.util.ArrayList;
import java.util.List;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
public class TileEntityShockSuppressor extends TileEntityBase implements IEnergyDisplay {
public static final List<TileEntityShockSuppressor> SUPPRESSORS = new ArrayList<>();
@ -32,7 +31,7 @@ public class TileEntityShockSuppressor extends TileEntityBase implements IEnergy
private int oldEnergy;
public TileEntityShockSuppressor() {
super(ActuallyTiles.SHOCKSUPPRESSOR_TILE.get());
super(ActuallyBlocks.SHOCK_SUPPRESSOR.getTileEntityType());
}
@Override

View file

@ -28,7 +28,9 @@ import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.particles.IParticleData;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@ -165,60 +167,60 @@ public final class AssetUtil {
GlStateManager.enableTexture2D();
}
@OnlyIn(Dist.CLIENT)
public static void renderNameTag(String tag, double x, double y, double z) {
FontRenderer fontrenderer = Minecraft.getInstance().font;
float f = 1.6F;
float f1 = 0.016666668F * f;
GlStateManager._pushMatrix();
GlStateManager.translate(x, y, z);
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().playerViewX, 1.0F, 0.0F, 0.0F);
GlStateManager.scale(-f1, -f1, f1);
GlStateManager._disableLighting();
GlStateManager._depthMask(false);
GlStateManager.disableDepth();
GlStateManager._enableBlend();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder renderer = tessellator.getBuilder();
int i = 0;
int j = fontrenderer.width(tag) / 2;
GlStateManager.disableTexture2D();
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, 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();
tessellator.end();
GlStateManager.enableTexture2D();
fontrenderer.draw(tag, -fontrenderer.width(tag) / 2, i, 553648127);
GlStateManager.enableDepth();
GlStateManager._depthMask(true);
fontrenderer.draw(tag, -fontrenderer.width(tag) / 2, i, -1);
GlStateManager._enableLighting();
GlStateManager._disableBlend();
GlStateManager.color3arg(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager._popMatrix();
}
// @OnlyIn(Dist.CLIENT)
// public static void renderNameTag(String tag, double x, double y, double z) {
// FontRenderer fontrenderer = Minecraft.getInstance().font;
// float f = 1.6F;
// float f1 = 0.016666668F * f;
// GlStateManager._pushMatrix();
// GlStateManager.translate(x, y, z);
// 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().playerViewX, 1.0F, 0.0F, 0.0F);
// GlStateManager.scale(-f1, -f1, f1);
// GlStateManager._disableLighting();
// GlStateManager._depthMask(false);
// GlStateManager.disableDepth();
// GlStateManager._enableBlend();
// GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
// Tessellator tessellator = Tessellator.getInstance();
// BufferBuilder renderer = tessellator.getBuilder();
// int i = 0;
// int j = fontrenderer.width(tag) / 2;
// GlStateManager.disableTexture2D();
// 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, 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();
// tessellator.end();
// GlStateManager.enableTexture2D();
// fontrenderer.draw(tag, -fontrenderer.width(tag) / 2, i, 553648127);
// GlStateManager.enableDepth();
// GlStateManager._depthMask(true);
// fontrenderer.draw(tag, -fontrenderer.width(tag) / 2, i, -1);
// GlStateManager._enableLighting();
// GlStateManager._disableBlend();
// GlStateManager.color3arg(1.0F, 1.0F, 1.0F, 1.0F);
// 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) {
if (!world.isClientSide) {
CompoundNBT data = new CompoundNBT();
data.setDouble("StartX", startX);
data.setDouble("StartY", startY);
data.setDouble("StartZ", startZ);
data.setDouble("EndX", endX);
data.setDouble("EndY", endY);
data.setDouble("EndZ", endZ);
data.setFloat("Color1", color[0]);
data.setFloat("Color2", color[1]);
data.setFloat("Color3", color[2]);
data.setDouble("RotationTime", rotationTime);
data.setFloat("Size", size);
data.setInteger("MaxAge", maxAge);
data.setFloat("Alpha", alpha);
data.putDouble("StartX", startX);
data.putDouble("StartY", startY);
data.putDouble("StartZ", startZ);
data.putDouble("EndX", endX);
data.putDouble("EndY", endY);
data.putDouble("EndZ", endZ);
data.putFloat("Color1", color[0]);
data.putFloat("Color2", color[1]);
data.putFloat("Color3", color[2]);
data.putDouble("RotationTime", rotationTime);
data.putFloat("Size", size);
data.putInt("MaxAge", maxAge);
data.putFloat("Alpha", alpha);
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) {
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);
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 b = color[2];
Vec3d vec1 = new Vec3d(firstX, firstY, firstZ);
Vec3d vec2 = new Vec3d(secondX, secondY, secondZ);
Vec3d combinedVec = vec2.subtract(vec1);
Vector3d vec1 = new Vector3d(firstX, firstY, firstZ);
Vector3d vec2 = new Vector3d(secondX, secondY, secondZ);
Vector3d combinedVec = vec2.subtract(vec1);
double rot = rotationTime > 0
? 360D * (world.getTotalWorldTime() % rotationTime / rotationTime)
? 360D * (world.getGameTime() % rotationTime / rotationTime)
: 0;
double pitch = Math.atan2(combinedVec.y, Math.sqrt(combinedVec.x * combinedVec.x + combinedVec.z * combinedVec.z));
double yaw = Math.atan2(-combinedVec.z, combinedVec.x);
@ -261,7 +263,7 @@ public final class AssetUtil {
GlStateManager._disableLighting();
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);
float ref = GL11.glGetFloat(GL11.GL_ALPHA_TEST_REF);
GlStateManager._alphaFunc(GL11.GL_ALWAYS, 0);

View file

@ -10,17 +10,13 @@
package de.ellpeck.actuallyadditions.mod.util;
import com.mojang.blaze3d.platform.GlStateManager;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.text.LanguageMap;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.util.List;
import net.minecraftforge.fml.ForgeI18n;
public final class StringUtil {
@ -28,6 +24,8 @@ public final class StringUtil {
public static final int DECIMAL_COLOR_GRAY_TEXT = 4210752;
public static final String BUGGED_ITEM_NAME = ActuallyAdditions.MODID + ".lolWutHowUDoDis";
//TODO: Remove
static LanguageMap cancerino;
/**
* Localizes a given String
@ -48,58 +46,59 @@ public final class StringUtil {
@SuppressWarnings("deprecation")
//TODO: delete this shit and move ItemPotionRing's getItemStackDisplayName into getUnlocalizedName
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)
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);
for (int i = 0; i < list.size(); i++) {
String s1 = list.get(i);
renderer.draw(s1, x, y + i * renderer.lineHeight, color, shadow);
}
// ResourcePackList <- holds the correct way
// List<String> list = renderer.listFormattedStringToWidth(strg, width);
// for (int i = 0; i < list.size(); i++) {
// 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)
public static void renderScaledAsciiString(FontRenderer font, String text, float x, float y, int color, boolean shadow, float scale) {
GlStateManager._pushMatrix();
GlStateManager.scale(scale, scale, scale);
boolean oldUnicode = font.getUnicodeFlag();
font.setUnicodeFlag(false);
font.draw(text, x / scale, y / scale, color, shadow);
font.setUnicodeFlag(oldUnicode);
GlStateManager._popMatrix();
// GlStateManager._pushMatrix();
// GlStateManager.scale(scale, scale, scale);
// boolean oldUnicode = font.getUnicodeFlag();
// font.setUnicodeFlag(false);
//
// font.draw(text, x / scale, y / scale, color, shadow);
//
// font.setUnicodeFlag(oldUnicode);
// GlStateManager._popMatrix();
}
@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);
}
}
//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!");
}
}
// 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) {
if (cancerino == null) {
cancerino = new LanguageMap();
setupLangMap();
}
return cancerino.translateKey("item.actuallyadditions." + someUnlocAAItemName + ".name");
// if (cancerino == null) {
// cancerino = new LanguageMap();
// setupLangMap();
// }
// 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;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.server.ServerWorld;
public final class VanillaPacketDispatcher {
@ -11,16 +11,11 @@ public final class VanillaPacketDispatcher {
//Don't call from the client.
public static void dispatchTEToNearbyPlayers(TileEntity tile) {
ServerWorld world = (ServerWorld) tile.getLevel();
PlayerChunkMapEntry entry = world.getPlayerChunkMap().getEntry(tile.getBlockPos().getX() >> 4, tile.getBlockPos().getZ() >> 4);
if (entry == null) {
return;
}
for (ServerPlayerEntity player : entry.getWatchingPlayers()) {
player.connection.send(tile.getUpdatePacket());
}
Chunk chunk = world.getChunk(tile.getBlockPos().getX() >> 4, tile.getBlockPos().getZ() >> 4);
world.getChunkSource().chunkMap.getPlayers(chunk.getPos(), false).forEach(e -> {
e.connection.send(tile.getUpdatePacket());
});
}
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.MathHelper;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
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) {
if (maxTransfer > 0) {
Direction opp = sideTo == null
? null
: sideTo.getOpposite();
? null
: sideTo.getOpposite();
IEnergyStorage handlerFrom = tileFrom.getCapability(CapabilityEnergy.ENERGY, sideTo);
IEnergyStorage handlerTo = tileTo.getCapability(CapabilityEnergy.ENERGY, opp);
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 block The Block
* @param world The World
*
* @return Is every block present?
*/
public static boolean hasBlocksInPlacesGiven(BlockPos[] positions, Block block, World world) {
@ -258,14 +258,14 @@ public final class WorldUtil {
double d0 = player.posX;
double d1 = player.posY + player.getEyeHeight();
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 f3 = MathHelper.sin(-f1 * 0.017453292F - (float) Math.PI);
float f4 = -MathHelper.cos(-f * 0.017453292F);
float f5 = MathHelper.sin(-f * 0.017453292F);
float f6 = f3 * 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);
}
@ -308,7 +308,6 @@ public final class WorldUtil {
* @param world The player's world.
* @param player The player that is breaking this block.
* @param pos The pos to break.
*
* @return If the break was successful.
*/
public static boolean breakExtraBlock(ItemStack stack, World world, PlayerEntity player, BlockPos pos) {