ActuallyAdditions/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java

260 lines
12 KiB
Java
Raw Normal View History

2016-01-05 04:47:35 +01:00
/*
2016-05-16 22:52:27 +02:00
* This file ("ActuallyAdditionsAPI.java") is part of the Actually Additions mod for Minecraft.
2016-01-05 04:47:35 +01:00
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
2016-05-16 22:52:27 +02:00
* http://ellpeck.de/actaddlicense
2016-01-05 04:47:35 +01:00
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
2016-05-16 22:54:42 +02:00
* © 2015-2016 Ellpeck
2016-01-05 04:47:35 +01:00
*/
package de.ellpeck.actuallyadditions.api;
2016-01-05 14:57:50 +01:00
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
2016-05-14 13:51:18 +02:00
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 net.minecraft.block.Block;
import net.minecraft.item.Item;
2016-01-05 04:47:35 +01:00
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import java.util.ArrayList;
import java.util.HashMap;
2016-01-05 04:47:35 +01:00
import java.util.List;
import java.util.Map;
2016-01-05 04:47:35 +01:00
public final class ActuallyAdditionsAPI{
2016-01-05 04:47:35 +01:00
2016-04-20 21:39:03 +02:00
public static final String MOD_ID = "actuallyadditions";
public static final String API_ID = MOD_ID+"api";
public static final String API_VERSION = "19";
2016-05-19 20:05:12 +02:00
public static final List<CrusherRecipe> CRUSHER_RECIPES = new ArrayList<CrusherRecipe>();
public static final List<BallOfFurReturn> BALL_OF_FUR_RETURN_ITEMS = new ArrayList<BallOfFurReturn>();
public static final List<TreasureChestLoot> TREASURE_CHEST_LOOT = new ArrayList<TreasureChestLoot>();
public static final List<LensConversionRecipe> RECONSTRUCTOR_LENS_CONVERSION_RECIPES = new ArrayList<LensConversionRecipe>();
public static final Map<Item, IColorLensChanger> RECONSTRUCTOR_LENS_COLOR_CHANGERS = new HashMap<Item, IColorLensChanger>();
public static final List<CoffeeIngredient> COFFEE_MACHINE_INGREDIENTS = new ArrayList<CoffeeIngredient>();
public static final List<CompostRecipe> COMPOST_RECIPES = new ArrayList<CompostRecipe>();
2016-05-19 20:05:12 +02:00
public static final List<IBookletEntry> BOOKLET_ENTRIES = new ArrayList<IBookletEntry>();
public static final List<BookletPage> BOOKLET_PAGES_WITH_ITEM_DATA = new ArrayList<BookletPage>();
2016-06-01 00:39:35 +02:00
/**
* 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;
2016-05-14 13:51:18 +02:00
//These are getting initialized in Actually Additions' PreInit phase
//DO NOT CHANGE/OVERRIDE THESE!!
2016-01-05 14:57:50 +01:00
public static IBookletEntry entryGettingStarted;
public static IBookletEntry entryReconstruction;
2016-01-05 14:57:50 +01:00
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 allAndSearch;
//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 lensColor;
public static Lens lensDisruption;
public static Lens lensDisenchanting;
2016-01-05 04:47:35 +01:00
/**
* Adds a Recipe to the Crusher Recipe Registry
* The second output will be nothing
*
* @param input The input's OreDictionary name
* @param outputOne The first output's OreDictionary name
* @param outputOneAmount The amount of the first output
*/
public static void addCrusherRecipe(String input, String outputOne, int outputOneAmount){
addCrusherRecipe(input, outputOne, outputOneAmount, "", 0, 0);
}
/**
* Adds a Recipe to the Crusher Recipe Registry
*
* @param input The input's OreDictionary name
* @param outputOne The first output's OreDictionary name
* @param outputOneAmount The amount of the first output
* @param outputTwo The second output's OreDictionary name
* @param outputTwoAmount The amount of the second output
* @param outputTwoChance The chance of the second output (0 won't occur at all, 100 will all the time)
*/
public static void addCrusherRecipe(String input, String outputOne, int outputOneAmount, String outputTwo, int outputTwoAmount, int outputTwoChance){
if(!OreDictionary.getOres(input, false).isEmpty() && !OreDictionary.getOres(outputOne, false).isEmpty() && (outputTwo == null || outputTwo.isEmpty() || !OreDictionary.getOres(outputTwo, false).isEmpty())){
2016-05-19 20:05:12 +02:00
CRUSHER_RECIPES.add(new CrusherRecipe(input, outputOne, outputOneAmount, outputTwo, outputTwoAmount, outputTwoChance));
2016-01-05 04:47:35 +01:00
}
}
/**
* Adds a Recipe to the Crusher Recipe Registry
* The second output will be nothing
*
* @param input The input as an ItemStack
* @param outputOne The first output as an ItemStack
*/
public static void addCrusherRecipe(ItemStack input, ItemStack outputOne){
addCrusherRecipe(input, outputOne, null, 0);
}
/**
* Adds a Recipe to the Crusher Recipe Registry
* The second output will be nothing
*
* @param input The input as an ItemStack
* @param outputOne The first output as an ItemStack
* @param outputTwo The second output as an ItemStack
* @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){
2016-05-19 20:05:12 +02:00
CRUSHER_RECIPES.add(new CrusherRecipe(input, outputOne, outputTwo, outputTwoChance));
2016-01-05 04:47:35 +01:00
}
/**
* Adds a Recipe to the Crusher Recipe Registry
* The second output will be nothing
*
* @param input The input as an ItemStack
* @param outputOne The first output's OreDictionary name
* @param outputOneAmount The amount of the first output
*/
public static void addCrusherRecipe(ItemStack input, String outputOne, int outputOneAmount){
if(!OreDictionary.getOres(outputOne, false).isEmpty()){
2016-05-19 20:05:12 +02:00
CRUSHER_RECIPES.add(new CrusherRecipe(input, outputOne, outputOneAmount));
2016-01-05 04:47:35 +01:00
}
}
/**
* Adds a new conversion recipe to the compost.
* StackSize is regarded on both input and output and they can be different.
*
2016-06-01 00:39:35 +02:00
* @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
*/
public static void addCompostRecipe(ItemStack input, Block inputDisplay, ItemStack output, Block outputDisplay){
COMPOST_RECIPES.add(new CompostRecipe(input, inputDisplay, output, outputDisplay));
}
2016-01-05 04:47:35 +01:00
/**
* 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){
2016-05-19 20:05:12 +02:00
BALL_OF_FUR_RETURN_ITEMS.add(new BallOfFurReturn(stack, chance));
2016-01-05 04:47:35 +01:00
}
/**
* 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){
2016-05-19 20:05:12 +02:00
TREASURE_CHEST_LOOT.add(new TreasureChestLoot(stack, chance, minAmount, maxAmount));
2016-01-05 04:47:35 +01:00
}
/**
2016-05-14 13:51:18 +02:00
* Adds a recipe to the Atomic Reconstructor conversion lenses
2016-01-05 04:47:35 +01:00
* 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.
2016-06-17 23:54:20 +02:00
* Note how this always has to be the same instance of the lens type that the item also has for it to work!
2016-01-05 04:47:35 +01:00
*/
public static void addReconstructorLensConversionRecipe(ItemStack input, ItemStack output, int energyUse, LensConversion type){
2016-05-19 20:05:12 +02:00
RECONSTRUCTOR_LENS_CONVERSION_RECIPES.add(new LensConversionRecipe(input, output, energyUse, type));
}
2016-05-14 13:51:18 +02:00
public static void addReconstructorLensConversionRecipe(ItemStack input, ItemStack output, int energyUse){
addReconstructorLensConversionRecipe(input, output, energyUse, lensDefaultConversion);
2016-01-05 04:47:35 +01:00
}
/**
2016-05-14 13:51:18 +02:00
* Adds a recipe to the Atomic Reconstructor conversion lenses
2016-01-05 04:47:35 +01:00
*
* @param input The input's OreDictionary name
* @param output The output's OreDictionary name
* @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
2016-06-17 23:54:20 +02:00
* Note how this always has to be the same instance of the lens type that the item also has for it to work!
2016-01-05 04:47:35 +01:00
*/
public static void addReconstructorLensConversionRecipe(String input, String output, int energyUse, LensConversion type){
2016-05-19 20:05:12 +02:00
RECONSTRUCTOR_LENS_CONVERSION_RECIPES.add(new LensConversionRecipe(input, output, energyUse, type));
}
2016-05-14 13:51:18 +02:00
public static void addReconstructorLensConversionRecipe(String input, String output, int energyUse){
addReconstructorLensConversionRecipe(input, output, energyUse, lensDefaultConversion);
2016-01-05 04:47:35 +01:00
}
/**
* 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.
2016-06-17 23:54:20 +02:00
* 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){
2016-05-19 20:05:12 +02:00
RECONSTRUCTOR_LENS_COLOR_CHANGERS.put(item, changer);
}
2016-01-05 04:47:35 +01:00
/**
* Adds an ingredient to the Coffee Machine ingredient list
2016-01-05 14:57:50 +01:00
*
2016-01-05 04:47:35 +01:00
* @param ingredient The ingredient to add
*/
public static void addCoffeeMachineIngredient(CoffeeIngredient ingredient){
2016-05-19 20:05:12 +02:00
COFFEE_MACHINE_INGREDIENTS.add(ingredient);
2016-01-05 04:47:35 +01:00
}
2016-01-05 14:57:50 +01:00
/**
* Adds a booklet entry to the list of entries
*
* @param entry The entry to add
*/
public static void addBookletEntry(IBookletEntry entry){
2016-05-19 20:05:12 +02:00
BOOKLET_ENTRIES.add(entry);
2016-01-05 14:57:50 +01:00
}
/**
* Adds a page to the pages with ItemStack data
* This should be done with every page that uses getItemStacksForPage()
*
* @param page The page to add
*/
public static void addPageWithItemStackData(BookletPage page){
2016-05-19 20:05:12 +02:00
BOOKLET_PAGES_WITH_ITEM_DATA.add(page);
2016-01-05 14:57:50 +01:00
}
2016-01-05 04:47:35 +01:00
}