mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-27 07:27:15 +01:00
Fixed non ShapedRecipe / ShapelessRecipe recipes not being shown in JEI.
Fixes #1112
This commit is contained in:
parent
ed4a371fa0
commit
379c243133
3 changed files with 14 additions and 11 deletions
|
@ -31,6 +31,7 @@ import net.minecraft.world.item.ItemStack;
|
|||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.crafting.*;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraftforge.common.crafting.IShapedRecipe;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
@ -94,7 +95,7 @@ public class CreateJEI implements IModPlugin {
|
|||
.build(),
|
||||
|
||||
autoShapeless = register("automatic_shapeless", MixingCategory::autoShapeless)
|
||||
.recipes(r -> r.getSerializer() == RecipeSerializer.SHAPELESS_RECIPE && r.getIngredients()
|
||||
.recipes(r -> r instanceof CraftingRecipe && !(r instanceof IShapedRecipe<?>) && r.getIngredients()
|
||||
.size() > 1 && !MechanicalPressTileEntity.canCompress(r) && !AllRecipeTypes.isManualRecipe(r),
|
||||
BasinRecipe::convertShapeless)
|
||||
.catalyst(AllBlocks.MECHANICAL_MIXER::get)
|
||||
|
@ -173,11 +174,11 @@ public class CreateJEI implements IModPlugin {
|
|||
.build(),
|
||||
|
||||
autoShaped = register("automatic_shaped", MechanicalCraftingCategory::new)
|
||||
.recipes(r -> r.getSerializer() == RecipeSerializer.SHAPELESS_RECIPE && r.getIngredients()
|
||||
.recipes(r -> r instanceof CraftingRecipe && !(r instanceof IShapedRecipe<?>) && r.getIngredients()
|
||||
.size() == 1)
|
||||
.recipes(r -> (r.getType() == RecipeType.CRAFTING
|
||||
&& r.getType() != AllRecipeTypes.MECHANICAL_CRAFTING.getType()) && (r instanceof ShapedRecipe)
|
||||
&& !AllRecipeTypes.isManualRecipe(r))
|
||||
&& r.getType() != AllRecipeTypes.MECHANICAL_CRAFTING.getType()) && (r instanceof IShapedRecipe<?>)
|
||||
&& !AllRecipeTypes.isManualRecipe(r))
|
||||
.catalyst(AllBlocks.MECHANICAL_CRAFTER::get)
|
||||
.enableWhen(c -> c.allowRegularCraftingInCrafter)
|
||||
.build(),
|
||||
|
|
|
@ -28,6 +28,7 @@ import net.minecraft.world.item.TooltipFlag;
|
|||
import net.minecraft.world.item.crafting.CraftingRecipe;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.item.crafting.ShapedRecipe;
|
||||
import net.minecraftforge.common.crafting.IShapedRecipe;
|
||||
|
||||
public class MechanicalCraftingCategory extends CreateRecipeCategory<CraftingRecipe> {
|
||||
|
||||
|
@ -86,11 +87,11 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<CraftingRec
|
|||
}
|
||||
|
||||
private static int getWidth(CraftingRecipe recipe) {
|
||||
return recipe instanceof ShapedRecipe ? ((ShapedRecipe) recipe).getWidth() : 1;
|
||||
return recipe instanceof IShapedRecipe<?> ? ((IShapedRecipe<?>) recipe).getRecipeWidth() : 1;
|
||||
}
|
||||
|
||||
private static int getHeight(CraftingRecipe recipe) {
|
||||
return recipe instanceof ShapedRecipe ? ((ShapedRecipe) recipe).getHeight() : 1;
|
||||
return recipe instanceof IShapedRecipe<?> ? ((IShapedRecipe<?>) recipe).getRecipeHeight() : 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -28,6 +28,7 @@ import net.minecraft.world.item.crafting.Ingredient.Value;
|
|||
import net.minecraft.world.item.crafting.Recipe;
|
||||
import net.minecraft.world.item.crafting.ShapedRecipe;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.common.crafting.IShapedRecipe;
|
||||
import net.minecraftforge.common.crafting.MultiItemValue;
|
||||
import net.minecraftforge.fml.util.ObfuscationReflectionHelper;
|
||||
import net.minecraftforge.items.ItemStackHandler;
|
||||
|
@ -79,12 +80,12 @@ public class BlueprintItem extends Item {
|
|||
inv.setStackInSlot(i, ItemStack.EMPTY);
|
||||
inv.setStackInSlot(9, recipe.getResultItem());
|
||||
|
||||
if (recipe instanceof ShapedRecipe) {
|
||||
ShapedRecipe shapedRecipe = (ShapedRecipe) recipe;
|
||||
for (int row = 0; row < shapedRecipe.getHeight(); row++)
|
||||
for (int col = 0; col < shapedRecipe.getWidth(); col++)
|
||||
if (recipe instanceof IShapedRecipe) {
|
||||
IShapedRecipe<?> shapedRecipe = (IShapedRecipe<?>) recipe;
|
||||
for (int row = 0; row < shapedRecipe.getRecipeHeight(); row++)
|
||||
for (int col = 0; col < shapedRecipe.getRecipeWidth(); col++)
|
||||
inv.setStackInSlot(row * 3 + col,
|
||||
convertIngredientToFilter(ingredients.get(row * shapedRecipe.getWidth() + col)));
|
||||
convertIngredientToFilter(ingredients.get(row * shapedRecipe.getRecipeWidth() + col)));
|
||||
} else {
|
||||
for (int i = 0; i < ingredients.size(); i++)
|
||||
inv.setStackInSlot(i, convertIngredientToFilter(ingredients.get(i)));
|
||||
|
|
Loading…
Reference in a new issue