JEI integration
This commit is contained in:
parent
f21cdbac78
commit
df68a49f3c
25 changed files with 849 additions and 818 deletions
|
|
@ -0,0 +1,79 @@
|
|||
package com.oitsjustjose.criss_cross.jei;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.oitsjustjose.criss_cross.gui.GUICropomator;
|
||||
import com.oitsjustjose.criss_cross.lib.Lib;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileCropomator;
|
||||
import com.sun.org.apache.bcel.internal.Constants;
|
||||
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
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 CropomatorCategory implements IRecipeCategory
|
||||
{
|
||||
private static final int INPUT_SLOT = 0;
|
||||
private static final int OUTPUT_SLOT = 1;
|
||||
private static final int FUEL_SLOT = 2;
|
||||
|
||||
@Nonnull
|
||||
private final IDrawable background = JEIPluginManager.jeiHelper.getGuiHelper().createDrawable(GUICropomator.backgroundTexture, 55, 16, 82, 54);
|
||||
@Nonnull
|
||||
private final String localizedName = StatCollector.translateToLocal("recipe.cropomator");
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUid()
|
||||
{
|
||||
return Lib.CROPOMATOR_UID;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getTitle()
|
||||
{
|
||||
return localizedName;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IDrawable getBackground()
|
||||
{
|
||||
return background;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(Minecraft minecraft)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawAnimations(Minecraft minecraft)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper)
|
||||
{
|
||||
|
||||
recipeLayout.getItemStacks().init(INPUT_SLOT, true, 0, 0);
|
||||
recipeLayout.getItemStacks().init(OUTPUT_SLOT, false, 60, 18);
|
||||
recipeLayout.getItemStacks().init(FUEL_SLOT, true, 0, 36);
|
||||
|
||||
if (recipeWrapper instanceof CropomatorRecipeJEI)
|
||||
{
|
||||
CropomatorRecipeJEI cropomatorRecipeWrapper = (CropomatorRecipeJEI) recipeWrapper;
|
||||
recipeLayout.getItemStacks().set(INPUT_SLOT, cropomatorRecipeWrapper.getInputs());
|
||||
recipeLayout.getItemStacks().set(OUTPUT_SLOT, cropomatorRecipeWrapper.getOutputs());
|
||||
recipeLayout.getItemStacks().set(FUEL_SLOT, TileCropomator.getFuels());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.oitsjustjose.criss_cross.jei;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.oitsjustjose.criss_cross.lib.Lib;
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class CropomatorRecipeHandler implements IRecipeHandler<CropomatorRecipeJEI>
|
||||
{
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Class<CropomatorRecipeJEI> getRecipeClass()
|
||||
{
|
||||
return CropomatorRecipeJEI.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid()
|
||||
{
|
||||
return Lib.CROPOMATOR_UID;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(@Nonnull CropomatorRecipeJEI recipe)
|
||||
{
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(@Nonnull CropomatorRecipeJEI recipe)
|
||||
{
|
||||
return recipe.getInputs().size() > 0 && recipe.getOutputs().size() > 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package com.oitsjustjose.criss_cross.jei;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class CropomatorRecipeJEI extends BlankRecipeWrapper
|
||||
{
|
||||
|
||||
@Nonnull
|
||||
private final ItemStack input;
|
||||
|
||||
@Nonnull
|
||||
private final ItemStack output;
|
||||
|
||||
|
||||
public CropomatorRecipeJEI(@Nonnull ItemStack input, @Nonnull ItemStack output)
|
||||
{
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getInputs()
|
||||
{
|
||||
return Collections.singletonList(input);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getOutputs()
|
||||
{
|
||||
return Collections.singletonList(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.oitsjustjose.criss_cross.jei;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.oitsjustjose.criss_cross.recipes.machine.CropomatorRecipes;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class CropomatorRecipeMaker
|
||||
{
|
||||
@Nonnull
|
||||
public static List<CropomatorRecipeJEI> getRecipes()
|
||||
{
|
||||
Map<ItemStack, ItemStack> cropomatorMap = CropomatorRecipes.getInstance().getRecipeList();
|
||||
|
||||
ArrayList<CropomatorRecipeJEI> recipes = new ArrayList<CropomatorRecipeJEI>();
|
||||
|
||||
for (Map.Entry<ItemStack, ItemStack> entry : cropomatorMap.entrySet())
|
||||
{
|
||||
ItemStack input = entry.getKey();
|
||||
ItemStack output = entry.getValue();
|
||||
|
||||
CropomatorRecipeJEI recipe = new CropomatorRecipeJEI(input, output);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
return recipes;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
package com.oitsjustjose.criss_cross.jei;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.oitsjustjose.criss_cross.gui.GUIElectroextractor;
|
||||
import com.oitsjustjose.criss_cross.gui.GUIElectroextractor;
|
||||
import com.oitsjustjose.criss_cross.lib.Lib;
|
||||
import com.oitsjustjose.criss_cross.tileentity.TileElectroextractor;
|
||||
import com.sun.org.apache.bcel.internal.Constants;
|
||||
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
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 ElectroextractorCategory implements IRecipeCategory
|
||||
{
|
||||
private static final int INPUT_SLOT = 0;
|
||||
private static final int OUTPUT_SLOT = 1;
|
||||
private static final int FUEL_SLOT = 2;
|
||||
|
||||
@Nonnull
|
||||
private final IDrawable background = JEIPluginManager.jeiHelper.getGuiHelper().createDrawable(GUIElectroextractor.backgroundTexture, 55, 16, 82, 54);
|
||||
@Nonnull
|
||||
private final String localizedName = StatCollector.translateToLocal("recipe.electroextractor");
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUid()
|
||||
{
|
||||
return Lib.ELECTROEXTRACTOR_UID;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getTitle()
|
||||
{
|
||||
return localizedName;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IDrawable getBackground()
|
||||
{
|
||||
return background;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(Minecraft minecraft)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawAnimations(Minecraft minecraft)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper)
|
||||
{
|
||||
|
||||
recipeLayout.getItemStacks().init(INPUT_SLOT, true, 0, 0);
|
||||
recipeLayout.getItemStacks().init(OUTPUT_SLOT, false, 60, 18);
|
||||
recipeLayout.getItemStacks().init(FUEL_SLOT, true, 0, 36);
|
||||
|
||||
if (recipeWrapper instanceof ElectroextractorRecipeJEI)
|
||||
{
|
||||
ElectroextractorRecipeJEI electroextractorWrapper = (ElectroextractorRecipeJEI) recipeWrapper;
|
||||
recipeLayout.getItemStacks().set(INPUT_SLOT, electroextractorWrapper.getInputs());
|
||||
recipeLayout.getItemStacks().set(OUTPUT_SLOT, electroextractorWrapper.getOutputs());
|
||||
recipeLayout.getItemStacks().set(FUEL_SLOT, TileElectroextractor.getFuels());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.oitsjustjose.criss_cross.jei;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.oitsjustjose.criss_cross.lib.Lib;
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class ElectroextractorRecipeHandler implements IRecipeHandler<ElectroextractorRecipeJEI>
|
||||
{
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Class<ElectroextractorRecipeJEI> getRecipeClass()
|
||||
{
|
||||
return ElectroextractorRecipeJEI.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid()
|
||||
{
|
||||
return Lib.ELECTROEXTRACTOR_UID;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(@Nonnull ElectroextractorRecipeJEI recipe)
|
||||
{
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(@Nonnull ElectroextractorRecipeJEI recipe)
|
||||
{
|
||||
return recipe.getInputs().size() > 0 && recipe.getOutputs().size() > 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package com.oitsjustjose.criss_cross.jei;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ElectroextractorRecipeJEI extends BlankRecipeWrapper
|
||||
{
|
||||
|
||||
@Nonnull
|
||||
private final ItemStack input;
|
||||
|
||||
@Nonnull
|
||||
private final ItemStack output;
|
||||
|
||||
|
||||
public ElectroextractorRecipeJEI(@Nonnull ItemStack input, @Nonnull ItemStack output)
|
||||
{
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getInputs()
|
||||
{
|
||||
return Collections.singletonList(input);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getOutputs()
|
||||
{
|
||||
return Collections.singletonList(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.oitsjustjose.criss_cross.jei;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.oitsjustjose.criss_cross.recipes.machine.ElectroextractorRecipes;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ElectroextractorRecipeMaker
|
||||
{
|
||||
@Nonnull
|
||||
public static List<ElectroextractorRecipeJEI> getRecipes()
|
||||
{
|
||||
Map<ItemStack, ItemStack> electroextractorMap = ElectroextractorRecipes.getInstance().getRecipeList();
|
||||
|
||||
ArrayList<ElectroextractorRecipeJEI> recipes = new ArrayList<ElectroextractorRecipeJEI>();
|
||||
|
||||
for (Map.Entry<ItemStack, ItemStack> entry : electroextractorMap.entrySet())
|
||||
{
|
||||
ItemStack input = entry.getKey();
|
||||
ItemStack output = entry.getValue();
|
||||
|
||||
ElectroextractorRecipeJEI recipe = new ElectroextractorRecipeJEI(input, output);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
return recipes;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
package com.oitsjustjose.criss_cross.jei;
|
||||
|
||||
import mezz.jei.api.IItemRegistry;
|
||||
import mezz.jei.api.IJeiHelpers;
|
||||
import mezz.jei.api.IModPlugin;
|
||||
import mezz.jei.api.IModRegistry;
|
||||
import mezz.jei.api.IRecipeRegistry;
|
||||
import mezz.jei.api.JEIPlugin;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@JEIPlugin
|
||||
public class JEIPluginManager implements IModPlugin
|
||||
{
|
||||
|
||||
public static IJeiHelpers jeiHelper;
|
||||
|
||||
@Override
|
||||
public boolean isModLoaded()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onJeiHelpersAvailable(IJeiHelpers jeiHelpers)
|
||||
{
|
||||
jeiHelper = jeiHelpers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(IModRegistry registry)
|
||||
{
|
||||
registry.addRecipeCategories(new CropomatorCategory());
|
||||
registry.addRecipeHandlers(new CropomatorRecipeHandler());
|
||||
registry.addRecipes(CropomatorRecipeMaker.getRecipes());
|
||||
|
||||
registry.addRecipeCategories(new ElectroextractorCategory());
|
||||
registry.addRecipeHandlers(new ElectroextractorRecipeHandler());
|
||||
registry.addRecipes(ElectroextractorRecipeMaker.getRecipes());
|
||||
|
||||
registry.addRecipeCategories(new WoodchipperCategory());
|
||||
registry.addRecipeHandlers(new WoodchipperRecipeHandler());
|
||||
registry.addRecipes(WoodchipperRecipeMaker.getRecipes());
|
||||
|
||||
registry.addRecipeCategories(new ScribeCategory());
|
||||
registry.addRecipeHandlers(new ScribeRecipeHandler());
|
||||
registry.addRecipes(ScribeRecipeMaker.getRecipes());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemRegistryAvailable(IItemRegistry itemRegistry)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecipeRegistryAvailable(IRecipeRegistry recipeRegistry)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
package com.oitsjustjose.criss_cross.jei;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.oitsjustjose.criss_cross.gui.GUIScribe;
|
||||
import com.oitsjustjose.criss_cross.lib.Lib;
|
||||
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
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.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class ScribeCategory implements IRecipeCategory
|
||||
{
|
||||
private static final int INPUT_SLOT = 0;
|
||||
private static final int OUTPUT_SLOT = 1;
|
||||
private static final int FUEL_SLOT = 2;
|
||||
|
||||
@Nonnull
|
||||
private final IDrawable background = JEIPluginManager.jeiHelper.getGuiHelper().createDrawable(GUIScribe.backgroundTexture, 33, 30, 110, 34);
|
||||
@Nonnull
|
||||
private final String localizedName = StatCollector.translateToLocal("recipe.scribe");
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUid()
|
||||
{
|
||||
return Lib.SCRIBE_UID;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getTitle()
|
||||
{
|
||||
return localizedName;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IDrawable getBackground()
|
||||
{
|
||||
return background;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(Minecraft minecraft)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawAnimations(Minecraft minecraft)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper)
|
||||
{
|
||||
|
||||
recipeLayout.getItemStacks().init(INPUT_SLOT, true, 34, 4);
|
||||
recipeLayout.getItemStacks().init(OUTPUT_SLOT, false, 88, 4);
|
||||
recipeLayout.getItemStacks().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());
|
||||
recipeLayout.getItemStacks().set(FUEL_SLOT, new ItemStack(Items.writable_book));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.oitsjustjose.criss_cross.jei;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.oitsjustjose.criss_cross.lib.Lib;
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class ScribeRecipeHandler implements IRecipeHandler<ScribeRecipeJEI>
|
||||
{
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Class<ScribeRecipeJEI> getRecipeClass()
|
||||
{
|
||||
return ScribeRecipeJEI.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid()
|
||||
{
|
||||
return Lib.SCRIBE_UID;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(@Nonnull ScribeRecipeJEI recipe)
|
||||
{
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(@Nonnull ScribeRecipeJEI recipe)
|
||||
{
|
||||
return recipe.getInputs().size() > 0 && recipe.getOutputs().size() > 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package com.oitsjustjose.criss_cross.jei;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ScribeRecipeJEI extends BlankRecipeWrapper
|
||||
{
|
||||
|
||||
@Nonnull
|
||||
private final ItemStack input;
|
||||
|
||||
@Nonnull
|
||||
private final ItemStack output;
|
||||
|
||||
|
||||
public ScribeRecipeJEI(@Nonnull ItemStack input, @Nonnull ItemStack output)
|
||||
{
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getInputs()
|
||||
{
|
||||
return Collections.singletonList(input);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getOutputs()
|
||||
{
|
||||
return Collections.singletonList(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.oitsjustjose.criss_cross.jei;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.oitsjustjose.criss_cross.recipes.machine.ScribeRecipes;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ScribeRecipeMaker
|
||||
{
|
||||
@Nonnull
|
||||
public static List<ScribeRecipeJEI> getRecipes()
|
||||
{
|
||||
Map<ItemStack, ItemStack> scribeMap = ScribeRecipes.getInstance().getRecipeList();
|
||||
|
||||
ArrayList<ScribeRecipeJEI> recipes = new ArrayList<ScribeRecipeJEI>();
|
||||
|
||||
for (Map.Entry<ItemStack, ItemStack> entry : scribeMap.entrySet())
|
||||
{
|
||||
ItemStack input = entry.getKey();
|
||||
ItemStack output = entry.getValue();
|
||||
|
||||
ScribeRecipeJEI recipe = new ScribeRecipeJEI(input, output);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
return recipes;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
package com.oitsjustjose.criss_cross.jei;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.oitsjustjose.criss_cross.gui.GUIWoodchipper;
|
||||
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.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
|
||||
{
|
||||
private static final int INPUT_SLOT = 0;
|
||||
private static final int OUTPUT_SLOT = 1;
|
||||
private static final int FUEL_SLOT = 2;
|
||||
|
||||
@Nonnull
|
||||
private final IDrawable background = JEIPluginManager.jeiHelper.getGuiHelper().createDrawable(GUIWoodchipper.backgroundTexture, 55, 16, 82, 54);
|
||||
@Nonnull
|
||||
private final String localizedName = StatCollector.translateToLocal("recipe.woodchipper");
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUid()
|
||||
{
|
||||
return Lib.WOODCHIPPER_UID;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getTitle()
|
||||
{
|
||||
return localizedName;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IDrawable getBackground()
|
||||
{
|
||||
return background;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(Minecraft minecraft)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawAnimations(Minecraft minecraft)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper)
|
||||
{
|
||||
|
||||
recipeLayout.getItemStacks().init(INPUT_SLOT, true, 0, 0);
|
||||
recipeLayout.getItemStacks().init(OUTPUT_SLOT, false, 60, 18);
|
||||
recipeLayout.getItemStacks().init(FUEL_SLOT, true, 0, 36);
|
||||
|
||||
if (recipeWrapper instanceof WoodchipperRecipeJEI)
|
||||
{
|
||||
WoodchipperRecipeJEI woodchipperRecipeWrapper = (WoodchipperRecipeJEI) recipeWrapper;
|
||||
recipeLayout.getItemStacks().set(INPUT_SLOT, woodchipperRecipeWrapper.getInputs());
|
||||
recipeLayout.getItemStacks().set(OUTPUT_SLOT, woodchipperRecipeWrapper.getOutputs());
|
||||
recipeLayout.getItemStacks().set(FUEL_SLOT, TileWoodchipper.getFuels());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.oitsjustjose.criss_cross.jei;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.oitsjustjose.criss_cross.lib.Lib;
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class WoodchipperRecipeHandler implements IRecipeHandler<WoodchipperRecipeJEI>
|
||||
{
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Class<WoodchipperRecipeJEI> getRecipeClass()
|
||||
{
|
||||
return WoodchipperRecipeJEI.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid()
|
||||
{
|
||||
return Lib.WOODCHIPPER_UID;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(@Nonnull WoodchipperRecipeJEI recipe)
|
||||
{
|
||||
return recipe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(@Nonnull WoodchipperRecipeJEI recipe)
|
||||
{
|
||||
return recipe.getInputs().size() > 0 && recipe.getOutputs().size() > 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package com.oitsjustjose.criss_cross.jei;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class WoodchipperRecipeJEI extends BlankRecipeWrapper
|
||||
{
|
||||
|
||||
@Nonnull
|
||||
private final ItemStack input;
|
||||
|
||||
@Nonnull
|
||||
private final ItemStack output;
|
||||
|
||||
|
||||
public WoodchipperRecipeJEI(@Nonnull ItemStack input, @Nonnull ItemStack output)
|
||||
{
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getInputs()
|
||||
{
|
||||
return Collections.singletonList(input);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getOutputs()
|
||||
{
|
||||
return Collections.singletonList(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.oitsjustjose.criss_cross.jei;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.oitsjustjose.criss_cross.recipes.machine.WoodchipperRecipes;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class WoodchipperRecipeMaker
|
||||
{
|
||||
@Nonnull
|
||||
public static List<WoodchipperRecipeJEI> getRecipes()
|
||||
{
|
||||
Map<ItemStack, ItemStack> woodchipperMap = WoodchipperRecipes.getInstance().getRecipeList();
|
||||
|
||||
ArrayList<WoodchipperRecipeJEI> recipes = new ArrayList<WoodchipperRecipeJEI>();
|
||||
|
||||
for (Map.Entry<ItemStack, ItemStack> entry : woodchipperMap.entrySet())
|
||||
{
|
||||
ItemStack input = entry.getKey();
|
||||
ItemStack output = entry.getValue();
|
||||
|
||||
WoodchipperRecipeJEI recipe = new WoodchipperRecipeJEI(input, output);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
return recipes;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.NEI;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.oitsjustjose.criss_cross.Recipes.CropomatorRecipes;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class CropomatorFuelHandler extends CropomatorRecipeHandler
|
||||
{
|
||||
public class CachedFuelRecipe extends CachedRecipe
|
||||
{
|
||||
public FuelPair fuel;
|
||||
|
||||
public CachedFuelRecipe(FuelPair fuel)
|
||||
{
|
||||
this.fuel = fuel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getIngredient()
|
||||
{
|
||||
return mCropomator.get(cycleticks / 48 % mCropomator.size()).ingred;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult()
|
||||
{
|
||||
return mCropomator.get(cycleticks / 48 % mCropomator.size()).result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getOtherStack()
|
||||
{
|
||||
return fuel.stack;
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList<CropomatorPair> mCropomator = new ArrayList<CropomatorRecipeHandler.CropomatorPair>();
|
||||
|
||||
public CropomatorFuelHandler()
|
||||
{
|
||||
super();
|
||||
loadAllRecipes();
|
||||
}
|
||||
|
||||
public String getRecipeName()
|
||||
{
|
||||
return StatCollector.translateToLocal("recipe.cropomatorfuel");
|
||||
}
|
||||
|
||||
private void loadAllRecipes()
|
||||
{
|
||||
Map<ItemStack, ItemStack> recipes = CropomatorRecipes.getInstance().getRecipeList();
|
||||
|
||||
for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
|
||||
this.mCropomator.add(new CropomatorPair(recipe.getKey(), recipe.getValue()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results)
|
||||
{
|
||||
if(outputId.equals("cropomatorfuel"))
|
||||
for(FuelPair fuel : afuels)
|
||||
arecipes.add(new CachedFuelRecipe(fuel));
|
||||
}
|
||||
|
||||
public void loadUsageRecipes(ItemStack ingredient)
|
||||
{
|
||||
for(FuelPair fuel : afuels)
|
||||
if(fuel.stack.contains(ingredient))
|
||||
arecipes.add(new CachedFuelRecipe(fuel));
|
||||
}
|
||||
|
||||
public String getOverlayIdentifier()
|
||||
{
|
||||
return "cropomatorfuel";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,172 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.NEI;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.oitsjustjose.criss_cross.GUI.GUICropomator;
|
||||
import com.oitsjustjose.criss_cross.Recipes.CropomatorRecipes;
|
||||
import com.oitsjustjose.criss_cross.TileEntity.TileEntityCropomator;
|
||||
import com.oitsjustjose.criss_cross.Util.ConfigHandler;
|
||||
|
||||
import codechicken.nei.ItemList;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class CropomatorRecipeHandler extends TemplateRecipeHandler
|
||||
{
|
||||
public class CropomatorPair extends CachedRecipe
|
||||
{
|
||||
public CropomatorPair(ItemStack ingred, ItemStack result)
|
||||
{
|
||||
ingred.stackSize = 1;
|
||||
this.ingred = new PositionedStack(ingred, 51, 6);
|
||||
this.result = new PositionedStack(result, 111, 24);
|
||||
}
|
||||
|
||||
public List<PositionedStack> getIngredients()
|
||||
{
|
||||
return getCycledIngredients(cycleticks / 48, Arrays.asList(ingred));
|
||||
}
|
||||
|
||||
public PositionedStack getResult()
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
public PositionedStack getOtherStack()
|
||||
{
|
||||
return afuels.get((cycleticks / 48) % afuels.size()).stack;
|
||||
}
|
||||
|
||||
PositionedStack ingred;
|
||||
PositionedStack result;
|
||||
}
|
||||
|
||||
public static class FuelPair
|
||||
{
|
||||
public FuelPair(ItemStack ingred)
|
||||
{
|
||||
this.stack = new PositionedStack(ingred, 51, 42, false);
|
||||
this.burnTime = ConfigHandler.cropomatorProcessTime;
|
||||
}
|
||||
|
||||
public PositionedStack stack;
|
||||
public int burnTime;
|
||||
}
|
||||
|
||||
public static ArrayList<FuelPair> afuels;
|
||||
public static HashSet<Block> efuels;
|
||||
|
||||
@Override
|
||||
public void loadTransferRects()
|
||||
{
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(50, 23, 18, 18), "cropomatorfuel"));
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(74, 23, 24, 18), "cropomator"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass()
|
||||
{
|
||||
return GUICropomator.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
return StatCollector.translateToLocal("recipe.cropomator");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TemplateRecipeHandler newInstance()
|
||||
{
|
||||
if(afuels == null || afuels.isEmpty())
|
||||
findFuels();
|
||||
return super.newInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results)
|
||||
{
|
||||
if(outputId.equals("cropomator") && getClass() == CropomatorRecipeHandler.class)
|
||||
{
|
||||
Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) CropomatorRecipes.getInstance()
|
||||
.getRecipeList();
|
||||
for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
|
||||
arecipes.add(new CropomatorPair(recipe.getKey(), recipe.getValue()));
|
||||
}
|
||||
else
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result)
|
||||
{
|
||||
Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) CropomatorRecipes.getInstance().getRecipeList();
|
||||
for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
|
||||
if(NEIServerUtils.areStacksSameType(recipe.getValue(), result))
|
||||
arecipes.add(new CropomatorPair(recipe.getKey(), recipe.getValue()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(String inputId, Object... ingredients)
|
||||
{
|
||||
if(inputId.equals("cropomatorfuel") && getClass() == CropomatorRecipeHandler.class)
|
||||
loadCraftingRecipes("cropomator");
|
||||
else
|
||||
super.loadUsageRecipes(inputId, ingredients);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient)
|
||||
{
|
||||
Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) CropomatorRecipes.getInstance().getRecipeList();
|
||||
for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
|
||||
{
|
||||
if(NEIServerUtils.areStacksSameTypeCrafting(recipe.getKey(), ingredient))
|
||||
{
|
||||
CropomatorPair arecipe = new CropomatorPair(recipe.getKey(), recipe.getValue());
|
||||
arecipe.setIngredientPermutation(Arrays.asList(arecipe.ingred), ingredient);
|
||||
arecipes.add(arecipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture()
|
||||
{
|
||||
return GUICropomator.texture.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int recipe)
|
||||
{
|
||||
drawProgressBar(51, 25, 176, 0, 14, 14, 48, 7);
|
||||
drawProgressBar(74, 23, 176, 14, 24, 16, 48, 0);
|
||||
}
|
||||
|
||||
private static void findFuels()
|
||||
{
|
||||
afuels = new ArrayList<FuelPair>();
|
||||
for(ItemStack item : ItemList.items)
|
||||
{
|
||||
if(TileEntityCropomator.isItemCatalyst(item))
|
||||
afuels.add(new FuelPair(item));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverlayIdentifier()
|
||||
{
|
||||
return "cropomator";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.NEI;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.oitsjustjose.criss_cross.Recipes.ElectroextractorRecipes;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class ElectroextractorFuelHandler extends ElectroextractorRecipeHandler
|
||||
{
|
||||
public class CachedFuelRecipe extends CachedRecipe
|
||||
{
|
||||
public FuelPair fuel;
|
||||
|
||||
public CachedFuelRecipe(FuelPair fuel)
|
||||
{
|
||||
this.fuel = fuel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getIngredient()
|
||||
{
|
||||
return mElectroextractor.get(cycleticks / 48 % mElectroextractor.size()).ingred;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult()
|
||||
{
|
||||
return mElectroextractor.get(cycleticks / 48 % mElectroextractor.size()).result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getOtherStack()
|
||||
{
|
||||
return fuel.stack;
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList<ElectroextractorPair> mElectroextractor = new ArrayList<ElectroextractorRecipeHandler.ElectroextractorPair>();
|
||||
|
||||
public ElectroextractorFuelHandler()
|
||||
{
|
||||
super();
|
||||
loadAllRecipes();
|
||||
}
|
||||
|
||||
public String getRecipeName()
|
||||
{
|
||||
return StatCollector.translateToLocal("recipe.electroextractorfuel");
|
||||
}
|
||||
|
||||
private void loadAllRecipes()
|
||||
{
|
||||
Map<ItemStack, ItemStack> recipes = ElectroextractorRecipes.getInstance().getRecipeList();
|
||||
|
||||
for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
|
||||
this.mElectroextractor.add(new ElectroextractorPair(recipe.getKey(), recipe.getValue()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results)
|
||||
{
|
||||
if(outputId.equals("Electroextractorfuel"))
|
||||
for(FuelPair fuel : afuels)
|
||||
arecipes.add(new CachedFuelRecipe(fuel));
|
||||
}
|
||||
|
||||
public void loadUsageRecipes(ItemStack ingredient)
|
||||
{
|
||||
for(FuelPair fuel : afuels)
|
||||
if(fuel.stack.contains(ingredient))
|
||||
arecipes.add(new CachedFuelRecipe(fuel));
|
||||
}
|
||||
|
||||
public String getOverlayIdentifier()
|
||||
{
|
||||
return "electroextractorfuel";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,174 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.NEI;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.oitsjustjose.criss_cross.GUI.GUIElectroextractor;
|
||||
import com.oitsjustjose.criss_cross.Recipes.ElectroextractorRecipes;
|
||||
import com.oitsjustjose.criss_cross.TileEntity.TileEntityElectroextractor;
|
||||
import com.oitsjustjose.criss_cross.Util.ConfigHandler;
|
||||
|
||||
import codechicken.nei.ItemList;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class ElectroextractorRecipeHandler extends TemplateRecipeHandler
|
||||
{
|
||||
public class ElectroextractorPair extends CachedRecipe
|
||||
{
|
||||
public ElectroextractorPair(ItemStack ingred, ItemStack result)
|
||||
{
|
||||
ingred.stackSize = 1;
|
||||
this.ingred = new PositionedStack(ingred, 51, 6);
|
||||
this.result = new PositionedStack(result, 111, 24);
|
||||
}
|
||||
|
||||
public List<PositionedStack> getIngredients()
|
||||
{
|
||||
return getCycledIngredients(cycleticks / 48, Arrays.asList(ingred));
|
||||
}
|
||||
|
||||
public PositionedStack getResult()
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
public PositionedStack getOtherStack()
|
||||
{
|
||||
return afuels.get((cycleticks / 48) % afuels.size()).stack;
|
||||
}
|
||||
|
||||
PositionedStack ingred;
|
||||
PositionedStack result;
|
||||
}
|
||||
|
||||
public static class FuelPair
|
||||
{
|
||||
public FuelPair(ItemStack ingred)
|
||||
{
|
||||
this.stack = new PositionedStack(ingred, 51, 42, false);
|
||||
this.burnTime = ConfigHandler.electroextractorProcessTime;
|
||||
}
|
||||
|
||||
public PositionedStack stack;
|
||||
public int burnTime;
|
||||
}
|
||||
|
||||
public static ArrayList<FuelPair> afuels;
|
||||
public static HashSet<Block> efuels;
|
||||
|
||||
@Override
|
||||
public void loadTransferRects()
|
||||
{
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(50, 23, 18, 18), "Electroextractorfuel"));
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(74, 23, 24, 18), "Electroextractor"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass()
|
||||
{
|
||||
return GUIElectroextractor.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
return StatCollector.translateToLocal("recipe.electroextractor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TemplateRecipeHandler newInstance()
|
||||
{
|
||||
if(afuels == null || afuels.isEmpty())
|
||||
findFuels();
|
||||
return super.newInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results)
|
||||
{
|
||||
if(outputId.equals("Electroextractor") && getClass() == ElectroextractorRecipeHandler.class)
|
||||
{
|
||||
Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) ElectroextractorRecipes.getInstance()
|
||||
.getRecipeList();
|
||||
for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
|
||||
arecipes.add(new ElectroextractorPair(recipe.getKey(), recipe.getValue()));
|
||||
}
|
||||
else
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result)
|
||||
{
|
||||
Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) ElectroextractorRecipes.getInstance()
|
||||
.getRecipeList();
|
||||
for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
|
||||
if(NEIServerUtils.areStacksSameType(recipe.getValue(), result))
|
||||
arecipes.add(new ElectroextractorPair(recipe.getKey(), recipe.getValue()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(String inputId, Object... ingredients)
|
||||
{
|
||||
if(inputId.equals("Electroextractorfuel") && getClass() == ElectroextractorRecipeHandler.class)
|
||||
loadCraftingRecipes("Electroextractor");
|
||||
else
|
||||
super.loadUsageRecipes(inputId, ingredients);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient)
|
||||
{
|
||||
Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) ElectroextractorRecipes.getInstance()
|
||||
.getRecipeList();
|
||||
for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
|
||||
{
|
||||
if(NEIServerUtils.areStacksSameTypeCrafting(recipe.getKey(), ingredient))
|
||||
{
|
||||
ElectroextractorPair arecipe = new ElectroextractorPair(recipe.getKey(), recipe.getValue());
|
||||
arecipe.setIngredientPermutation(Arrays.asList(arecipe.ingred), ingredient);
|
||||
arecipes.add(arecipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture()
|
||||
{
|
||||
return GUIElectroextractor.texture.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int recipe)
|
||||
{
|
||||
drawProgressBar(51, 25, 176, 0, 14, 14, 48, 7);
|
||||
drawProgressBar(74, 23, 176, 14, 24, 16, 48, 0);
|
||||
}
|
||||
|
||||
private static void findFuels()
|
||||
{
|
||||
afuels = new ArrayList<FuelPair>();
|
||||
for(ItemStack item : ItemList.items)
|
||||
{
|
||||
if(TileEntityElectroextractor.isItemEnergetic(item))
|
||||
afuels.add(new FuelPair(item));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverlayIdentifier()
|
||||
{
|
||||
return "electroextractor";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.NEI;
|
||||
|
||||
import com.oitsjustjose.criss_cross.GUI.GUICropomator;
|
||||
import com.oitsjustjose.criss_cross.GUI.GUIElectroextractor;
|
||||
import com.oitsjustjose.criss_cross.GUI.GUIWoodchipper;
|
||||
import com.oitsjustjose.criss_cross.Util.Reference;
|
||||
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.api.IConfigureNEI;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
|
||||
public class NEICrissCrossConfig implements IConfigureNEI
|
||||
{
|
||||
@Override
|
||||
public void loadConfig()
|
||||
{
|
||||
registerHandler(new CropomatorFuelHandler());
|
||||
registerHandler(new CropomatorRecipeHandler());
|
||||
registerHandler(new ElectroextractorFuelHandler());
|
||||
registerHandler(new ElectroextractorRecipeHandler());
|
||||
registerHandler(new WoodchipperFuelHandler());
|
||||
registerHandler(new WoodchipperRecipeHandler());
|
||||
API.registerGuiOverlay(GUICropomator.class, "cropomator");
|
||||
API.registerGuiOverlay(GUIElectroextractor.class, "electroextractor");
|
||||
API.registerGuiOverlay(GUIWoodchipper.class, "woodchipper");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return Reference.modid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion()
|
||||
{
|
||||
return Reference.version;
|
||||
}
|
||||
|
||||
private static void registerHandler(TemplateRecipeHandler handler)
|
||||
{
|
||||
API.registerRecipeHandler(handler);
|
||||
API.registerUsageHandler(handler);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.NEI;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.oitsjustjose.criss_cross.Recipes.WoodchipperRecipes;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class WoodchipperFuelHandler extends WoodchipperRecipeHandler
|
||||
{
|
||||
public class CachedFuelRecipe extends CachedRecipe
|
||||
{
|
||||
public FuelPair fuel;
|
||||
|
||||
public CachedFuelRecipe(FuelPair fuel)
|
||||
{
|
||||
this.fuel = fuel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getIngredient()
|
||||
{
|
||||
return mWoodchipper.get(cycleticks / 48 % mWoodchipper.size()).ingred;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult()
|
||||
{
|
||||
return mWoodchipper.get(cycleticks / 48 % mWoodchipper.size()).result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getOtherStack()
|
||||
{
|
||||
return fuel.stack;
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList<WoodchipperPair> mWoodchipper = new ArrayList<WoodchipperRecipeHandler.WoodchipperPair>();
|
||||
|
||||
public WoodchipperFuelHandler()
|
||||
{
|
||||
super();
|
||||
loadAllRecipes();
|
||||
}
|
||||
|
||||
public String getRecipeName()
|
||||
{
|
||||
return StatCollector.translateToLocal("recipe.woodchipperfuel");
|
||||
}
|
||||
|
||||
private void loadAllRecipes()
|
||||
{
|
||||
Map<ItemStack, ItemStack> recipes = WoodchipperRecipes.getInstance().getRecipeList();
|
||||
|
||||
for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
|
||||
this.mWoodchipper.add(new WoodchipperPair(recipe.getKey(), recipe.getValue()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results)
|
||||
{
|
||||
if(outputId.equals("woodchipperfuel"))
|
||||
for(FuelPair fuel : afuels)
|
||||
arecipes.add(new CachedFuelRecipe(fuel));
|
||||
}
|
||||
|
||||
public void loadUsageRecipes(ItemStack ingredient)
|
||||
{
|
||||
for(FuelPair fuel : afuels)
|
||||
if(fuel.stack.contains(ingredient))
|
||||
arecipes.add(new CachedFuelRecipe(fuel));
|
||||
}
|
||||
|
||||
public String getOverlayIdentifier()
|
||||
{
|
||||
return "woodchipperfuel";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,174 +0,0 @@
|
|||
package com.oitsjustjose.criss_cross.NEI;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.oitsjustjose.criss_cross.GUI.GUIWoodchipper;
|
||||
import com.oitsjustjose.criss_cross.Recipes.WoodchipperRecipes;
|
||||
import com.oitsjustjose.criss_cross.TileEntity.TileEntityWoodchipper;
|
||||
import com.oitsjustjose.criss_cross.Util.ConfigHandler;
|
||||
|
||||
import codechicken.nei.ItemList;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class WoodchipperRecipeHandler extends TemplateRecipeHandler
|
||||
{
|
||||
public class WoodchipperPair extends CachedRecipe
|
||||
{
|
||||
public WoodchipperPair(ItemStack ingred, ItemStack result)
|
||||
{
|
||||
ingred.stackSize = 1;
|
||||
this.ingred = new PositionedStack(ingred, 51, 6);
|
||||
this.result = new PositionedStack(result, 111, 24);
|
||||
}
|
||||
|
||||
public List<PositionedStack> getIngredients()
|
||||
{
|
||||
return getCycledIngredients(cycleticks / 48, Arrays.asList(ingred));
|
||||
}
|
||||
|
||||
public PositionedStack getResult()
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
public PositionedStack getOtherStack()
|
||||
{
|
||||
return afuels.get((cycleticks / 48) % afuels.size()).stack;
|
||||
}
|
||||
|
||||
PositionedStack ingred;
|
||||
PositionedStack result;
|
||||
}
|
||||
|
||||
public static class FuelPair
|
||||
{
|
||||
public FuelPair(ItemStack ingred)
|
||||
{
|
||||
this.stack = new PositionedStack(ingred, 51, 42, false);
|
||||
this.burnTime = ConfigHandler.woodchipperProcessTime;
|
||||
}
|
||||
|
||||
public PositionedStack stack;
|
||||
public int burnTime;
|
||||
}
|
||||
|
||||
public static ArrayList<FuelPair> afuels;
|
||||
public static HashSet<Block> efuels;
|
||||
|
||||
@Override
|
||||
public void loadTransferRects()
|
||||
{
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(50, 23, 18, 18), "woodchipperfuel"));
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(74, 23, 24, 18), "woodchipper"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass()
|
||||
{
|
||||
return GUIWoodchipper.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
return StatCollector.translateToLocal("recipe.woodchipper");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TemplateRecipeHandler newInstance()
|
||||
{
|
||||
if(afuels == null || afuels.isEmpty())
|
||||
findFuels();
|
||||
return super.newInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results)
|
||||
{
|
||||
if(outputId.equals("woodchipper") && getClass() == WoodchipperRecipeHandler.class)
|
||||
{
|
||||
Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) WoodchipperRecipes.getInstance()
|
||||
.getRecipeList();
|
||||
for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
|
||||
arecipes.add(new WoodchipperPair(recipe.getKey(), recipe.getValue()));
|
||||
}
|
||||
else
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result)
|
||||
{
|
||||
Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) WoodchipperRecipes.getInstance()
|
||||
.getRecipeList();
|
||||
for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
|
||||
if(NEIServerUtils.areStacksSameType(recipe.getValue(), result))
|
||||
arecipes.add(new WoodchipperPair(recipe.getKey(), recipe.getValue()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(String inputId, Object... ingredients)
|
||||
{
|
||||
if(inputId.equals("woodchipperfuel") && getClass() == WoodchipperRecipeHandler.class)
|
||||
loadCraftingRecipes("woodchipper");
|
||||
else
|
||||
super.loadUsageRecipes(inputId, ingredients);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient)
|
||||
{
|
||||
Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) WoodchipperRecipes.getInstance()
|
||||
.getRecipeList();
|
||||
for(Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
|
||||
{
|
||||
if(NEIServerUtils.areStacksSameTypeCrafting(recipe.getKey(), ingredient))
|
||||
{
|
||||
WoodchipperPair arecipe = new WoodchipperPair(recipe.getKey(), recipe.getValue());
|
||||
arecipe.setIngredientPermutation(Arrays.asList(arecipe.ingred), ingredient);
|
||||
arecipes.add(arecipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture()
|
||||
{
|
||||
return GUIWoodchipper.texture.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int recipe)
|
||||
{
|
||||
drawProgressBar(51, 25, 176, 0, 14, 14, 48, 7);
|
||||
drawProgressBar(74, 23, 176, 14, 24, 16, 48, 0);
|
||||
}
|
||||
|
||||
private static void findFuels()
|
||||
{
|
||||
afuels = new ArrayList<FuelPair>();
|
||||
for(ItemStack item : ItemList.items)
|
||||
{
|
||||
if(TileEntityWoodchipper.isItemFuel(item))
|
||||
afuels.add(new FuelPair(item));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverlayIdentifier()
|
||||
{
|
||||
return "woodchipper";
|
||||
}
|
||||
}
|
||||
|
|
@ -33,13 +33,12 @@ container.atmosmanipulator=Atmos Manipulator
|
|||
button.sun=§eSun Creator§r
|
||||
button.rain=§1Rain Creator§r
|
||||
|
||||
#NEI Integration
|
||||
recipe.cropomatorfuel=Cropomator Fuels
|
||||
#JEI Compat
|
||||
recipe.cropomator=Cropomator
|
||||
recipe.electroextractor=ElectroExtractor
|
||||
recipe.electroextractorfuel=ElectorExtractor Fuels
|
||||
recipe.scribe=Scribe
|
||||
recipe.woodchipper=Wood Chipper
|
||||
recipe.woodchipperfuel=Wood Chipper Fuels
|
||||
|
||||
|
||||
#Tab
|
||||
itemGroup.tabCrissCross=Criss Cross
|
||||
Loading…
Reference in a new issue