diff --git a/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java b/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java index a7e8e263c..0063c2d28 100644 --- a/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java +++ b/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java @@ -10,6 +10,7 @@ import com.simibubi.create.AllRecipes; import com.simibubi.create.Create; import com.simibubi.create.compat.jei.BlockCuttingCategory.CondensedBlockCuttingRecipe; import com.simibubi.create.foundation.utility.Lang; +import com.simibubi.create.modules.contraptions.components.mixer.MixingRecipe; import com.simibubi.create.modules.contraptions.components.press.MechanicalPressTileEntity; import com.simibubi.create.modules.contraptions.processing.StochasticOutput; import com.simibubi.create.modules.logistics.block.inventories.FlexcrateScreen; @@ -90,11 +91,10 @@ public class CreateJEI implements IModPlugin { registration.addRecipes(findRecipesByTypeExcluding(IRecipeType.SMELTING, IRecipeType.SMOKING), blastingCategory.getUid()); registration.addRecipes(findRecipes(AllRecipes.MIXING), mixingCategory.getUid()); - registration - .addRecipes( - findRecipes(r -> r.getSerializer() == IRecipeSerializer.CRAFTING_SHAPELESS - && !MechanicalPressTileEntity.canCompress(r.getIngredients())), - mixingCategory.getUid()); + registration.addRecipes(findRecipes(r -> r.getSerializer() == IRecipeSerializer.CRAFTING_SHAPELESS + && !MechanicalPressTileEntity.canCompress(r.getIngredients())).stream().map(MixingRecipe::of) + .collect(Collectors.toList()), + mixingCategory.getUid()); registration.addRecipes(findRecipes(AllRecipes.CUTTING), sawingCategory.getUid()); registration.addRecipes( CondensedBlockCuttingRecipe.condenseRecipes(findRecipesByType(IRecipeType.STONECUTTING)), diff --git a/src/main/java/com/simibubi/create/compat/jei/MixingCategory.java b/src/main/java/com/simibubi/create/compat/jei/MixingCategory.java index 6711a5988..8302d9aec 100644 --- a/src/main/java/com/simibubi/create/compat/jei/MixingCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/MixingCategory.java @@ -12,6 +12,7 @@ import com.simibubi.create.Create; import com.simibubi.create.ScreenResources; import com.simibubi.create.foundation.item.ItemHelper; import com.simibubi.create.foundation.utility.Lang; +import com.simibubi.create.modules.contraptions.components.mixer.MixingRecipe; import mezz.jei.api.constants.VanillaTypes; import mezz.jei.api.gui.IRecipeLayout; @@ -20,12 +21,11 @@ import mezz.jei.api.gui.ingredient.IGuiItemStackGroup; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.category.IRecipeCategory; import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.Ingredient; import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; -public class MixingCategory implements IRecipeCategory> { +public class MixingCategory implements IRecipeCategory { private AnimatedMixer mixer; private static ResourceLocation ID = new ResourceLocation(Create.ID, "mixing"); @@ -59,13 +59,13 @@ public class MixingCategory implements IRecipeCategory> { } @Override - public void setIngredients(IRecipe recipe, IIngredients ingredients) { + public void setIngredients(MixingRecipe recipe, IIngredients ingredients) { ingredients.setInputIngredients(recipe.getIngredients()); ingredients.setOutput(VanillaTypes.ITEM, recipe.getRecipeOutput()); } @Override - public void setRecipe(IRecipeLayout recipeLayout, IRecipe recipe, IIngredients ingredients) { + public void setRecipe(IRecipeLayout recipeLayout, MixingRecipe recipe, IIngredients ingredients) { IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks(); NonNullList recipeIngredients = recipe.getIngredients(); @@ -91,7 +91,7 @@ public class MixingCategory implements IRecipeCategory> { } @Override - public void draw(IRecipe recipe, double mouseX, double mouseY) { + public void draw(MixingRecipe recipe, double mouseX, double mouseY) { List> actualIngredients = ItemHelper.condenseIngredients(recipe.getIngredients()); int size = actualIngredients.size(); @@ -104,10 +104,9 @@ public class MixingCategory implements IRecipeCategory> { mixer.draw(getBackground().getWidth() / 2 + 20, 8); } - @SuppressWarnings("unchecked") @Override - public Class> getRecipeClass() { - return (Class>) IRecipe.class; + public Class getRecipeClass() { + return MixingRecipe.class; } } diff --git a/src/main/java/com/simibubi/create/compat/jei/PackingCategory.java b/src/main/java/com/simibubi/create/compat/jei/PackingCategory.java index 03e3d2a5f..4dc400da3 100644 --- a/src/main/java/com/simibubi/create/compat/jei/PackingCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/PackingCategory.java @@ -14,6 +14,7 @@ import mezz.jei.api.gui.ingredient.IGuiItemStackGroup; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.category.IRecipeCategory; import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.ICraftingRecipe; import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.Ingredient; import net.minecraft.util.NonNullList; @@ -42,10 +43,9 @@ public class PackingCategory implements IRecipeCategory> { return ID; } - @SuppressWarnings("unchecked") @Override public Class> getRecipeClass() { - return (Class>) IRecipe.class; + return ICraftingRecipe.class; } @Override diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/mixer/MixingRecipe.java b/src/main/java/com/simibubi/create/modules/contraptions/components/mixer/MixingRecipe.java index e55450a16..d090d61aa 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/mixer/MixingRecipe.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/mixer/MixingRecipe.java @@ -1,6 +1,7 @@ package com.simibubi.create.modules.contraptions.components.mixer; import java.util.ArrayList; +import java.util.Arrays; import java.util.LinkedList; import java.util.List; @@ -10,6 +11,7 @@ import com.simibubi.create.modules.contraptions.processing.ProcessingRecipe; import com.simibubi.create.modules.contraptions.processing.StochasticOutput; import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.Ingredient; import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; @@ -17,8 +19,8 @@ import net.minecraft.world.World; public class MixingRecipe extends ProcessingRecipe { - public MixingRecipe(ResourceLocation id, String group, List ingredients, - List results, int processingDuration) { + public MixingRecipe(ResourceLocation id, String group, List ingredients, List results, + int processingDuration) { super(AllRecipes.MIXING, id, group, ingredients, results, processingDuration); } @@ -26,7 +28,7 @@ public class MixingRecipe extends ProcessingRecipe { public boolean matches(BasinInputInventory inv, World worldIn) { if (inv.isEmpty()) return false; - + NonNullList ingredients = getIngredients(); if (!ingredients.stream().allMatch(Ingredient::isSimple)) return false; @@ -54,7 +56,12 @@ public class MixingRecipe extends ProcessingRecipe { return false; } return true; - + + } + + public static MixingRecipe of(IRecipe recipe) { + return new MixingRecipe(recipe.getId(), recipe.getGroup(), recipe.getIngredients(), + Arrays.asList(new StochasticOutput(recipe.getRecipeOutput(), 1)), -1); } } diff --git a/src/main/resources/assets/create/lang/en_us.json b/src/main/resources/assets/create/lang/en_us.json index 8f7afcfdd..7448852b4 100644 --- a/src/main/resources/assets/create/lang/en_us.json +++ b/src/main/resources/assets/create/lang/en_us.json @@ -186,7 +186,7 @@ "create.recipe.blastingViaFan.fan": "Fan behind Lava", "create.recipe.pressing": "Pressing", "create.recipe.mixing": "Mixing", - "create.recipe.packing": "Compressing", + "create.recipe.packing": "Compacting", "create.recipe.sawing": "Sawing", "create.recipe.block_cutting": "Block Cutting", "create.recipe.blockzapperUpgrade": "Handheld Blockzapper",