Start on REI support, very basic right now, but it will help a lot when adding recipes.

This commit is contained in:
modmuss50 2019-07-25 13:14:46 +01:00
parent a80d2183f9
commit 52da17dfd5
6 changed files with 182 additions and 1 deletions

View file

@ -0,0 +1,49 @@
package techreborn.rei;
import me.shedaniel.rei.api.RecipeDisplay;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import reborncore.common.crafting.RebornIngredient;
import reborncore.common.crafting.RebornRecipe;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
public class MachineRecipeDisplay<R extends RebornRecipe> implements RecipeDisplay<R> {
private final R recipe;
private List<List<ItemStack>> inputs;
private List<ItemStack> outputs;
public MachineRecipeDisplay(R recipe) {
this.recipe = recipe;
this.inputs = recipe.getRebornIngredients().stream().map(RebornIngredient::getStacks).collect(Collectors.toList());
this.outputs = recipe.getOutputs();
}
@Override
public Optional<R> getRecipe() {
return Optional.ofNullable(recipe);
}
@Override
public List<List<ItemStack>> getInput() {
return inputs;
}
@Override
public List<List<ItemStack>> getRequiredItems() {
return inputs;
}
@Override
public List<ItemStack> getOutput() {
return outputs;
}
@Override
public Identifier getRecipeCategory() {
return recipe.getRebornRecipeType().getName();
}
}