mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-17 07:21:43 +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.Create;
|
||||||
import com.simibubi.create.compat.jei.BlockCuttingCategory.CondensedBlockCuttingRecipe;
|
import com.simibubi.create.compat.jei.BlockCuttingCategory.CondensedBlockCuttingRecipe;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
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.components.press.MechanicalPressTileEntity;
|
||||||
import com.simibubi.create.modules.contraptions.processing.StochasticOutput;
|
import com.simibubi.create.modules.contraptions.processing.StochasticOutput;
|
||||||
import com.simibubi.create.modules.logistics.block.inventories.FlexcrateScreen;
|
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),
|
registration.addRecipes(findRecipesByTypeExcluding(IRecipeType.SMELTING, IRecipeType.SMOKING),
|
||||||
blastingCategory.getUid());
|
blastingCategory.getUid());
|
||||||
registration.addRecipes(findRecipes(AllRecipes.MIXING), mixingCategory.getUid());
|
registration.addRecipes(findRecipes(AllRecipes.MIXING), mixingCategory.getUid());
|
||||||
registration
|
registration.addRecipes(findRecipes(r -> r.getSerializer() == IRecipeSerializer.CRAFTING_SHAPELESS
|
||||||
.addRecipes(
|
&& !MechanicalPressTileEntity.canCompress(r.getIngredients())).stream().map(MixingRecipe::of)
|
||||||
findRecipes(r -> r.getSerializer() == IRecipeSerializer.CRAFTING_SHAPELESS
|
.collect(Collectors.toList()),
|
||||||
&& !MechanicalPressTileEntity.canCompress(r.getIngredients())),
|
mixingCategory.getUid());
|
||||||
mixingCategory.getUid());
|
|
||||||
registration.addRecipes(findRecipes(AllRecipes.CUTTING), sawingCategory.getUid());
|
registration.addRecipes(findRecipes(AllRecipes.CUTTING), sawingCategory.getUid());
|
||||||
registration.addRecipes(
|
registration.addRecipes(
|
||||||
CondensedBlockCuttingRecipe.condenseRecipes(findRecipesByType(IRecipeType.STONECUTTING)),
|
CondensedBlockCuttingRecipe.condenseRecipes(findRecipesByType(IRecipeType.STONECUTTING)),
|
||||||
|
|
|
@ -12,6 +12,7 @@ import com.simibubi.create.Create;
|
||||||
import com.simibubi.create.ScreenResources;
|
import com.simibubi.create.ScreenResources;
|
||||||
import com.simibubi.create.foundation.item.ItemHelper;
|
import com.simibubi.create.foundation.item.ItemHelper;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
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.constants.VanillaTypes;
|
||||||
import mezz.jei.api.gui.IRecipeLayout;
|
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.ingredients.IIngredients;
|
||||||
import mezz.jei.api.recipe.category.IRecipeCategory;
|
import mezz.jei.api.recipe.category.IRecipeCategory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
|
||||||
import net.minecraft.item.crafting.Ingredient;
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
import net.minecraft.util.NonNullList;
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
public class MixingCategory implements IRecipeCategory<IRecipe<?>> {
|
public class MixingCategory implements IRecipeCategory<MixingRecipe> {
|
||||||
|
|
||||||
private AnimatedMixer mixer;
|
private AnimatedMixer mixer;
|
||||||
private static ResourceLocation ID = new ResourceLocation(Create.ID, "mixing");
|
private static ResourceLocation ID = new ResourceLocation(Create.ID, "mixing");
|
||||||
|
@ -59,13 +59,13 @@ public class MixingCategory implements IRecipeCategory<IRecipe<?>> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setIngredients(IRecipe<?> recipe, IIngredients ingredients) {
|
public void setIngredients(MixingRecipe recipe, IIngredients ingredients) {
|
||||||
ingredients.setInputIngredients(recipe.getIngredients());
|
ingredients.setInputIngredients(recipe.getIngredients());
|
||||||
ingredients.setOutput(VanillaTypes.ITEM, recipe.getRecipeOutput());
|
ingredients.setOutput(VanillaTypes.ITEM, recipe.getRecipeOutput());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRecipe(IRecipeLayout recipeLayout, IRecipe<?> recipe, IIngredients ingredients) {
|
public void setRecipe(IRecipeLayout recipeLayout, MixingRecipe recipe, IIngredients ingredients) {
|
||||||
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
|
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
|
||||||
|
|
||||||
NonNullList<Ingredient> recipeIngredients = recipe.getIngredients();
|
NonNullList<Ingredient> recipeIngredients = recipe.getIngredients();
|
||||||
|
@ -91,7 +91,7 @@ public class MixingCategory implements IRecipeCategory<IRecipe<?>> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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());
|
List<Pair<Ingredient, MutableInt>> actualIngredients = ItemHelper.condenseIngredients(recipe.getIngredients());
|
||||||
|
|
||||||
int size = actualIngredients.size();
|
int size = actualIngredients.size();
|
||||||
|
@ -104,10 +104,9 @@ public class MixingCategory implements IRecipeCategory<IRecipe<?>> {
|
||||||
mixer.draw(getBackground().getWidth() / 2 + 20, 8);
|
mixer.draw(getBackground().getWidth() / 2 + 20, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends IRecipe<?>> getRecipeClass() {
|
public Class<? extends MixingRecipe> getRecipeClass() {
|
||||||
return (Class<? extends IRecipe<?>>) IRecipe.class;
|
return MixingRecipe.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
|
||||||
import mezz.jei.api.ingredients.IIngredients;
|
import mezz.jei.api.ingredients.IIngredients;
|
||||||
import mezz.jei.api.recipe.category.IRecipeCategory;
|
import mezz.jei.api.recipe.category.IRecipeCategory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.crafting.ICraftingRecipe;
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
import net.minecraft.item.crafting.Ingredient;
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
import net.minecraft.util.NonNullList;
|
import net.minecraft.util.NonNullList;
|
||||||
|
@ -42,10 +43,9 @@ public class PackingCategory implements IRecipeCategory<IRecipe<?>> {
|
||||||
return ID;
|
return ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends IRecipe<?>> getRecipeClass() {
|
public Class<? extends IRecipe<?>> getRecipeClass() {
|
||||||
return (Class<? extends IRecipe<?>>) IRecipe.class;
|
return ICraftingRecipe.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.simibubi.create.modules.contraptions.components.mixer;
|
package com.simibubi.create.modules.contraptions.components.mixer;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
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 com.simibubi.create.modules.contraptions.processing.StochasticOutput;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
import net.minecraft.item.crafting.Ingredient;
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
import net.minecraft.util.NonNullList;
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
@ -17,8 +19,8 @@ import net.minecraft.world.World;
|
||||||
|
|
||||||
public class MixingRecipe extends ProcessingRecipe<BasinInputInventory> {
|
public class MixingRecipe extends ProcessingRecipe<BasinInputInventory> {
|
||||||
|
|
||||||
public MixingRecipe(ResourceLocation id, String group, List<Ingredient> ingredients,
|
public MixingRecipe(ResourceLocation id, String group, List<Ingredient> ingredients, List<StochasticOutput> results,
|
||||||
List<StochasticOutput> results, int processingDuration) {
|
int processingDuration) {
|
||||||
super(AllRecipes.MIXING, id, group, ingredients, results, processingDuration);
|
super(AllRecipes.MIXING, id, group, ingredients, results, processingDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,4 +59,9 @@ public class MixingRecipe extends ProcessingRecipe<BasinInputInventory> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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.blastingViaFan.fan": "Fan behind Lava",
|
||||||
"create.recipe.pressing": "Pressing",
|
"create.recipe.pressing": "Pressing",
|
||||||
"create.recipe.mixing": "Mixing",
|
"create.recipe.mixing": "Mixing",
|
||||||
"create.recipe.packing": "Compressing",
|
"create.recipe.packing": "Compacting",
|
||||||
"create.recipe.sawing": "Sawing",
|
"create.recipe.sawing": "Sawing",
|
||||||
"create.recipe.block_cutting": "Block Cutting",
|
"create.recipe.block_cutting": "Block Cutting",
|
||||||
"create.recipe.blockzapperUpgrade": "Handheld Blockzapper",
|
"create.recipe.blockzapperUpgrade": "Handheld Blockzapper",
|
||||||
|
|
Loading…
Reference in a new issue