Add StorageDrawer compat.

Adds feature #4558
NOTE: This is not needed in 1.12
This commit is contained in:
Tom Elfring committed 2017-07-24 20:04:54 +02:00
1 parent 77e46985ac
commit 10550f656a
44 files changed
+866

No files matched your search

@@ -16,6 +16,7 @@ import mekanism.common.Resource;
import mekanism.common.block.states.BlockStateTransmitter.TransmitterType;
import mekanism.common.integration.computer.CCPeripheral;
import mekanism.common.integration.computer.OCDriver;
import mekanism.common.integration.storagedrawer.StorageDrawerRecipeHandler;
import mekanism.common.recipe.RecipeHandler;
import mekanism.common.util.MekanismUtils;
import net.minecraft.init.Items;
@@ -78,6 +79,11 @@ public final class MekanismHooks
{
//loadMettallurgy();
}
if(Loader.isModLoaded("storagedrawers"))
{
StorageDrawerRecipeHandler.register();
}
}
@Method(modid = "IC2")
@@ -0,0 +1,55 @@
package mekanism.common.integration.storagedrawer;
import com.jaquadro.minecraft.storagedrawers.api.IStorageDrawersApi;
import com.jaquadro.minecraft.storagedrawers.api.StorageDrawersApi;
import com.jaquadro.minecraft.storagedrawers.api.registry.IRecipeHandler;
import com.jaquadro.minecraft.storagedrawers.api.registry.IRecipeHandlerRegistry;
import mekanism.common.recipe.ShapedMekanismRecipe;
import mekanism.common.recipe.ShapelessMekanismRecipe;
import net.minecraft.item.crafting.IRecipe;
import java.util.List;
public class StorageDrawerRecipeHandler
{
private StorageDrawerRecipeHandler(){}
public static void register()
{
IStorageDrawersApi api = StorageDrawersApi.instance();
if(api == null)
{
return;
}
IRecipeHandlerRegistry recipeHandlerRegistry = api.recipeHandlerRegistry();
recipeHandlerRegistry.registerRecipeHandler(ShapedMekanismRecipe.class, new ShapedMekanismRecipeHandler());
recipeHandlerRegistry.registerRecipeHandler(ShapelessMekanismRecipe.class, new ShapelessMekanismRecipeHandler());
}
private static class ShapedMekanismRecipeHandler implements IRecipeHandler
{
@Override
public Object[] getInputAsArray (IRecipe recipe) {
return ((ShapedMekanismRecipe) recipe).getInput();
}
@Override
public List getInputAsList (IRecipe recipe) {
return null;
}
}
private static class ShapelessMekanismRecipeHandler implements IRecipeHandler
{
@Override
public Object[] getInputAsArray (IRecipe recipe) {
return null;
}
@Override
public List getInputAsList (IRecipe recipe) {
return ((ShapelessMekanismRecipe) recipe).getInput();
}
}
}