TechReborn/1.11/jei/rollingMachine/RollingMachineRecipeWrapper.java

70 lines
2.3 KiB
Java
Raw Normal View History

2016-03-13 17:08:30 +01:00
package techreborn.compat.jei.rollingMachine;
2016-04-22 05:51:15 +02:00
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.IJeiHelpers;
2016-09-27 18:03:57 +02:00
import mezz.jei.api.ingredients.IIngredients;
2016-03-13 17:08:30 +01:00
import mezz.jei.api.recipe.BlankRecipeWrapper;
import mezz.jei.api.recipe.wrapper.ICraftingRecipeWrapper;
import mezz.jei.plugins.vanilla.crafting.ShapedOreRecipeWrapper;
import mezz.jei.plugins.vanilla.crafting.ShapedRecipesWrapper;
import mezz.jei.plugins.vanilla.crafting.ShapelessOreRecipeWrapper;
import mezz.jei.plugins.vanilla.crafting.ShapelessRecipesWrapper;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
2016-10-08 21:46:16 +02:00
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;
public class RollingMachineRecipeWrapper extends BlankRecipeWrapper implements ICraftingRecipeWrapper {
2016-03-13 17:08:30 +01:00
private final ICraftingRecipeWrapper baseRecipe;
2016-10-08 21:46:16 +02:00
public RollingMachineRecipeWrapper(ICraftingRecipeWrapper baseRecipe) {
2016-03-25 10:47:34 +01:00
this.baseRecipe = baseRecipe;
}
2016-03-13 17:08:30 +01:00
@Nullable
2016-10-08 21:46:16 +02:00
public static RollingMachineRecipeWrapper create(
@Nonnull
IJeiHelpers jeiHelpers, IRecipe baseRecipe) {
2016-04-22 05:51:15 +02:00
IGuiHelper guiHelper = jeiHelpers.getGuiHelper();
2016-03-13 17:08:30 +01:00
ICraftingRecipeWrapper recipeWrapper;
2016-10-08 21:46:16 +02:00
if (baseRecipe instanceof ShapelessRecipes) {
2016-04-22 05:51:15 +02:00
recipeWrapper = new ShapelessRecipesWrapper(guiHelper, (ShapelessRecipes) baseRecipe);
2016-10-08 21:46:16 +02:00
} else if (baseRecipe instanceof ShapedRecipes) {
2016-03-13 17:08:30 +01:00
recipeWrapper = new ShapedRecipesWrapper((ShapedRecipes) baseRecipe);
2016-10-08 21:46:16 +02:00
} else if (baseRecipe instanceof ShapedOreRecipe) {
2016-11-04 21:03:05 +01:00
recipeWrapper = new ShapedOreRecipeWrapper(jeiHelpers, (ShapedOreRecipe) baseRecipe);
2016-10-08 21:46:16 +02:00
} else if (baseRecipe instanceof ShapelessOreRecipe) {
2016-11-04 21:03:05 +01:00
recipeWrapper = new ShapelessOreRecipeWrapper(jeiHelpers, (ShapelessOreRecipe) baseRecipe);
2016-10-08 21:46:16 +02:00
} else {
2016-03-13 17:08:30 +01:00
return null;
}
return new RollingMachineRecipeWrapper(recipeWrapper);
}
2016-09-27 18:03:57 +02:00
@Override
2016-10-08 21:46:16 +02:00
public void getIngredients(
@Nonnull
IIngredients ingredients) {
2016-09-27 18:03:57 +02:00
baseRecipe.getIngredients(ingredients);
}
2016-03-13 17:08:30 +01:00
@Override
@Nonnull
2016-10-08 21:46:16 +02:00
public List getInputs() {
2016-03-13 17:08:30 +01:00
return baseRecipe.getInputs();
}
@Override
@Nonnull
2016-10-08 21:46:16 +02:00
public List<ItemStack> getOutputs() {
2016-03-13 17:08:30 +01:00
return baseRecipe.getOutputs();
}
}