Trying to get oreDict stuff working with JEI... >_<
This commit is contained in:
parent
5de27af91f
commit
1120414f8f
6 changed files with 51 additions and 47 deletions
|
|
@ -12,6 +12,7 @@ import com.oitsjustjose.criss_cross.lib.Lib;
|
|||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IDrawableAnimated;
|
||||
import mezz.jei.api.gui.IDrawableStatic;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
|
@ -72,16 +73,17 @@ public class ScribeCategory implements IRecipeCategory
|
|||
@SuppressWarnings("unchecked")
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper)
|
||||
{
|
||||
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
|
||||
|
||||
recipeLayout.getItemStacks().init(INPUT_SLOT, true, 34, 4);
|
||||
recipeLayout.getItemStacks().init(OUTPUT_SLOT, false, 88, 4);
|
||||
recipeLayout.getItemStacks().init(FUEL_SLOT, true, 0, 4);
|
||||
guiItemStacks.init(INPUT_SLOT, true, 34, 4);
|
||||
guiItemStacks.init(OUTPUT_SLOT, false, 88, 4);
|
||||
guiItemStacks.init(FUEL_SLOT, true, 0, 4);
|
||||
|
||||
if (recipeWrapper instanceof ScribeRecipeJEI)
|
||||
{
|
||||
ScribeRecipeJEI scribeRecipeWrapper = (ScribeRecipeJEI) recipeWrapper;
|
||||
recipeLayout.getItemStacks().set(INPUT_SLOT, scribeRecipeWrapper.getInputs());
|
||||
recipeLayout.getItemStacks().set(OUTPUT_SLOT, scribeRecipeWrapper.getOutputs());
|
||||
guiItemStacks.setFromRecipe(INPUT_SLOT, scribeRecipeWrapper.getInputs());
|
||||
guiItemStacks.setFromRecipe(OUTPUT_SLOT, scribeRecipeWrapper.getOutputs());
|
||||
recipeLayout.getItemStacks().set(FUEL_SLOT, new ItemStack(Items.writable_book));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,35 +11,32 @@ import net.minecraft.item.ItemStack;
|
|||
|
||||
public class ScribeRecipeJEI extends BlankRecipeWrapper
|
||||
{
|
||||
@Nonnull
|
||||
private final List<List<ItemStack>> inputs;
|
||||
@Nonnull
|
||||
private final List<ItemStack> outputs;
|
||||
|
||||
@Nonnull
|
||||
private final ItemStack input;
|
||||
public ScribeRecipeJEI(@Nonnull List<ItemStack> input, @Nonnull ItemStack output)
|
||||
{
|
||||
this.inputs = Collections.singletonList(input);
|
||||
this.outputs = Collections.singletonList(output);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
private final ItemStack output;
|
||||
|
||||
@Override
|
||||
public List getInputs()
|
||||
{
|
||||
return inputs;
|
||||
}
|
||||
|
||||
public ScribeRecipeJEI(@Nonnull ItemStack input, @Nonnull ItemStack output)
|
||||
{
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
}
|
||||
@Override
|
||||
public List getOutputs()
|
||||
{
|
||||
return outputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getInputs()
|
||||
{
|
||||
return Collections.singletonList(input);
|
||||
}
|
||||
@Override
|
||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight)
|
||||
{
|
||||
|
||||
@Override
|
||||
public List getOutputs()
|
||||
{
|
||||
return Collections.singletonList(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -8,6 +8,7 @@ import javax.annotation.Nonnull;
|
|||
|
||||
import com.oitsjustjose.criss_cross.recipes.machine.ScribeRecipes;
|
||||
|
||||
import mezz.jei.util.StackUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ScribeRecipeMaker
|
||||
|
|
@ -15,16 +16,18 @@ public class ScribeRecipeMaker
|
|||
@Nonnull
|
||||
public static List<ScribeRecipeJEI> getRecipes()
|
||||
{
|
||||
ScribeRecipes scribeRecipes = ScribeRecipes.getInstance();
|
||||
Map<ItemStack, ItemStack> scribeMap = ScribeRecipes.getInstance().getRecipeList();
|
||||
|
||||
ArrayList<ScribeRecipeJEI> recipes = new ArrayList<ScribeRecipeJEI>();
|
||||
List<ScribeRecipeJEI> recipes = new ArrayList<>();
|
||||
|
||||
for (Map.Entry<ItemStack, ItemStack> entry : scribeMap.entrySet())
|
||||
{
|
||||
ItemStack input = entry.getKey();
|
||||
ItemStack output = entry.getValue();
|
||||
|
||||
ScribeRecipeJEI recipe = new ScribeRecipeJEI(input, output);
|
||||
List<ItemStack> inputs = StackUtil.getSubtypes(input);
|
||||
ScribeRecipeJEI recipe = new ScribeRecipeJEI(inputs, output);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,12 +2,10 @@ package com.oitsjustjose.criss_cross.jei;
|
|||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.oitsjustjose.criss_cross.gui.GUICropomator;
|
||||
import com.oitsjustjose.criss_cross.gui.GUIWoodchipper;
|
||||
import com.oitsjustjose.criss_cross.lib.Config;
|
||||
import com.oitsjustjose.criss_cross.lib.Lib;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileWoodchipper;
|
||||
import com.sun.org.apache.bcel.internal.Constants;
|
||||
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IDrawableAnimated;
|
||||
|
|
@ -16,7 +14,6 @@ import mezz.jei.api.gui.IRecipeLayout;
|
|||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class WoodchipperCategory implements IRecipeCategory
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ import com.oitsjustjose.criss_cross.tileentity.TileCropomator;
|
|||
import com.oitsjustjose.criss_cross.tileentity.TileElectroextractor;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileStonegen;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileWoodchipper;
|
||||
import com.oitsjustjose.criss_cross.util.LogHelper;
|
||||
import com.oitsjustjose.criss_cross.util.ItemHelper;
|
||||
import com.oitsjustjose.criss_cross.util.LogHelper;
|
||||
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentData;
|
||||
|
|
@ -26,7 +26,6 @@ import net.minecraft.init.Items;
|
|||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
|
|
@ -105,9 +104,11 @@ public class MachineRecipes
|
|||
if (OreDictionary.getOres(oreDict).size() > 0)
|
||||
{
|
||||
if (Enchantment.getEnchantmentById(enchID) != null)
|
||||
ScribeRecipes.getInstance().addRecipe(oreDict, qty, getEnchantedBook(enchID));
|
||||
else
|
||||
LogHelper.warn("Enchantment ID " + enchID + " does not appear to be valid. Skipping Scribe recipe addition.");
|
||||
if (qty > 0)
|
||||
ScribeRecipes.getInstance().addRecipe(oreDict, qty, getEnchantedBook(enchID));
|
||||
|
||||
else
|
||||
LogHelper.warn("Enchantment ID " + enchID + " does not appear to be valid. Skipping Scribe recipe addition.");
|
||||
}
|
||||
else
|
||||
LogHelper.warn("Ore Dictionary Name " + oreDict + " does not appear to be valid. Skipping Scribe recipe addition.");
|
||||
|
|
|
|||
|
|
@ -30,7 +30,11 @@ public class ScribeRecipes
|
|||
List<ItemStack> itemstacks = OreDictionary.getOres(oreDict);
|
||||
if (itemstacks.size() > 0)
|
||||
for (ItemStack i : itemstacks)
|
||||
this.recipes.put(new ItemStack(i.getItem(), qty, i.getMetadata()), stack);
|
||||
{
|
||||
ItemStack temp = i.copy();
|
||||
temp.stackSize = qty;
|
||||
this.recipes.put(temp, stack);
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getResult(ItemStack stack)
|
||||
|
|
|
|||
Loading…
Reference in a new issue