Basic JEI integration is back
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
package appeng.recipes.handlers;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||
import net.minecraft.item.crafting.IRecipeType;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GrinderRecipe implements IRecipe<IInventory> {
|
||||
|
||||
public static IRecipeType<GrinderRecipe> TYPE;
|
||||
|
||||
private final ResourceLocation id;
|
||||
private final String group;
|
||||
private final Ingredient ingredient;
|
||||
private final ItemStack result;
|
||||
private final List<GrinderOptionalResult> optionalResults;
|
||||
private final int turns;
|
||||
|
||||
public GrinderRecipe(ResourceLocation id, String group, Ingredient ingredient, ItemStack result, int turns, List<GrinderOptionalResult> optionalResults) {
|
||||
this.id = id;
|
||||
this.group = group;
|
||||
this.ingredient = ingredient;
|
||||
this.result = result;
|
||||
this.turns = turns;
|
||||
this.optionalResults = ImmutableList.copyOf(optionalResults);
|
||||
}
|
||||
@Override
|
||||
public boolean matches(IInventory inv, World worldIn) {
|
||||
return this.ingredient.test(inv.getStackInSlot(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(IInventory inv) {
|
||||
// FIXME: What about secondary output
|
||||
return this.result.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFit(int width, int height) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeSerializer<?> getSerializer() {
|
||||
return GrinderRecipeSerializer.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeType<?> getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public Ingredient getIngredient() {
|
||||
return ingredient;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NonNullList<Ingredient> getIngredients() {
|
||||
NonNullList<Ingredient> nonnulllist = NonNullList.create();
|
||||
nonnulllist.add(this.ingredient);
|
||||
return nonnulllist;
|
||||
}
|
||||
|
||||
public List<GrinderOptionalResult> getOptionalResults() {
|
||||
return optionalResults;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user