diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java b/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java deleted file mode 100644 index 8d3673cf6..000000000 --- a/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java +++ /dev/null @@ -1,318 +0,0 @@ -package de.ellpeck.actuallyadditions.api; - -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.farmer.IFarmerBehavior; -import de.ellpeck.actuallyadditions.api.internal.IMethodHandler; -import de.ellpeck.actuallyadditions.api.laser.ILaserRelayConnectionHandler; -import de.ellpeck.actuallyadditions.api.lens.Lens; -import de.ellpeck.actuallyadditions.api.lens.LensConversion; -import de.ellpeck.actuallyadditions.api.recipe.*; -import de.ellpeck.actuallyadditions.common.recipes.CrusherRecipe; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.Ingredient; -import net.minecraftforge.registries.IForgeRegistry; -import net.minecraftforge.registries.RegistryBuilder; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public final class ActuallyAdditionsAPI { - - public static final String MOD_ID = "actuallyadditions"; - public static final String API_ID = MOD_ID + "api"; - public static final String API_VERSION = "34"; - - public static final IForgeRegistry LENS_REGISTRY = new RegistryBuilder().disableSync().disableSaving().disableOverrides().create(); - - public static final List CRUSHER_RECIPES = new ArrayList<>(); - public static final List BALL_OF_FUR_RETURN_ITEMS = new ArrayList<>(); - public static final List TREASURE_CHEST_LOOT = new ArrayList<>(); - public static final List RECONSTRUCTOR_LENS_CONVERSION_RECIPES = new ArrayList<>(); - public static final List EMPOWERER_RECIPES = new ArrayList<>(); - public static final Map RECONSTRUCTOR_LENS_COLOR_CHANGERS = new HashMap<>(); - /** - * Farmer behaviors are sorted when first accessed, this will not be done until after loading, but do not add behaviors at runtime. - */ - public static final List FARMER_BEHAVIORS = new ArrayList<>(); - public static final List COFFEE_MACHINE_INGREDIENTS = new ArrayList<>(); - public static final List COMPOST_RECIPES = new ArrayList<>(); - public static final List OIL_GENERATOR_RECIPES = new ArrayList<>(); - public static final List BOOKLET_ENTRIES = new ArrayList<>(); - //This is added to automatically, you don't need to add anything to this list - public static final List ALL_CHAPTERS = new ArrayList<>(); - //This is added to automatically, you don't need to add anything to this list - public static final List BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA = new ArrayList<>(); - public static final List STONE_ORES = new ArrayList<>(); - public static final List NETHERRACK_ORES = new ArrayList<>(); - - /** - * Use this to handle things that aren't based in the API itself - * DO NOT CHANGE/OVERRIDE THIS!! - * This is getting initialized in Actually Additions' PreInit phase - */ - public static IMethodHandler methodHandler; - - /** - * Use this to add, remove or get Laser Relay Connections and Networks - * The network system is built in a way that doesn't need the individual - * positions to be Laser Relays, it relies only on BlockPos - * DO NOT CHANGE/OVERRIDE THIS!! - * This is getting initialized in Actually Additions' PreInit phase - */ - public static ILaserRelayConnectionHandler connectionHandler; - - //These are getting initialized in Actually Additions' PreInit phase - //DO NOT CHANGE/OVERRIDE THESE!! - public static IBookletEntry entryGettingStarted; - public static IBookletEntry entryReconstruction; - public static IBookletEntry entryLaserRelays; - public static IBookletEntry entryFunctionalNonRF; - public static IBookletEntry entryFunctionalRF; - public static IBookletEntry entryGeneratingRF; - public static IBookletEntry entryItemsNonRF; - public static IBookletEntry entryItemsRF; - public static IBookletEntry entryMisc; - public static IBookletEntry entryUpdatesAndInfos; - //This is added to automatically, you don't need to add anything to this entry - public static IBookletEntry entryAllAndSearch; - public static IBookletEntry entryTrials; - - //These are getting initialized in Actually Additions' PreInit phase - //DO NOT CHANGE/OVERRIDE THESE!! - public static LensConversion lensDefaultConversion; - public static Lens lensDetonation; - public static Lens lensDeath; - public static Lens lensEvenMoarDeath; - public static Lens lensColor; - public static Lens lensDisruption; - public static Lens lensDisenchanting; - public static Lens lensMining; - - /** - * Adds an ore with a specific weight to the list of ores that the lens of the miner will generate inside of stone. - * Higher weight means higher occurence. - * - * @param oreName The ore's name - * @param weight The ore's weight - */ - public static void addMiningLensStoneOre(String oreName, int weight) { - STONE_ORES.add(new WeightedOre(oreName, weight)); - } - - /** - * Adds an ore with a specific weight to the list of ores that the lens of the miner will generate inside of netherrack. - * Higher weight means higher occurence. - * - * @param oreName The ore's name - * @param weight The ore's weight - */ - public static void addMiningLensNetherOre(String oreName, int weight) { - NETHERRACK_ORES.add(new WeightedOre(oreName, weight)); - } - - /** - * Adds a Recipe to the Crusher Recipe Registry - * - * @param input The input as an ItemStack - * @param outputOne The first output as an ItemStack - * @param outputTwo The second output as an ItemStack (can be ItemStack.EMPTY if there should be none) - * @param outputTwoChance The chance of the second output (0 won't occur at all, 100 will all the time) - */ - public static void addCrusherRecipe(ItemStack input, ItemStack outputOne, ItemStack outputTwo, int outputTwoChance) { - CRUSHER_RECIPES.add(new CrusherRecipe(Ingredient.fromStacks(input), outputOne, outputTwo.isEmpty() ? ItemStack.EMPTY : outputTwo, outputTwoChance)); - } - - /** - * Adds a Recipe to the Crusher Recipe Registry - * - * @param input The input as an Ingredient - * @param outputOne The first output as an ItemStack - * @param outputTwo The second output as an ItemStack (can be ItemStack.EMPTY if there should be none) - * @param outputTwoChance The chance of the second output (0 won't occur at all, 100 will all the time) - */ - public static void addCrusherRecipe(Ingredient input, ItemStack outputOne, ItemStack outputTwo, int outputTwoChance) { - CRUSHER_RECIPES.add(new CrusherRecipe(input, outputOne, outputTwo.isEmpty() ? ItemStack.EMPTY : outputTwo, outputTwoChance)); - } - - /** - * Adds multiple Recipes to the Crusher Recipe Registry - * Use this if you want to add OreDictionary recipes easier - * - * @param inputs The inputs as an ItemStack List, stacksizes are ignored - * @param outputOnes The first outputs as an ItemStack List, stacksizes are ignored - * @param outputOneAmounts The amount of the first output, will be equal for all entries in the list - * @param outputTwos The second outputs as a List (can be null or empty if there should be none) - * @param outputTwoAmounts The amount of the second output, will be equal for all entries in the list - * @param outputTwoChance The chance of the second output (0 won't occur at all, 100 will all the time) - */ - public static boolean addCrusherRecipes(List inputs, List outputOnes, int outputOneAmounts, List outputTwos, int outputTwoAmounts, int outputTwoChance) { - return methodHandler.addCrusherRecipes(inputs, outputOnes, outputOneAmounts, outputTwos, outputTwoAmounts, outputTwoChance); - } - - //Same thing as above, but with ItemStack outputs. - @Deprecated //Use Ingredient - public static boolean addCrusherRecipes(List inputs, ItemStack outputOne, int outputOneAmount, ItemStack outputTwo, int outputTwoAmount, int outputTwoChance) { - return methodHandler.addCrusherRecipes(inputs, outputOne, outputOneAmount, outputTwo, outputTwoAmount, outputTwoChance); - } - - /** - * Adds a Recipe to the Oil generator - * - * @param fluidName The name of the fluid to be consumed - * @param genAmount The amount of energy generated per operation - */ - public static void addOilGenRecipe(String fluidName, int genAmount) { - addOilGenRecipe(fluidName, genAmount, 100); - } - - /** - * Adds a Recipe to the Oil generator - * - * @param fluidName The name of the fluid to be consumed - * @param genAmount The amount of energy generated per operation - */ - public static void addOilGenRecipe(String fluidName, int genAmount, int genTime) { - OIL_GENERATOR_RECIPES.add(new OilGenRecipe(fluidName, genAmount, genTime)); - } - - /** - * Adds a new conversion recipe to the compost. - * - * @param input The itemstack to be input into the compost - * @param inputDisplay The block to display when there is input in the compost - * @param output The itemstack to be output from the compost once conversion finishes - * @param outputDisplay The block to display when there is output in the compost - */ - @Deprecated - public static void addCompostRecipe(ItemStack input, Block inputDisplay, ItemStack output, Block outputDisplay) { - COMPOST_RECIPES.add(new CompostRecipe(input, inputDisplay, output, outputDisplay)); - } - - /** - * Adds a new conversion recipe to the compost. - * - * @param input The ingredient to be input into the compost - * @param inputDisplay The state to display when there is input in the compost - * @param output The itemstack to be output from the compost once conversion finishes - * @param outputDisplay The state to display when there is output in the compost - */ - public static void addCompostRecipe(Ingredient input, BlockState inputDisplay, ItemStack output, BlockState outputDisplay) { - COMPOST_RECIPES.add(new CompostRecipe(input, inputDisplay, output, outputDisplay)); - } - - /** - * Adds an item to the list of possible items to be returned when right-clicking a Ball Of Fur - * - * @param stack The ItemStack to be returned - * @param chance The chance (this is from WeightedRandom.Item) - */ - public static void addBallOfFurReturnItem(ItemStack stack, int chance) { - BALL_OF_FUR_RETURN_ITEMS.add(new BallOfFurReturn(stack, chance)); - } - - /** - * Adds an item to the list of possible items to be returned when opening a Treasure Chest - * - * @param stack The ItemStack to be returned, the stacksize is ignored - * @param chance The chance (this is from WeightedRandom.Item) - * @param minAmount The minimum stacksize of the returned stack - * @param maxAmount The maximum stacksize of the returned stack - */ - public static void addTreasureChestLoot(ItemStack stack, int chance, int minAmount, int maxAmount) { - TREASURE_CHEST_LOOT.add(new TreasureChestLoot(stack, chance, minAmount, maxAmount)); - } - - @Deprecated - public static void addEmpowererRecipe(ItemStack input, ItemStack output, ItemStack modifier1, ItemStack modifier2, ItemStack modifier3, ItemStack modifier4, int energyPerStand, int time, float[] particleColor) { - EMPOWERER_RECIPES.add(new EmpowererRecipe(input, output, modifier1, modifier2, modifier3, modifier4, energyPerStand, time, particleColor)); - } - - public static void addEmpowererRecipe(Ingredient input, ItemStack output, Ingredient modifier1, Ingredient modifier2, Ingredient modifier3, Ingredient modifier4, int energyPerStand, int time, float[] particleColor) { - EMPOWERER_RECIPES.add(new EmpowererRecipe(input, output, modifier1, modifier2, modifier3, modifier4, energyPerStand, time, particleColor)); - } - - /** - * Adds a recipe to the Atomic Reconstructor conversion lenses - * StackSizes can only be 1 and greater ones will be ignored - * - * @param input The input as an ItemStack - * @param output The output as an ItemStack - * @param energyUse The amount of RF used per conversion - * @param type The type of lens used for the conversion. To use the default type, use method below. - * Note how this always has to be the same instance of the lens type that the item also has for it to work! - */ - @Deprecated - public static void addReconstructorLensConversionRecipe(ItemStack input, ItemStack output, int energyUse, LensConversion type) { - RECONSTRUCTOR_LENS_CONVERSION_RECIPES.add(new LensConversionRecipe(input, output, energyUse, type)); - } - - @Deprecated - public static void addReconstructorLensConversionRecipe(ItemStack input, ItemStack output, int energyUse) { - addReconstructorLensConversionRecipe(input, output, energyUse, lensDefaultConversion); - } - - /** - * Adds a recipe to the Atomic Reconstructor conversion lenses - * StackSizes can only be 1 and greater ones will be ignored - * - * @param input The input as an ItemStack - * @param output The output as an ItemStack - * @param energyUse The amount of RF used per conversion - * @param type The type of lens used for the conversion. To use the default type, use method below. - * Note how this always has to be the same instance of the lens type that the item also has for it to work! - */ - public static void addReconstructorLensConversionRecipe(Ingredient input, ItemStack output, int energyUse, LensConversion type) { - RECONSTRUCTOR_LENS_CONVERSION_RECIPES.add(new LensConversionRecipe(input, output, energyUse, type)); - } - - public static void addReconstructorLensConversionRecipe(Ingredient input, ItemStack output, int energyUse) { - addReconstructorLensConversionRecipe(input, output, energyUse, lensDefaultConversion); - } - - /** - * Adds an item and the way it is modified to the Atomic Reconstructor's color lens. - * This also works for blocks, but they have to be in their item form. - * The way it is modified is an instance of IColorLensChanger. When modifying the item, - * its modifyItem() method will be called with a stack containing the item. - * - * @param item The item (or block's item) to add - * @param changer The change mechanism - */ - public static void addReconstructorLensColorChangeItem(Item item, IColorLensChanger changer) { - RECONSTRUCTOR_LENS_COLOR_CHANGERS.put(item, changer); - } - - /** - * Adds an ingredient to the Coffee Machine ingredient list - * - * @param ingredient The ingredient to add - */ - public static void addCoffeeMachineIngredient(CoffeeIngredient ingredient) { - COFFEE_MACHINE_INGREDIENTS.add(ingredient); - } - - /** - * Adds a booklet entry to the list of entries - * - * @param entry The entry to add - */ - public static void addBookletEntry(IBookletEntry entry) { - BOOKLET_ENTRIES.add(entry); - } - - /** - * Adds a new farmer behavior to the Farmer - * - * @param behavior The behavior to add - */ - public static void addFarmerBehavior(IFarmerBehavior behavior) { - FARMER_BEHAVIORS.add(behavior); - } -} diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletChapter.java b/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletChapter.java deleted file mode 100644 index a2761a970..000000000 --- a/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletChapter.java +++ /dev/null @@ -1,26 +0,0 @@ -package de.ellpeck.actuallyadditions.api.booklet; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; - -public interface IBookletChapter { - - IBookletPage[] getAllPages(); - - @OnlyIn(Dist.CLIENT) - String getLocalizedName(); - - @OnlyIn(Dist.CLIENT) - String getLocalizedNameWithFormatting(); - - IBookletEntry getEntry(); - - ItemStack getDisplayItemStack(); - - String getIdentifier(); - - int getPageIndex(IBookletPage page); - - int getSortingPriority(); -} diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletEntry.java b/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletEntry.java deleted file mode 100644 index 4ef4ed611..000000000 --- a/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletEntry.java +++ /dev/null @@ -1,29 +0,0 @@ -package de.ellpeck.actuallyadditions.api.booklet; - -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; - -import java.util.List; - -public interface IBookletEntry { - - List getAllChapters(); - - String getIdentifier(); - - @OnlyIn(Dist.CLIENT) - String getLocalizedName(); - - @OnlyIn(Dist.CLIENT) - String getLocalizedNameWithFormatting(); - - void addChapter(IBookletChapter chapter); - - @OnlyIn(Dist.CLIENT) - List getChaptersForDisplay(String searchBarText); - - int getSortingPriority(); - - @OnlyIn(Dist.CLIENT) - boolean visibleOnFrontPage(); -} diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletPage.java b/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletPage.java deleted file mode 100644 index bd0095c98..000000000 --- a/src/main/java/de/ellpeck/actuallyadditions/api/booklet/IBookletPage.java +++ /dev/null @@ -1,63 +0,0 @@ -package de.ellpeck.actuallyadditions.api.booklet; - -import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; -import net.minecraft.item.ItemStack; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.fluids.FluidStack; - -import java.awt.*; -import java.util.List; - -public interface IBookletPage { - - void getItemStacksForPage(List list); - - void getFluidStacksForPage(List list); - - IBookletChapter getChapter(); - - void setChapter(IBookletChapter chapter); - - @OnlyIn(Dist.CLIENT) - String getInfoText(); - - @OnlyIn(Dist.CLIENT) - void mouseClicked(GuiBookletBase gui, int mouseX, int mouseY, int mouseButton); - - @OnlyIn(Dist.CLIENT) - void mouseReleased(GuiBookletBase gui, int mouseX, int mouseY, int state); - - @OnlyIn(Dist.CLIENT) - void mouseClickMove(GuiBookletBase gui, int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick); - - // todo: this won't be needed anymore - @OnlyIn(Dist.CLIENT) - void actionPerformed(GuiBookletBase gui, Button button); - - @OnlyIn(Dist.CLIENT) - void initGui(GuiBookletBase gui, int startX, int startY); - - @OnlyIn(Dist.CLIENT) - void updateScreen(GuiBookletBase gui, int startX, int startY, int pageTimer); - - @OnlyIn(Dist.CLIENT) - void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks); - - @OnlyIn(Dist.CLIENT) - void drawScreenPost(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks); - - boolean shouldBeOnLeftSide(); - - String getIdentifier(); - - String getWebLink(); - - IBookletPage addTextReplacement(String key, String value); - - IBookletPage addTextReplacement(String key, float value); - - IBookletPage addTextReplacement(String key, int value); - - int getSortingPriority(); -} diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/booklet/internal/GuiBookletBase.java b/src/main/java/de/ellpeck/actuallyadditions/api/booklet/internal/GuiBookletBase.java deleted file mode 100644 index 1e1682977..000000000 --- a/src/main/java/de/ellpeck/actuallyadditions/api/booklet/internal/GuiBookletBase.java +++ /dev/null @@ -1,38 +0,0 @@ -package de.ellpeck.actuallyadditions.api.booklet.internal; - -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.ITextComponent; -import net.minecraft.util.text.StringTextComponent; - -import java.util.List; - -public abstract class GuiBookletBase extends Screen { - - protected GuiBookletBase(ITextComponent titleIn) { - super(new StringTextComponent("")); - } - - public abstract void renderScaledAsciiString(String text, int x, int y, int color, boolean shadow, float scale); - - public abstract void renderSplitScaledAsciiString(String text, int x, int y, int color, boolean shadow, float scale, int length); - - public abstract List