mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-12-25 06:26:56 +01:00
More recipe Serializer changes
- added Interface IExtendedProcessingRecipe supporting requiredHeat, fluid inputs and fluid outputs - set Mixing recipes to use the extended serializer in AllRecipeTypes - removed constructor parameters specifying fluid usage in recipes that do not support fluids (and changed the ConversionRecipe JEI support class back) - cleaned up annotations, ordered AllRecipeType enum values and imports, reformatted recipe code
This commit is contained in:
parent
a73919357b
commit
02450bd2f7
11 changed files with 174 additions and 185 deletions
|
@ -1,7 +1,5 @@
|
||||||
package com.simibubi.create;
|
package com.simibubi.create;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
import com.simibubi.create.compat.jei.ConversionRecipe;
|
import com.simibubi.create.compat.jei.ConversionRecipe;
|
||||||
import com.simibubi.create.content.contraptions.components.crafter.MechanicalCraftingRecipe;
|
import com.simibubi.create.content.contraptions.components.crafter.MechanicalCraftingRecipe;
|
||||||
import com.simibubi.create.content.contraptions.components.crusher.CrushingRecipe;
|
import com.simibubi.create.content.contraptions.components.crusher.CrushingRecipe;
|
||||||
|
@ -12,11 +10,11 @@ import com.simibubi.create.content.contraptions.components.press.PressingRecipe;
|
||||||
import com.simibubi.create.content.contraptions.components.saw.CuttingRecipe;
|
import com.simibubi.create.content.contraptions.components.saw.CuttingRecipe;
|
||||||
import com.simibubi.create.content.contraptions.processing.ProcessingRecipe;
|
import com.simibubi.create.content.contraptions.processing.ProcessingRecipe;
|
||||||
import com.simibubi.create.content.contraptions.processing.ProcessingRecipeSerializer;
|
import com.simibubi.create.content.contraptions.processing.ProcessingRecipeSerializer;
|
||||||
|
import com.simibubi.create.content.contraptions.processing.ProcessingRecipeSerializer.IExtendedRecipeFactory;
|
||||||
import com.simibubi.create.content.contraptions.processing.ProcessingRecipeSerializer.IRecipeFactory;
|
import com.simibubi.create.content.contraptions.processing.ProcessingRecipeSerializer.IRecipeFactory;
|
||||||
import com.simibubi.create.content.curiosities.tools.SandPaperPolishingRecipe;
|
import com.simibubi.create.content.curiosities.tools.SandPaperPolishingRecipe;
|
||||||
import com.simibubi.create.content.curiosities.zapper.blockzapper.BlockzapperUpgradeRecipe;
|
import com.simibubi.create.content.curiosities.zapper.blockzapper.BlockzapperUpgradeRecipe;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
|
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
import net.minecraft.item.crafting.IRecipeSerializer;
|
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||||
|
@ -26,18 +24,20 @@ import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
import net.minecraftforge.event.RegistryEvent;
|
import net.minecraftforge.event.RegistryEvent;
|
||||||
|
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public enum AllRecipeTypes {
|
public enum AllRecipeTypes {
|
||||||
|
|
||||||
BLOCKZAPPER_UPGRADE(BlockzapperUpgradeRecipe.Serializer::new, IRecipeType.CRAFTING),
|
BLOCKZAPPER_UPGRADE(BlockzapperUpgradeRecipe.Serializer::new, IRecipeType.CRAFTING),
|
||||||
MECHANICAL_CRAFTING(MechanicalCraftingRecipe.Serializer::new),
|
|
||||||
CRUSHING(processingSerializer(CrushingRecipe::new)),
|
|
||||||
MILLING(processingSerializer(MillingRecipe::new)),
|
|
||||||
SPLASHING(processingSerializer(SplashingRecipe::new)),
|
|
||||||
PRESSING(processingSerializer(PressingRecipe::new)),
|
|
||||||
CUTTING(processingSerializer(CuttingRecipe::new)),
|
|
||||||
MIXING(processingSerializer(MixingRecipe::new)),
|
|
||||||
SANDPAPER_POLISHING(processingSerializer(SandPaperPolishingRecipe::new)),
|
|
||||||
CONVERSION(processingSerializer(ConversionRecipe::new)),
|
CONVERSION(processingSerializer(ConversionRecipe::new)),
|
||||||
|
CRUSHING(processingSerializer(CrushingRecipe::new)),
|
||||||
|
CUTTING(processingSerializer(CuttingRecipe::new)),
|
||||||
|
MECHANICAL_CRAFTING(MechanicalCraftingRecipe.Serializer::new),
|
||||||
|
MILLING(processingSerializer(MillingRecipe::new)),
|
||||||
|
MIXING(extendedProcessingSerializer(MixingRecipe::new)),
|
||||||
|
PRESSING(processingSerializer(PressingRecipe::new)),
|
||||||
|
SANDPAPER_POLISHING(processingSerializer(SandPaperPolishingRecipe::new)),
|
||||||
|
SPLASHING(processingSerializer(SplashingRecipe::new)),
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -45,11 +45,6 @@ public enum AllRecipeTypes {
|
||||||
public Supplier<IRecipeSerializer<?>> supplier;
|
public Supplier<IRecipeSerializer<?>> supplier;
|
||||||
public IRecipeType<? extends IRecipe<? extends IInventory>> type;
|
public IRecipeType<? extends IRecipe<? extends IInventory>> type;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public <T extends IRecipeType<?>> T getType() {
|
|
||||||
return (T) type;
|
|
||||||
}
|
|
||||||
|
|
||||||
AllRecipeTypes(Supplier<IRecipeSerializer<?>> supplier) {
|
AllRecipeTypes(Supplier<IRecipeSerializer<?>> supplier) {
|
||||||
this(supplier, null);
|
this(supplier, null);
|
||||||
}
|
}
|
||||||
|
@ -87,4 +82,13 @@ public enum AllRecipeTypes {
|
||||||
return () -> new ProcessingRecipeSerializer<>(factory);
|
return () -> new ProcessingRecipeSerializer<>(factory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Supplier<IRecipeSerializer<?>> extendedProcessingSerializer(
|
||||||
|
IExtendedRecipeFactory<? extends ProcessingRecipe<?>> factory) {
|
||||||
|
return () -> new ProcessingRecipeSerializer<>(factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public <T extends IRecipeType<?>> T getType() {
|
||||||
|
return (T) type;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.simibubi.create.compat.jei;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
import com.simibubi.create.AllRecipeTypes;
|
import com.simibubi.create.AllRecipeTypes;
|
||||||
|
@ -16,7 +15,6 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.Ingredient;
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
|
||||||
import net.minecraftforge.items.wrapper.RecipeWrapper;
|
import net.minecraftforge.items.wrapper.RecipeWrapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,8 +27,7 @@ import net.minecraftforge.items.wrapper.RecipeWrapper;
|
||||||
public class ConversionRecipe extends ProcessingRecipe<RecipeWrapper> {
|
public class ConversionRecipe extends ProcessingRecipe<RecipeWrapper> {
|
||||||
|
|
||||||
public ConversionRecipe(ResourceLocation id, String group, List<ProcessingIngredient> ingredients,
|
public ConversionRecipe(ResourceLocation id, String group, List<ProcessingIngredient> ingredients,
|
||||||
List<ProcessingOutput> results, int processingDuration, @Nullable List<FluidStack> fluidIngredients,
|
List<ProcessingOutput> results, int processingDuration) {
|
||||||
@Nullable List<FluidStack> fluidResults) {
|
|
||||||
super(AllRecipeTypes.CONVERSION, id, group, ingredients, results, processingDuration);
|
super(AllRecipeTypes.CONVERSION, id, group, ingredients, results, processingDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +42,7 @@ public class ConversionRecipe extends ProcessingRecipe<RecipeWrapper> {
|
||||||
|
|
||||||
public ConversionRecipe(ResourceLocation id, List<ProcessingIngredient> ingredients,
|
public ConversionRecipe(ResourceLocation id, List<ProcessingIngredient> ingredients,
|
||||||
List<ProcessingOutput> results) {
|
List<ProcessingOutput> results) {
|
||||||
this(id, "conversions", ingredients, results, -1, null, null);
|
this(id, "conversions", ingredients, results, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,21 +1,20 @@
|
||||||
package com.simibubi.create.content.contraptions.components.crusher;
|
package com.simibubi.create.content.contraptions.components.crusher;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.simibubi.create.AllRecipeTypes;
|
import com.simibubi.create.AllRecipeTypes;
|
||||||
import com.simibubi.create.content.contraptions.processing.ProcessingIngredient;
|
import com.simibubi.create.content.contraptions.processing.ProcessingIngredient;
|
||||||
import com.simibubi.create.content.contraptions.processing.ProcessingOutput;
|
import com.simibubi.create.content.contraptions.processing.ProcessingOutput;
|
||||||
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
|
||||||
import net.minecraftforge.items.wrapper.RecipeWrapper;
|
import net.minecraftforge.items.wrapper.RecipeWrapper;
|
||||||
|
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class CrushingRecipe extends AbstractCrushingRecipe {
|
public class CrushingRecipe extends AbstractCrushingRecipe {
|
||||||
|
|
||||||
public CrushingRecipe(ResourceLocation id, String group, List<ProcessingIngredient> ingredients,
|
public CrushingRecipe(ResourceLocation id, String group, List<ProcessingIngredient> ingredients,
|
||||||
List<ProcessingOutput> results, int processingDuration, List<FluidStack> fluidIngredients,
|
List<ProcessingOutput> results, int processingDuration) {
|
||||||
List<FluidStack> fluidResults) {
|
|
||||||
super(AllRecipeTypes.CRUSHING, id, group, ingredients, results, processingDuration);
|
super(AllRecipeTypes.CRUSHING, id, group, ingredients, results, processingDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,26 +1,22 @@
|
||||||
package com.simibubi.create.content.contraptions.components.fan;
|
package com.simibubi.create.content.contraptions.components.fan;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.simibubi.create.AllRecipeTypes;
|
import com.simibubi.create.AllRecipeTypes;
|
||||||
import com.simibubi.create.content.contraptions.processing.ProcessingIngredient;
|
import com.simibubi.create.content.contraptions.processing.ProcessingIngredient;
|
||||||
import com.simibubi.create.content.contraptions.processing.ProcessingOutput;
|
import com.simibubi.create.content.contraptions.processing.ProcessingOutput;
|
||||||
import com.simibubi.create.content.contraptions.processing.ProcessingRecipe;
|
import com.simibubi.create.content.contraptions.processing.ProcessingRecipe;
|
||||||
import com.simibubi.create.content.logistics.InWorldProcessing;
|
import com.simibubi.create.content.logistics.InWorldProcessing;
|
||||||
import com.simibubi.create.content.logistics.InWorldProcessing.SplashingInv;
|
import com.simibubi.create.content.logistics.InWorldProcessing.SplashingInv;
|
||||||
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
|
||||||
|
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@ParametersAreNonnullByDefault
|
@ParametersAreNonnullByDefault
|
||||||
public class SplashingRecipe extends ProcessingRecipe<InWorldProcessing.SplashingInv> {
|
public class SplashingRecipe extends ProcessingRecipe<InWorldProcessing.SplashingInv> {
|
||||||
|
|
||||||
public SplashingRecipe(ResourceLocation id, String group, List<ProcessingIngredient> ingredients,
|
public SplashingRecipe(ResourceLocation id, String group, List<ProcessingIngredient> ingredients,
|
||||||
List<ProcessingOutput> results, int processingDuration, List<FluidStack> fluidIngredients,
|
List<ProcessingOutput> results, int processingDuration) {
|
||||||
List<FluidStack> fluidResults) {
|
|
||||||
super(AllRecipeTypes.SPLASHING, id, group, ingredients, results, processingDuration);
|
super(AllRecipeTypes.SPLASHING, id, group, ingredients, results, processingDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,25 +1,21 @@
|
||||||
package com.simibubi.create.content.contraptions.components.millstone;
|
package com.simibubi.create.content.contraptions.components.millstone;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.simibubi.create.AllRecipeTypes;
|
import com.simibubi.create.AllRecipeTypes;
|
||||||
import com.simibubi.create.content.contraptions.components.crusher.AbstractCrushingRecipe;
|
import com.simibubi.create.content.contraptions.components.crusher.AbstractCrushingRecipe;
|
||||||
import com.simibubi.create.content.contraptions.processing.ProcessingIngredient;
|
import com.simibubi.create.content.contraptions.processing.ProcessingIngredient;
|
||||||
import com.simibubi.create.content.contraptions.processing.ProcessingOutput;
|
import com.simibubi.create.content.contraptions.processing.ProcessingOutput;
|
||||||
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
|
||||||
import net.minecraftforge.items.wrapper.RecipeWrapper;
|
import net.minecraftforge.items.wrapper.RecipeWrapper;
|
||||||
|
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@ParametersAreNonnullByDefault
|
@ParametersAreNonnullByDefault
|
||||||
public class MillingRecipe extends AbstractCrushingRecipe {
|
public class MillingRecipe extends AbstractCrushingRecipe {
|
||||||
|
|
||||||
public MillingRecipe(ResourceLocation id, String group, List<ProcessingIngredient> ingredients,
|
public MillingRecipe(ResourceLocation id, String group, List<ProcessingIngredient> ingredients,
|
||||||
List<ProcessingOutput> results, int processingDuration, List<FluidStack> fluidIngredients,
|
List<ProcessingOutput> results, int processingDuration) {
|
||||||
List<FluidStack> fluidResults) {
|
|
||||||
super(AllRecipeTypes.MILLING, id, group, ingredients, results, processingDuration);
|
super(AllRecipeTypes.MILLING, id, group, ingredients, results, processingDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,5 +31,4 @@ public class MillingRecipe extends AbstractCrushingRecipe {
|
||||||
protected int getMaxOutputCount() {
|
protected int getMaxOutputCount() {
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,11 @@
|
||||||
package com.simibubi.create.content.contraptions.components.mixer;
|
package com.simibubi.create.content.contraptions.components.mixer;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
|
|
||||||
import com.simibubi.create.AllRecipeTypes;
|
import com.simibubi.create.AllRecipeTypes;
|
||||||
import com.simibubi.create.content.contraptions.processing.BasinTileEntity.BasinInputInventory;
|
import com.simibubi.create.content.contraptions.processing.BasinTileEntity.BasinInputInventory;
|
||||||
import com.simibubi.create.content.contraptions.processing.ProcessingIngredient;
|
import com.simibubi.create.content.contraptions.processing.ProcessingIngredient;
|
||||||
import com.simibubi.create.content.contraptions.processing.ProcessingOutput;
|
import com.simibubi.create.content.contraptions.processing.ProcessingOutput;
|
||||||
import com.simibubi.create.content.contraptions.processing.ProcessingRecipe;
|
import com.simibubi.create.content.contraptions.processing.ProcessingRecipe;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
import net.minecraft.item.crafting.Ingredient;
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
|
@ -23,82 +14,86 @@ import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
public class MixingRecipe extends ProcessingRecipe<BasinInputInventory> {
|
public class MixingRecipe extends ProcessingRecipe<BasinInputInventory> {
|
||||||
|
|
||||||
public MixingRecipe(ResourceLocation id, String group, List<ProcessingIngredient> ingredients,
|
public MixingRecipe(ResourceLocation id, String group, List<ProcessingIngredient> ingredients,
|
||||||
List<ProcessingOutput> results, int processingDuration) {
|
List<ProcessingOutput> results, int processingDuration, List<FluidStack> fluidIngredients,
|
||||||
super(AllRecipeTypes.MIXING, id, group, ingredients, results, processingDuration);
|
List<FluidStack> fluidResults, int requiredHeat) {
|
||||||
}
|
super(AllRecipeTypes.MIXING, id, group, ingredients, results, processingDuration, fluidIngredients,
|
||||||
|
fluidResults, requiredHeat);
|
||||||
|
}
|
||||||
|
|
||||||
public MixingRecipe(ResourceLocation id, String group, List<ProcessingIngredient> ingredients,
|
public static MixingRecipe of(IRecipe<?> recipe) {
|
||||||
List<ProcessingOutput> results, int processingDuration, List<FluidStack> fluidIngredients,
|
return new MixingRecipe(recipe.getId(), recipe.getGroup(), ProcessingIngredient.list(recipe.getIngredients()),
|
||||||
List<FluidStack> fluidResults) {
|
Collections.singletonList(new ProcessingOutput(recipe.getRecipeOutput(), 1)), -1, null, null, 0);
|
||||||
super(AllRecipeTypes.MIXING, id, group, ingredients, results, processingDuration, fluidIngredients,
|
}
|
||||||
fluidResults);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getMaxInputCount() {
|
protected int getMaxInputCount() {
|
||||||
return 9;
|
return 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getMaxOutputCount() {
|
protected int getMaxOutputCount() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean canHaveCatalysts() {
|
protected boolean canHaveCatalysts() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(BasinInputInventory inv, @Nonnull World worldIn) {
|
public boolean matches(BasinInputInventory inv, @Nonnull World worldIn) {
|
||||||
if (inv.isEmpty())
|
if (inv.isEmpty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
NonNullList<Ingredient> ingredients = this.getIngredients();
|
NonNullList<Ingredient> ingredients = this.getIngredients();
|
||||||
if (!ingredients.stream()
|
if (!ingredients.stream()
|
||||||
.allMatch(Ingredient::isSimple))
|
.allMatch(Ingredient::isSimple))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
List<ItemStack> remaining = new ArrayList<>();
|
List<ItemStack> remaining = new ArrayList<>();
|
||||||
for (int slot = 0; slot < inv.getSizeInventory(); ++slot) {
|
for (int slot = 0; slot < inv.getSizeInventory(); ++slot) {
|
||||||
ItemStack itemstack = inv.getStackInSlot(slot);
|
ItemStack itemstack = inv.getStackInSlot(slot);
|
||||||
if (!itemstack.isEmpty()) {
|
if (!itemstack.isEmpty()) {
|
||||||
remaining.add(itemstack.copy());
|
remaining.add(itemstack.copy());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// sort by leniency
|
// sort by leniency
|
||||||
List<Ingredient> sortedIngredients = new LinkedList<>(ingredients);
|
List<Ingredient> sortedIngredients = new LinkedList<>(ingredients);
|
||||||
sortedIngredients.sort(Comparator.comparingInt(i -> i.getMatchingStacks().length));
|
sortedIngredients.sort(Comparator.comparingInt(i -> i.getMatchingStacks().length));
|
||||||
Ingredients: for (Ingredient ingredient : sortedIngredients) {
|
Ingredients:
|
||||||
for (ItemStack stack : remaining) {
|
for (Ingredient ingredient : sortedIngredients) {
|
||||||
if (stack.isEmpty())
|
for (ItemStack stack : remaining) {
|
||||||
continue;
|
if (stack.isEmpty())
|
||||||
if (ingredient.test(stack)) {
|
continue;
|
||||||
stack.shrink(1);
|
if (ingredient.test(stack)) {
|
||||||
continue Ingredients;
|
stack.shrink(1);
|
||||||
}
|
continue Ingredients;
|
||||||
}
|
}
|
||||||
return false;
|
}
|
||||||
}
|
return false;
|
||||||
return true;
|
}
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public static MixingRecipe of(IRecipe<?> recipe) {
|
@Override
|
||||||
return new MixingRecipe(recipe.getId(), recipe.getGroup(), ProcessingIngredient.list(recipe.getIngredients()),
|
protected boolean canHaveFluidIngredient() {
|
||||||
Collections.singletonList(new ProcessingOutput(recipe.getRecipeOutput(), 1)), -1);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean canHaveFluidIngredient() {
|
protected boolean canHaveFluidOutput() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean canHaveFluidOutput() {
|
protected boolean requiresHeating() {
|
||||||
return true;
|
return this.requiredHeat > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +1,21 @@
|
||||||
package com.simibubi.create.content.contraptions.components.press;
|
package com.simibubi.create.content.contraptions.components.press;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.simibubi.create.AllRecipeTypes;
|
import com.simibubi.create.AllRecipeTypes;
|
||||||
import com.simibubi.create.content.contraptions.components.press.MechanicalPressTileEntity.PressingInv;
|
import com.simibubi.create.content.contraptions.components.press.MechanicalPressTileEntity.PressingInv;
|
||||||
import com.simibubi.create.content.contraptions.processing.ProcessingIngredient;
|
import com.simibubi.create.content.contraptions.processing.ProcessingIngredient;
|
||||||
import com.simibubi.create.content.contraptions.processing.ProcessingOutput;
|
import com.simibubi.create.content.contraptions.processing.ProcessingOutput;
|
||||||
import com.simibubi.create.content.contraptions.processing.ProcessingRecipe;
|
import com.simibubi.create.content.contraptions.processing.ProcessingRecipe;
|
||||||
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
|
||||||
|
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@ParametersAreNonnullByDefault
|
@ParametersAreNonnullByDefault
|
||||||
public class PressingRecipe extends ProcessingRecipe<MechanicalPressTileEntity.PressingInv> {
|
public class PressingRecipe extends ProcessingRecipe<MechanicalPressTileEntity.PressingInv> {
|
||||||
|
|
||||||
public PressingRecipe(ResourceLocation id, String group, List<ProcessingIngredient> ingredients,
|
public PressingRecipe(ResourceLocation id, String group, List<ProcessingIngredient> ingredients,
|
||||||
List<ProcessingOutput> results, int processingDuration, List<FluidStack> fluidIngredients,
|
List<ProcessingOutput> results, int processingDuration) {
|
||||||
List<FluidStack> fluidResults) {
|
|
||||||
super(AllRecipeTypes.PRESSING, id, group, ingredients, results, processingDuration);
|
super(AllRecipeTypes.PRESSING, id, group, ingredients, results, processingDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,25 +1,21 @@
|
||||||
package com.simibubi.create.content.contraptions.components.saw;
|
package com.simibubi.create.content.contraptions.components.saw;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.simibubi.create.AllRecipeTypes;
|
import com.simibubi.create.AllRecipeTypes;
|
||||||
import com.simibubi.create.content.contraptions.processing.ProcessingIngredient;
|
import com.simibubi.create.content.contraptions.processing.ProcessingIngredient;
|
||||||
import com.simibubi.create.content.contraptions.processing.ProcessingOutput;
|
import com.simibubi.create.content.contraptions.processing.ProcessingOutput;
|
||||||
import com.simibubi.create.content.contraptions.processing.ProcessingRecipe;
|
import com.simibubi.create.content.contraptions.processing.ProcessingRecipe;
|
||||||
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
|
||||||
import net.minecraftforge.items.wrapper.RecipeWrapper;
|
import net.minecraftforge.items.wrapper.RecipeWrapper;
|
||||||
|
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@ParametersAreNonnullByDefault
|
@ParametersAreNonnullByDefault
|
||||||
public class CuttingRecipe extends ProcessingRecipe<RecipeWrapper> {
|
public class CuttingRecipe extends ProcessingRecipe<RecipeWrapper> {
|
||||||
|
|
||||||
public CuttingRecipe(ResourceLocation id, String group, List<ProcessingIngredient> ingredients,
|
public CuttingRecipe(ResourceLocation id, String group, List<ProcessingIngredient> ingredients,
|
||||||
List<ProcessingOutput> results, int processingDuration, List<FluidStack> fluidIngredients,
|
List<ProcessingOutput> results, int processingDuration) {
|
||||||
List<FluidStack> fluidResults) {
|
|
||||||
super(AllRecipeTypes.CUTTING, id, group, ingredients, results, processingDuration);
|
super(AllRecipeTypes.CUTTING, id, group, ingredients, results, processingDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
package com.simibubi.create.content.contraptions.processing;
|
package com.simibubi.create.content.contraptions.processing;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import com.simibubi.create.AllRecipeTypes;
|
import com.simibubi.create.AllRecipeTypes;
|
||||||
import com.simibubi.create.Create;
|
import com.simibubi.create.Create;
|
||||||
|
|
||||||
import mcp.MethodsReturnNonnullByDefault;
|
import mcp.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -19,37 +15,31 @@ import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@MethodsReturnNonnullByDefault
|
@MethodsReturnNonnullByDefault
|
||||||
@ParametersAreNonnullByDefault
|
@ParametersAreNonnullByDefault
|
||||||
public abstract class ProcessingRecipe<T extends IInventory> implements IRecipe<T> {
|
public abstract class ProcessingRecipe<T extends IInventory> implements IRecipe<T> {
|
||||||
protected final List<ProcessingIngredient> ingredients;
|
protected final List<ProcessingIngredient> ingredients;
|
||||||
private final List<ProcessingOutput> results;
|
|
||||||
private final IRecipeType<?> type;
|
|
||||||
private final IRecipeSerializer<?> serializer;
|
|
||||||
protected final ResourceLocation id;
|
protected final ResourceLocation id;
|
||||||
protected final String group;
|
protected final String group;
|
||||||
protected final int processingDuration;
|
protected final int processingDuration;
|
||||||
protected final List<FluidStack> fluidIngredients;
|
protected final List<FluidStack> fluidIngredients;
|
||||||
protected final List<FluidStack> fluidResults;
|
protected final List<FluidStack> fluidResults;
|
||||||
|
protected final int requiredHeat;
|
||||||
|
private final List<ProcessingOutput> results;
|
||||||
|
private final IRecipeType<?> type;
|
||||||
|
private final IRecipeSerializer<?> serializer;
|
||||||
|
|
||||||
public ProcessingRecipe(AllRecipeTypes recipeType, ResourceLocation id, String group,
|
public ProcessingRecipe(AllRecipeTypes recipeType, ResourceLocation id, String group,
|
||||||
List<ProcessingIngredient> ingredients, List<ProcessingOutput> results, int processingDuration) {
|
List<ProcessingIngredient> ingredients, List<ProcessingOutput> results, int processingDuration) {
|
||||||
this.type = recipeType.type;
|
this(recipeType, id, group, ingredients, results, processingDuration, null, null, 0);
|
||||||
this.serializer = recipeType.serializer;
|
|
||||||
this.id = id;
|
|
||||||
this.group = group;
|
|
||||||
this.ingredients = ingredients;
|
|
||||||
this.results = results;
|
|
||||||
this.processingDuration = processingDuration;
|
|
||||||
this.fluidIngredients = null;
|
|
||||||
this.fluidResults = null;
|
|
||||||
validate(recipeType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProcessingRecipe(AllRecipeTypes recipeType, ResourceLocation id, String group,
|
public ProcessingRecipe(AllRecipeTypes recipeType, ResourceLocation id, String group,
|
||||||
List<ProcessingIngredient> ingredients, List<ProcessingOutput> results, int processingDuration,
|
List<ProcessingIngredient> ingredients, List<ProcessingOutput> results, int processingDuration,
|
||||||
@Nullable List<FluidStack> fluidIngredients, @Nullable List<FluidStack> fluidResults) {
|
@Nullable List<FluidStack> fluidIngredients, @Nullable List<FluidStack> fluidResults, int requiredHeat) {
|
||||||
this.type = recipeType.type;
|
this.type = recipeType.type;
|
||||||
this.serializer = recipeType.serializer;
|
this.serializer = recipeType.serializer;
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
@ -59,6 +49,7 @@ public abstract class ProcessingRecipe<T extends IInventory> implements IRecipe<
|
||||||
this.processingDuration = processingDuration;
|
this.processingDuration = processingDuration;
|
||||||
this.fluidIngredients = fluidIngredients;
|
this.fluidIngredients = fluidIngredients;
|
||||||
this.fluidResults = fluidResults;
|
this.fluidResults = fluidResults;
|
||||||
|
this.requiredHeat = requiredHeat;
|
||||||
validate(recipeType);
|
validate(recipeType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,4 +158,8 @@ public abstract class ProcessingRecipe<T extends IInventory> implements IRecipe<
|
||||||
protected boolean canHaveFluidOutput() {
|
protected boolean canHaveFluidOutput() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean requiresHeating() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
package com.simibubi.create.content.contraptions.processing;
|
package com.simibubi.create.content.contraptions.processing;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
import mcp.MethodsReturnNonnullByDefault;
|
import mcp.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.fluid.Fluid;
|
import net.minecraft.fluid.Fluid;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -17,7 +13,10 @@ import net.minecraft.util.registry.Registry;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@MethodsReturnNonnullByDefault
|
@MethodsReturnNonnullByDefault
|
||||||
@ParametersAreNonnullByDefault
|
@ParametersAreNonnullByDefault
|
||||||
|
@ -39,18 +38,11 @@ public class ProcessingRecipeSerializer<T extends ProcessingRecipe<?>>
|
||||||
for (JsonElement e : JSONUtils.getJsonArray(json, "ingredients")) {
|
for (JsonElement e : JSONUtils.getJsonArray(json, "ingredients")) {
|
||||||
JsonObject entry = e.getAsJsonObject();
|
JsonObject entry = e.getAsJsonObject();
|
||||||
if (JSONUtils.hasField(entry, "fluid")) {
|
if (JSONUtils.hasField(entry, "fluid")) {
|
||||||
Fluid fluid = ForgeRegistries.FLUIDS
|
addFluidToList(fluidIngredients, entry);
|
||||||
.getValue(ResourceLocation.tryCreate(JSONUtils.getString(entry.get("fluid"), "fluid")));
|
|
||||||
int amount = 1;
|
|
||||||
if (JSONUtils.hasField((JsonObject) e, "amount")) {
|
|
||||||
amount = JSONUtils.getInt(entry.get("amount"), "amount");
|
|
||||||
}
|
|
||||||
if (fluid != null && amount > 0)
|
|
||||||
fluidIngredients.add(new FluidStack(fluid, amount));
|
|
||||||
} else {
|
} else {
|
||||||
int count = 1;
|
int count = 1;
|
||||||
if (JSONUtils.hasField((JsonObject) e, "count")) {
|
if (JSONUtils.hasField(entry, "count")) {
|
||||||
count = JSONUtils.getInt(entry.get("count"), "count");
|
count = JSONUtils.getInt(entry, "count");
|
||||||
}
|
}
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
ingredients.add(ProcessingIngredient.parse(entry));
|
ingredients.add(ProcessingIngredient.parse(entry));
|
||||||
|
@ -63,20 +55,13 @@ public class ProcessingRecipeSerializer<T extends ProcessingRecipe<?>>
|
||||||
for (JsonElement e : JSONUtils.getJsonArray(json, "results")) {
|
for (JsonElement e : JSONUtils.getJsonArray(json, "results")) {
|
||||||
JsonObject entry = e.getAsJsonObject();
|
JsonObject entry = e.getAsJsonObject();
|
||||||
if (JSONUtils.hasField(entry, "fluid")) {
|
if (JSONUtils.hasField(entry, "fluid")) {
|
||||||
Fluid fluid = ForgeRegistries.FLUIDS
|
addFluidToList(fluidResults, entry);
|
||||||
.getValue(ResourceLocation.tryCreate(JSONUtils.getString(entry.get("fluid"), "fluid")));
|
|
||||||
int amount = 1;
|
|
||||||
if (JSONUtils.hasField((JsonObject) e, "amount")) {
|
|
||||||
amount = JSONUtils.getInt(entry.get("amount"), "amount");
|
|
||||||
}
|
|
||||||
if (fluid != null && amount > 0)
|
|
||||||
fluidResults.add(new FluidStack(fluid, amount));
|
|
||||||
} else {
|
} else {
|
||||||
String s1 = JSONUtils.getString(entry.get("item"), "item");
|
String s1 = JSONUtils.getString(entry, "item");
|
||||||
int i = JSONUtils.getInt(entry.get("count"), "count");
|
int i = JSONUtils.getInt(entry, "count");
|
||||||
float chance = 1;
|
float chance = 1;
|
||||||
if (JSONUtils.hasField((JsonObject) e, "chance"))
|
if (JSONUtils.hasField(entry, "chance"))
|
||||||
chance = JSONUtils.getFloat(entry.get("chance"), "chance");
|
chance = JSONUtils.getFloat(entry, "chance");
|
||||||
ItemStack itemstack = new ItemStack(Registry.ITEM.getOrDefault(new ResourceLocation(s1)), i);
|
ItemStack itemstack = new ItemStack(Registry.ITEM.getOrDefault(new ResourceLocation(s1)), i);
|
||||||
results.add(new ProcessingOutput(itemstack, chance));
|
results.add(new ProcessingOutput(itemstack, chance));
|
||||||
}
|
}
|
||||||
|
@ -86,7 +71,22 @@ public class ProcessingRecipeSerializer<T extends ProcessingRecipe<?>>
|
||||||
if (JSONUtils.hasField(json, "processingTime"))
|
if (JSONUtils.hasField(json, "processingTime"))
|
||||||
duration = JSONUtils.getInt(json, "processingTime");
|
duration = JSONUtils.getInt(json, "processingTime");
|
||||||
|
|
||||||
return this.factory.create(recipeId, s, ingredients, results, duration, fluidIngredients, fluidResults);
|
int requiredHeat = 0;
|
||||||
|
if (JSONUtils.hasField(json, "requiredHeat"))
|
||||||
|
requiredHeat = JSONUtils.getInt(json, "requiredHeat");
|
||||||
|
|
||||||
|
return this.factory.create(recipeId, s, ingredients, results, duration, fluidIngredients, fluidResults,
|
||||||
|
requiredHeat);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addFluidToList(List<FluidStack> fluidStacks, JsonObject entry) {
|
||||||
|
Fluid fluid = ForgeRegistries.FLUIDS.getValue(ResourceLocation.tryCreate(JSONUtils.getString(entry, "fluid")));
|
||||||
|
int amount = 1;
|
||||||
|
if (JSONUtils.hasField(entry, "amount")) {
|
||||||
|
amount = JSONUtils.getInt(entry, "amount");
|
||||||
|
}
|
||||||
|
if (fluid != null && amount > 0)
|
||||||
|
fluidStacks.add(new FluidStack(fluid, amount));
|
||||||
}
|
}
|
||||||
|
|
||||||
public T read(ResourceLocation recipeId, PacketBuffer buffer) {
|
public T read(ResourceLocation recipeId, PacketBuffer buffer) {
|
||||||
|
@ -113,8 +113,10 @@ public class ProcessingRecipeSerializer<T extends ProcessingRecipe<?>>
|
||||||
fluidResults.add(FluidStack.readFromPacket(buffer));
|
fluidResults.add(FluidStack.readFromPacket(buffer));
|
||||||
|
|
||||||
int duration = buffer.readInt();
|
int duration = buffer.readInt();
|
||||||
|
int requiredHeat = buffer.readInt();
|
||||||
|
|
||||||
return this.factory.create(recipeId, s, ingredients, results, duration, fluidIngredients, fluidResults);
|
return this.factory.create(recipeId, s, ingredients, results, duration, fluidIngredients, fluidResults,
|
||||||
|
requiredHeat);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void write(PacketBuffer buffer, T recipe) {
|
public void write(PacketBuffer buffer, T recipe) {
|
||||||
|
@ -141,12 +143,30 @@ public class ProcessingRecipeSerializer<T extends ProcessingRecipe<?>>
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer.writeInt(recipe.processingDuration);
|
buffer.writeInt(recipe.processingDuration);
|
||||||
|
buffer.writeInt(recipe.requiredHeat);
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IRecipeFactory<T extends ProcessingRecipe<?>> {
|
public interface IRecipeFactory<T extends ProcessingRecipe<?>> {
|
||||||
|
default T create(ResourceLocation recipeId, String s, List<ProcessingIngredient> ingredients,
|
||||||
|
List<ProcessingOutput> results, int duration, @Nullable List<FluidStack> fluidIngredients,
|
||||||
|
@Nullable List<FluidStack> fluidResults, int requiredHeat) {
|
||||||
|
return create(recipeId, s, ingredients, results, duration);
|
||||||
|
}
|
||||||
|
|
||||||
T create(ResourceLocation recipeId, String s, List<ProcessingIngredient> ingredients,
|
T create(ResourceLocation recipeId, String s, List<ProcessingIngredient> ingredients,
|
||||||
List<ProcessingOutput> results, int duration, List<FluidStack> fluidIngredients,
|
List<ProcessingOutput> results, int duration);
|
||||||
List<FluidStack> fluidResults);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface IExtendedRecipeFactory<T extends ProcessingRecipe<?>> extends IRecipeFactory<T> {
|
||||||
|
@Override
|
||||||
|
T create(ResourceLocation recipeId, String s, List<ProcessingIngredient> ingredients,
|
||||||
|
List<ProcessingOutput> results, int duration, @Nullable List<FluidStack> fluidIngredients,
|
||||||
|
@Nullable List<FluidStack> fluidResults, int requiredHeat);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
default T create(ResourceLocation recipeId, String s, List<ProcessingIngredient> ingredients,
|
||||||
|
List<ProcessingOutput> results, int duration) {
|
||||||
|
throw new IllegalStateException("Incorrect recipe creation function used: " + recipeId);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,30 +1,26 @@
|
||||||
package com.simibubi.create.content.curiosities.tools;
|
package com.simibubi.create.content.curiosities.tools;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.simibubi.create.AllRecipeTypes;
|
import com.simibubi.create.AllRecipeTypes;
|
||||||
import com.simibubi.create.content.contraptions.processing.ProcessingIngredient;
|
import com.simibubi.create.content.contraptions.processing.ProcessingIngredient;
|
||||||
import com.simibubi.create.content.contraptions.processing.ProcessingOutput;
|
import com.simibubi.create.content.contraptions.processing.ProcessingOutput;
|
||||||
import com.simibubi.create.content.contraptions.processing.ProcessingRecipe;
|
import com.simibubi.create.content.contraptions.processing.ProcessingRecipe;
|
||||||
import com.simibubi.create.content.curiosities.tools.SandPaperPolishingRecipe.SandPaperInv;
|
import com.simibubi.create.content.curiosities.tools.SandPaperPolishingRecipe.SandPaperInv;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
|
||||||
import net.minecraftforge.items.ItemStackHandler;
|
import net.minecraftforge.items.ItemStackHandler;
|
||||||
import net.minecraftforge.items.wrapper.RecipeWrapper;
|
import net.minecraftforge.items.wrapper.RecipeWrapper;
|
||||||
|
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@ParametersAreNonnullByDefault
|
@ParametersAreNonnullByDefault
|
||||||
public class SandPaperPolishingRecipe extends ProcessingRecipe<SandPaperInv> {
|
public class SandPaperPolishingRecipe extends ProcessingRecipe<SandPaperInv> {
|
||||||
|
|
||||||
public SandPaperPolishingRecipe(ResourceLocation id, String group, List<ProcessingIngredient> ingredients,
|
public SandPaperPolishingRecipe(ResourceLocation id, String group, List<ProcessingIngredient> ingredients,
|
||||||
List<ProcessingOutput> results, int processingDuration, List<FluidStack> fluidIngredients,
|
List<ProcessingOutput> results, int processingDuration) {
|
||||||
List<FluidStack> fluidResults) {
|
|
||||||
super(AllRecipeTypes.SANDPAPER_POLISHING, id, group, ingredients, results, processingDuration);
|
super(AllRecipeTypes.SANDPAPER_POLISHING, id, group, ingredients, results, processingDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,17 +37,17 @@ public class SandPaperPolishingRecipe extends ProcessingRecipe<SandPaperInv> {
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<IRecipe<SandPaperInv>> getMatchingRecipes(World world, ItemStack stack) {
|
||||||
|
return world.getRecipeManager()
|
||||||
|
.getRecipes(AllRecipeTypes.SANDPAPER_POLISHING.getType(), new SandPaperInv(stack), world);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(SandPaperInv inv, World worldIn) {
|
public boolean matches(SandPaperInv inv, World worldIn) {
|
||||||
return ingredients.get(0)
|
return ingredients.get(0)
|
||||||
.test(inv.getStackInSlot(0));
|
.test(inv.getStackInSlot(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<IRecipe<SandPaperInv>> getMatchingRecipes(World world, ItemStack stack) {
|
|
||||||
return world.getRecipeManager()
|
|
||||||
.getRecipes(AllRecipeTypes.SANDPAPER_POLISHING.getType(), new SandPaperInv(stack), world);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getMaxOutputCount() {
|
protected int getMaxOutputCount() {
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in a new issue