Refactor machine ingredients
This commit is contained in:
parent
a7de6b428a
commit
0118d5a999
3 changed files with 10 additions and 10 deletions
|
@ -46,12 +46,6 @@ public class BlastFurnaceRecipe extends RebornRecipe {
|
|||
heat = JsonHelper.getInt(jsonObject, "heat");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(JsonObject jsonObject) {
|
||||
super.serialize(jsonObject);
|
||||
jsonObject.addProperty("heat", heat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCraft(final BlockEntity blockEntity) {
|
||||
if (blockEntity instanceof IndustrialBlastFurnaceBlockEntity) {
|
||||
|
|
|
@ -33,8 +33,9 @@ import reborncore.api.blockentity.InventoryProvider;
|
|||
import reborncore.client.containerBuilder.IContainerProvider;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
import reborncore.common.crafting.RebornIngredient;
|
||||
import reborncore.common.crafting.ingredient.RebornIngredient;
|
||||
import reborncore.common.crafting.RebornRecipe;
|
||||
import reborncore.common.crafting.ingredient.StackIngredient;
|
||||
import reborncore.common.registration.RebornRegister;
|
||||
import reborncore.common.blockentity.MachineBaseBlockEntity;
|
||||
import reborncore.common.util.RebornInventory;
|
||||
|
@ -43,6 +44,9 @@ import techreborn.init.ModRecipes;
|
|||
import techreborn.init.TRContent;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@RebornRegister(TechReborn.MOD_ID)
|
||||
public class IronAlloyFurnaceBlockEntity extends MachineBaseBlockEntity
|
||||
implements IToolDrop, InventoryProvider, IContainerProvider {
|
||||
|
@ -196,7 +200,9 @@ public class IronAlloyFurnaceBlockEntity extends MachineBaseBlockEntity
|
|||
for (RebornIngredient ingredient : recipeType.getRebornIngredients()) {
|
||||
for (int inputSlot = 0; inputSlot < 2; inputSlot++) {
|
||||
if (ingredient.test(this.inventory.getInvStack(inputSlot))) {
|
||||
inventory.shrinkSlot(inputSlot, ingredient.getSize());
|
||||
AtomicInteger count = new AtomicInteger(1);
|
||||
ingredient.ifType(StackIngredient.class, stackIngredient -> count.set(stackIngredient.getCount()));
|
||||
inventory.shrinkSlot(inputSlot, count.get());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ 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.ingredient.RebornIngredient;
|
||||
import reborncore.common.crafting.RebornRecipe;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -18,7 +18,7 @@ public class MachineRecipeDisplay<R extends RebornRecipe> implements RecipeDispl
|
|||
|
||||
public MachineRecipeDisplay(R recipe) {
|
||||
this.recipe = recipe;
|
||||
this.inputs = recipe.getRebornIngredients().stream().map(RebornIngredient::getStacks).collect(Collectors.toList());
|
||||
this.inputs = recipe.getRebornIngredients().stream().map(RebornIngredient::getPreviewStacks).collect(Collectors.toList());
|
||||
this.outputs = recipe.getOutputs();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue