mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-23 21:46:40 +01:00
Recipe Goof
- Fixed JEI recipe casts
This commit is contained in:
parent
43980d550d
commit
b8dc08a45f
5 changed files with 26 additions and 20 deletions
|
@ -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)),
|
||||
|
|
|
@ -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<IRecipe<?>> {
|
||||
public class MixingCategory implements IRecipeCategory<MixingRecipe> {
|
||||
|
||||
private AnimatedMixer mixer;
|
||||
private static ResourceLocation ID = new ResourceLocation(Create.ID, "mixing");
|
||||
|
@ -59,13 +59,13 @@ public class MixingCategory implements IRecipeCategory<IRecipe<?>> {
|
|||
}
|
||||
|
||||
@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<Ingredient> recipeIngredients = recipe.getIngredients();
|
||||
|
@ -91,7 +91,7 @@ public class MixingCategory implements IRecipeCategory<IRecipe<?>> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void draw(IRecipe<?> recipe, double mouseX, double mouseY) {
|
||||
public void draw(MixingRecipe recipe, double mouseX, double mouseY) {
|
||||
List<Pair<Ingredient, MutableInt>> actualIngredients = ItemHelper.condenseIngredients(recipe.getIngredients());
|
||||
|
||||
int size = actualIngredients.size();
|
||||
|
@ -104,10 +104,9 @@ public class MixingCategory implements IRecipeCategory<IRecipe<?>> {
|
|||
mixer.draw(getBackground().getWidth() / 2 + 20, 8);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Class<? extends IRecipe<?>> getRecipeClass() {
|
||||
return (Class<? extends IRecipe<?>>) IRecipe.class;
|
||||
public Class<? extends MixingRecipe> getRecipeClass() {
|
||||
return MixingRecipe.class;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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<IRecipe<?>> {
|
|||
return ID;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Class<? extends IRecipe<?>> getRecipeClass() {
|
||||
return (Class<? extends IRecipe<?>>) IRecipe.class;
|
||||
return ICraftingRecipe.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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<BasinInputInventory> {
|
||||
|
||||
public MixingRecipe(ResourceLocation id, String group, List<Ingredient> ingredients,
|
||||
List<StochasticOutput> results, int processingDuration) {
|
||||
public MixingRecipe(ResourceLocation id, String group, List<Ingredient> ingredients, List<StochasticOutput> results,
|
||||
int processingDuration) {
|
||||
super(AllRecipes.MIXING, id, group, ingredients, results, processingDuration);
|
||||
}
|
||||
|
||||
|
@ -26,7 +28,7 @@ public class MixingRecipe extends ProcessingRecipe<BasinInputInventory> {
|
|||
public boolean matches(BasinInputInventory inv, World worldIn) {
|
||||
if (inv.isEmpty())
|
||||
return false;
|
||||
|
||||
|
||||
NonNullList<Ingredient> ingredients = getIngredients();
|
||||
if (!ingredients.stream().allMatch(Ingredient::isSimple))
|
||||
return false;
|
||||
|
@ -54,7 +56,12 @@ public class MixingRecipe extends ProcessingRecipe<BasinInputInventory> {
|
|||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue