Remove non API import

This commit is contained in:
Raoul Van den Berge
2016-06-23 01:45:06 +02:00
parent 800903b227
commit 2298908d66
6 changed files with 79 additions and 49 deletions

View File

@@ -0,0 +1,10 @@
package refinedstorage.api;
import refinedstorage.api.solderer.ISoldererRegistry;
public final class RefinedStorageAPI {
/**
* The solderer registry, set in pre initialization.
*/
public static ISoldererRegistry SOLDERER_REGISTRY;
}

View File

@@ -0,0 +1,31 @@
package refinedstorage.api.solderer;
import net.minecraftforge.items.IItemHandler;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;
/**
* The recipe registry of the solderer.
*/
public interface ISoldererRegistry {
/**
* Adds a recipe to the registry.
*
* @param recipe The recipe to add
*/
void addRecipe(@Nonnull ISoldererRecipe recipe);
/**
* @return A list with all the solderer recipes, do NOT modify
*/
List<ISoldererRecipe> getRecipes();
/**
* @param items An item handler, where slots 0 - 2 are the row slots
* @return The recipe, or null if no recipe was found
*/
@Nullable
ISoldererRecipe getRecipe(@Nonnull IItemHandler items);
}

View File

@@ -1,44 +1,31 @@
package refinedstorage.api.solderer; package refinedstorage.apiimpl.solderer;
import com.google.common.collect.ImmutableList;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
import refinedstorage.RefinedStorageUtils; import refinedstorage.RefinedStorageUtils;
import refinedstorage.api.solderer.ISoldererRecipe;
import refinedstorage.api.solderer.ISoldererRegistry;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
// @todo: Non API import public class SoldererRegistry implements ISoldererRegistry {
private List<ISoldererRecipe> recipes = new ArrayList<ISoldererRecipe>();
/** @Override
* The recipe registry of the solderer. public void addRecipe(@Nonnull ISoldererRecipe recipe) {
*/
public class SoldererRegistry {
private static List<ISoldererRecipe> recipes = new ArrayList<ISoldererRecipe>();
/**
* Adds a recipe to the registry.
*
* @param recipe The recipe to add
*/
public static void addRecipe(@Nonnull ISoldererRecipe recipe) {
recipes.add(recipe); recipes.add(recipe);
} }
/** @Override
* @return An immutable recipe list public List<ISoldererRecipe> getRecipes() {
*/ return recipes;
public static ImmutableList<ISoldererRecipe> getRecipes() {
return ImmutableList.copyOf(recipes);
} }
/** @Override
* @param items An item handler, where slots 0 - 2 are the row slots
* @return The recipe, or null if no recipe was found
*/
@Nullable @Nullable
public static ISoldererRecipe getRecipe(@Nonnull IItemHandler items) { public ISoldererRecipe getRecipe(@Nonnull IItemHandler items) {
for (ISoldererRecipe recipe : recipes) { for (ISoldererRecipe recipe : recipes) {
boolean found = true; boolean found = true;

View File

@@ -1,8 +1,8 @@
package refinedstorage.jei; package refinedstorage.jei;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import refinedstorage.api.RefinedStorageAPI;
import refinedstorage.api.solderer.ISoldererRecipe; import refinedstorage.api.solderer.ISoldererRecipe;
import refinedstorage.api.solderer.SoldererRegistry;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -11,7 +11,7 @@ public class SoldererRecipeMaker {
public static List<SoldererRecipeWrapper> getRecipes() { public static List<SoldererRecipeWrapper> getRecipes() {
List<SoldererRecipeWrapper> recipes = new ArrayList<SoldererRecipeWrapper>(); List<SoldererRecipeWrapper> recipes = new ArrayList<SoldererRecipeWrapper>();
for (ISoldererRecipe recipe : SoldererRegistry.getRecipes()) { for (ISoldererRecipe recipe : RefinedStorageAPI.SOLDERER_REGISTRY.getRecipes()) {
List<ItemStack> inputs = new ArrayList<ItemStack>(); List<ItemStack> inputs = new ArrayList<ItemStack>();
inputs.add(recipe.getRow(0)); inputs.add(recipe.getRow(0));

View File

@@ -17,7 +17,7 @@ import net.minecraftforge.oredict.ShapedOreRecipe;
import refinedstorage.RefinedStorage; import refinedstorage.RefinedStorage;
import refinedstorage.RefinedStorageBlocks; import refinedstorage.RefinedStorageBlocks;
import refinedstorage.RefinedStorageItems; import refinedstorage.RefinedStorageItems;
import refinedstorage.api.solderer.SoldererRegistry; import refinedstorage.api.RefinedStorageAPI;
import refinedstorage.apiimpl.network.NetworkMasterEventHandler; import refinedstorage.apiimpl.network.NetworkMasterEventHandler;
import refinedstorage.apiimpl.solderer.*; import refinedstorage.apiimpl.solderer.*;
import refinedstorage.apiimpl.storage.NBTStorage; import refinedstorage.apiimpl.storage.NBTStorage;
@@ -37,6 +37,8 @@ import static refinedstorage.RefinedStorage.ID;
public class CommonProxy { public class CommonProxy {
public void preInit(FMLPreInitializationEvent e) { public void preInit(FMLPreInitializationEvent e) {
RefinedStorageAPI.SOLDERER_REGISTRY = new SoldererRegistry();
int id = 0; int id = 0;
RefinedStorage.NETWORK.registerMessage(MessageTileContainerUpdate.class, MessageTileContainerUpdate.class, id++, Side.CLIENT); RefinedStorage.NETWORK.registerMessage(MessageTileContainerUpdate.class, MessageTileContainerUpdate.class, id++, Side.CLIENT);
@@ -113,14 +115,14 @@ public class CommonProxy {
OreDictionary.registerOre("itemSilicon", RefinedStorageItems.SILICON); OreDictionary.registerOre("itemSilicon", RefinedStorageItems.SILICON);
// Processors // Processors
SoldererRegistry.addRecipe(new SoldererRecipePrintedProcessor(ItemProcessor.TYPE_PRINTED_BASIC)); RefinedStorageAPI.SOLDERER_REGISTRY.addRecipe(new SoldererRecipePrintedProcessor(ItemProcessor.TYPE_PRINTED_BASIC));
SoldererRegistry.addRecipe(new SoldererRecipePrintedProcessor(ItemProcessor.TYPE_PRINTED_IMPROVED)); RefinedStorageAPI.SOLDERER_REGISTRY.addRecipe(new SoldererRecipePrintedProcessor(ItemProcessor.TYPE_PRINTED_IMPROVED));
SoldererRegistry.addRecipe(new SoldererRecipePrintedProcessor(ItemProcessor.TYPE_PRINTED_ADVANCED)); RefinedStorageAPI.SOLDERER_REGISTRY.addRecipe(new SoldererRecipePrintedProcessor(ItemProcessor.TYPE_PRINTED_ADVANCED));
SoldererRegistry.addRecipe(new SoldererRecipePrintedProcessor(ItemProcessor.TYPE_PRINTED_SILICON)); RefinedStorageAPI.SOLDERER_REGISTRY.addRecipe(new SoldererRecipePrintedProcessor(ItemProcessor.TYPE_PRINTED_SILICON));
SoldererRegistry.addRecipe(new SoldererRecipeProcessor(ItemProcessor.TYPE_BASIC)); RefinedStorageAPI.SOLDERER_REGISTRY.addRecipe(new SoldererRecipeProcessor(ItemProcessor.TYPE_BASIC));
SoldererRegistry.addRecipe(new SoldererRecipeProcessor(ItemProcessor.TYPE_IMPROVED)); RefinedStorageAPI.SOLDERER_REGISTRY.addRecipe(new SoldererRecipeProcessor(ItemProcessor.TYPE_IMPROVED));
SoldererRegistry.addRecipe(new SoldererRecipeProcessor(ItemProcessor.TYPE_ADVANCED)); RefinedStorageAPI.SOLDERER_REGISTRY.addRecipe(new SoldererRecipeProcessor(ItemProcessor.TYPE_ADVANCED));
// Silicon // Silicon
GameRegistry.addSmelting(Items.QUARTZ, new ItemStack(RefinedStorageItems.SILICON), 0.5f); GameRegistry.addSmelting(Items.QUARTZ, new ItemStack(RefinedStorageItems.SILICON), 0.5f);
@@ -191,7 +193,7 @@ public class CommonProxy {
); );
// Disk Drive // Disk Drive
SoldererRegistry.addRecipe(new SoldererRecipeBasic( RefinedStorageAPI.SOLDERER_REGISTRY.addRecipe(new SoldererRecipeBasic(
new ItemStack(RefinedStorageBlocks.DISK_DRIVE), new ItemStack(RefinedStorageBlocks.DISK_DRIVE),
500, 500,
new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED), new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
@@ -233,7 +235,7 @@ public class CommonProxy {
); );
// Crafting Grid // Crafting Grid
SoldererRegistry.addRecipe(new SoldererRecipeBasic( RefinedStorageAPI.SOLDERER_REGISTRY.addRecipe(new SoldererRecipeBasic(
new ItemStack(RefinedStorageBlocks.GRID, 1, EnumGridType.CRAFTING.getId()), new ItemStack(RefinedStorageBlocks.GRID, 1, EnumGridType.CRAFTING.getId()),
500, 500,
new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED), new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
@@ -242,7 +244,7 @@ public class CommonProxy {
)); ));
// Pattern Grid // Pattern Grid
SoldererRegistry.addRecipe(new SoldererRecipeBasic( RefinedStorageAPI.SOLDERER_REGISTRY.addRecipe(new SoldererRecipeBasic(
new ItemStack(RefinedStorageBlocks.GRID, 1, EnumGridType.PATTERN.getId()), new ItemStack(RefinedStorageBlocks.GRID, 1, EnumGridType.PATTERN.getId()),
500, 500,
new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED), new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
@@ -438,9 +440,9 @@ public class CommonProxy {
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON) 'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON)
); );
SoldererRegistry.addRecipe(new SoldererRecipeUpgrade(ItemUpgrade.TYPE_RANGE)); RefinedStorageAPI.SOLDERER_REGISTRY.addRecipe(new SoldererRecipeUpgrade(ItemUpgrade.TYPE_RANGE));
SoldererRegistry.addRecipe(new SoldererRecipeUpgrade(ItemUpgrade.TYPE_SPEED)); RefinedStorageAPI.SOLDERER_REGISTRY.addRecipe(new SoldererRecipeUpgrade(ItemUpgrade.TYPE_SPEED));
SoldererRegistry.addRecipe(new SoldererRecipeUpgrade(ItemUpgrade.TYPE_CRAFTING)); RefinedStorageAPI.SOLDERER_REGISTRY.addRecipe(new SoldererRecipeUpgrade(ItemUpgrade.TYPE_CRAFTING));
GameRegistry.addShapedRecipe(new ItemStack(RefinedStorageItems.UPGRADE, 1, ItemUpgrade.TYPE_STACK), GameRegistry.addShapedRecipe(new ItemStack(RefinedStorageItems.UPGRADE, 1, ItemUpgrade.TYPE_STACK),
"USU", "USU",
@@ -451,10 +453,10 @@ public class CommonProxy {
); );
// Storage Blocks // Storage Blocks
SoldererRegistry.addRecipe(new SoldererRecipeStorage(EnumStorageType.TYPE_1K, ItemStoragePart.TYPE_1K)); RefinedStorageAPI.SOLDERER_REGISTRY.addRecipe(new SoldererRecipeStorage(EnumStorageType.TYPE_1K, ItemStoragePart.TYPE_1K));
SoldererRegistry.addRecipe(new SoldererRecipeStorage(EnumStorageType.TYPE_4K, ItemStoragePart.TYPE_4K)); RefinedStorageAPI.SOLDERER_REGISTRY.addRecipe(new SoldererRecipeStorage(EnumStorageType.TYPE_4K, ItemStoragePart.TYPE_4K));
SoldererRegistry.addRecipe(new SoldererRecipeStorage(EnumStorageType.TYPE_16K, ItemStoragePart.TYPE_16K)); RefinedStorageAPI.SOLDERER_REGISTRY.addRecipe(new SoldererRecipeStorage(EnumStorageType.TYPE_16K, ItemStoragePart.TYPE_16K));
SoldererRegistry.addRecipe(new SoldererRecipeStorage(EnumStorageType.TYPE_64K, ItemStoragePart.TYPE_64K)); RefinedStorageAPI.SOLDERER_REGISTRY.addRecipe(new SoldererRecipeStorage(EnumStorageType.TYPE_64K, ItemStoragePart.TYPE_64K));
// Crafting Monitor // Crafting Monitor
GameRegistry.addRecipe(new ItemStack(RefinedStorageBlocks.CRAFTING_MONITOR), GameRegistry.addRecipe(new ItemStack(RefinedStorageBlocks.CRAFTING_MONITOR),
@@ -468,7 +470,7 @@ public class CommonProxy {
); );
// Interface // Interface
SoldererRegistry.addRecipe(new SoldererRecipeBasic( RefinedStorageAPI.SOLDERER_REGISTRY.addRecipe(new SoldererRecipeBasic(
new ItemStack(RefinedStorageBlocks.INTERFACE), new ItemStack(RefinedStorageBlocks.INTERFACE),
200, 200,
new ItemStack(RefinedStorageBlocks.IMPORTER), new ItemStack(RefinedStorageBlocks.IMPORTER),

View File

@@ -11,8 +11,8 @@ import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.wrapper.CombinedInvWrapper; import net.minecraftforge.items.wrapper.CombinedInvWrapper;
import refinedstorage.RefinedStorageItems; import refinedstorage.RefinedStorageItems;
import refinedstorage.RefinedStorageUtils; import refinedstorage.RefinedStorageUtils;
import refinedstorage.api.RefinedStorageAPI;
import refinedstorage.api.solderer.ISoldererRecipe; import refinedstorage.api.solderer.ISoldererRecipe;
import refinedstorage.api.solderer.SoldererRegistry;
import refinedstorage.container.ContainerSolderer; import refinedstorage.container.ContainerSolderer;
import refinedstorage.inventory.BasicItemHandler; import refinedstorage.inventory.BasicItemHandler;
import refinedstorage.inventory.BasicItemValidator; import refinedstorage.inventory.BasicItemValidator;
@@ -45,7 +45,7 @@ public class TileSolderer extends TileSlave {
if (items.getStackInSlot(1) == null && items.getStackInSlot(2) == null && items.getStackInSlot(3) == null) { if (items.getStackInSlot(1) == null && items.getStackInSlot(2) == null && items.getStackInSlot(3) == null) {
stop(); stop();
} else { } else {
ISoldererRecipe newRecipe = SoldererRegistry.getRecipe(items); ISoldererRecipe newRecipe = RefinedStorageAPI.SOLDERER_REGISTRY.getRecipe(items);
if (newRecipe == null) { if (newRecipe == null) {
stop(); stop();
@@ -112,7 +112,7 @@ public class TileSolderer extends TileSlave {
RefinedStorageUtils.readItems(items, 0, nbt); RefinedStorageUtils.readItems(items, 0, nbt);
RefinedStorageUtils.readItems(upgrades, 1, nbt); RefinedStorageUtils.readItems(upgrades, 1, nbt);
recipe = SoldererRegistry.getRecipe(items); recipe = RefinedStorageAPI.SOLDERER_REGISTRY.getRecipe(items);
if (nbt.hasKey(NBT_WORKING)) { if (nbt.hasKey(NBT_WORKING)) {
working = nbt.getBoolean(NBT_WORKING); working = nbt.getBoolean(NBT_WORKING);