NEI Integration!! >>Thanks CB for your Source Code
This commit is contained in:
parent
fec8d154eb
commit
e4803a3965
16 changed files with 925 additions and 74 deletions
|
|
@ -0,0 +1,83 @@
|
||||||
|
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";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,172 @@
|
||||||
|
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";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,83 @@
|
||||||
|
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";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,172 @@
|
||||||
|
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";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,83 @@
|
||||||
|
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";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,172 @@
|
||||||
|
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";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -11,6 +11,8 @@ import com.oitsjustjose.criss_cross.Util.CCLog;
|
||||||
import com.oitsjustjose.criss_cross.Util.ConfigHandler;
|
import com.oitsjustjose.criss_cross.Util.ConfigHandler;
|
||||||
|
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockLog;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
@ -21,6 +23,7 @@ public class CCMachineRecipes
|
||||||
public static int cropomatorQTY = ConfigHandler.cropomatorOutput;
|
public static int cropomatorQTY = ConfigHandler.cropomatorOutput;
|
||||||
public static int electroQTY = ConfigHandler.electroextractorOutput;
|
public static int electroQTY = ConfigHandler.electroextractorOutput;
|
||||||
public static int woodchipperQTY = ConfigHandler.woodchipperOutput;
|
public static int woodchipperQTY = ConfigHandler.woodchipperOutput;
|
||||||
|
|
||||||
public static void init()
|
public static void init()
|
||||||
{
|
{
|
||||||
initCropomatorRecipes();
|
initCropomatorRecipes();
|
||||||
|
|
@ -30,11 +33,14 @@ public class CCMachineRecipes
|
||||||
initWoodchipperFuels();
|
initWoodchipperFuels();
|
||||||
initWoodchipperOreDictionary();
|
initWoodchipperOreDictionary();
|
||||||
|
|
||||||
ElectroextractorRecipes.getInstance().addRecipe(new ItemStack(Blocks.diamond_ore), new ItemStack(Items.diamond, electroQTY));
|
ElectroextractorRecipes.getInstance().addRecipe(new ItemStack(Blocks.diamond_ore),
|
||||||
ElectroextractorRecipes.getInstance().addRecipe(new ItemStack(Blocks.emerald_ore), new ItemStack(Items.emerald, electroQTY));
|
new ItemStack(Items.diamond, electroQTY));
|
||||||
ElectroextractorRecipes.getInstance().addRecipe(new ItemStack(Blocks.coal_ore), new ItemStack(Items.coal, electroQTY));
|
ElectroextractorRecipes.getInstance().addRecipe(new ItemStack(Blocks.emerald_ore),
|
||||||
|
new ItemStack(Items.emerald, electroQTY));
|
||||||
|
ElectroextractorRecipes.getInstance().addRecipe(new ItemStack(Blocks.coal_ore),
|
||||||
|
new ItemStack(Items.coal, electroQTY));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initCropomatorRecipes()
|
public static void initCropomatorRecipes()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < ConfigHandler.cropomatorInputs.length; i++)
|
for (int i = 0; i < ConfigHandler.cropomatorInputs.length; i++)
|
||||||
|
|
@ -47,12 +53,12 @@ public class CCMachineRecipes
|
||||||
if (GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null)
|
if (GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null)
|
||||||
{
|
{
|
||||||
ItemStack newStack = GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1);
|
ItemStack newStack = GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1);
|
||||||
newStack.stackSize = cropomatorQTY;
|
CropomatorRecipes.getInstance().addRecipe(newStack, new ItemStack(newStack.getItem(), cropomatorQTY, newStack.getItemDamage()));
|
||||||
CropomatorRecipes.getInstance().addRecipe(newStack, newStack);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CCLog.warn("Item " + ConfigHandler.cropomatorInputs[i] + " could not be added to the Cropomator's recipe list.");
|
CCLog.warn("Item " + ConfigHandler.cropomatorInputs[i]
|
||||||
|
+ " could not be added to the Cropomator's recipe list.");
|
||||||
CCLog.warn("Please confirm you have the name and formatting correct.");
|
CCLog.warn("Please confirm you have the name and formatting correct.");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -61,13 +67,16 @@ public class CCMachineRecipes
|
||||||
{
|
{
|
||||||
if (GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null)
|
if (GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null)
|
||||||
{
|
{
|
||||||
ItemStack newStack = new ItemStack(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1).getItem(), 1, Integer.parseInt(unlocStack[2]));
|
ItemStack newStack = new ItemStack(
|
||||||
|
GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1).getItem(), 1,
|
||||||
|
Integer.parseInt(unlocStack[2]));
|
||||||
newStack.stackSize = cropomatorQTY;
|
newStack.stackSize = cropomatorQTY;
|
||||||
CropomatorRecipes.getInstance().addRecipe(newStack, newStack);
|
CropomatorRecipes.getInstance().addRecipe(newStack, new ItemStack(newStack.getItem(), cropomatorQTY, newStack.getItemDamage()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CCLog.warn("Item " + ConfigHandler.cropomatorInputs[i] + " could not be added to the Cropomator's recipe list.");
|
CCLog.warn("Item " + ConfigHandler.cropomatorInputs[i]
|
||||||
|
+ " could not be added to the Cropomator's recipe list.");
|
||||||
CCLog.warn("Please confirm you have the name and formatting correct.");
|
CCLog.warn("Please confirm you have the name and formatting correct.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -90,8 +99,7 @@ public class CCMachineRecipes
|
||||||
if (unlocStack.length == 2)
|
if (unlocStack.length == 2)
|
||||||
{
|
{
|
||||||
if (GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null)
|
if (GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null)
|
||||||
TileEntityCropomator
|
TileEntityCropomator.addFuel(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1));
|
||||||
.addFuel(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1));
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CCLog.warn("Item " + ConfigHandler.cropomatorInputs[i]
|
CCLog.warn("Item " + ConfigHandler.cropomatorInputs[i]
|
||||||
|
|
@ -123,7 +131,7 @@ public class CCMachineRecipes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initWoodchipperOreDictionary()
|
public static void initWoodchipperOreDictionary()
|
||||||
{
|
{
|
||||||
ArrayList<ItemStack> logs = OreDictionary.getOres("logWood");
|
ArrayList<ItemStack> logs = OreDictionary.getOres("logWood");
|
||||||
|
|
@ -153,8 +161,19 @@ public class CCMachineRecipes
|
||||||
plank.stackSize = woodchipperQTY;
|
plank.stackSize = woodchipperQTY;
|
||||||
if (plankName.contains(logName))
|
if (plankName.contains(logName))
|
||||||
{
|
{
|
||||||
WoodchipperRecipes.getInstance().addRecipe(log, plank);
|
if(Block.getBlockFromItem(log.getItem()) instanceof BlockLog)
|
||||||
break;
|
{
|
||||||
|
if(log.getDisplayName().contains("Acacia"))
|
||||||
|
{
|
||||||
|
if(log.getItemDamage() == 0)
|
||||||
|
WoodchipperRecipes.getInstance().addRecipe(log, plank);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(log.getItemDamage() < 4)
|
||||||
|
WoodchipperRecipes.getInstance().addRecipe(log, plank);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
WoodchipperRecipes.getInstance().addRecipe(log, plank);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -204,7 +223,7 @@ public class CCMachineRecipes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void initElectroextractorFuels()
|
static void initElectroextractorFuels()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < ConfigHandler.electroextractorEnergySources.length; i++)
|
for (int i = 0; i < ConfigHandler.electroextractorEnergySources.length; i++)
|
||||||
|
|
@ -247,7 +266,7 @@ public class CCMachineRecipes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void initElectroextractorOreDictionary()
|
static void initElectroextractorOreDictionary()
|
||||||
{
|
{
|
||||||
ArrayList<String> dustNames = ItemDust.getDusts();
|
ArrayList<String> dustNames = ItemDust.getDusts();
|
||||||
|
|
@ -259,7 +278,8 @@ public class CCMachineRecipes
|
||||||
ArrayList<ItemStack> ores = OreDictionary.getOres("ore" + entry[0]);
|
ArrayList<ItemStack> ores = OreDictionary.getOres("ore" + entry[0]);
|
||||||
ItemDust.addDustType(entry[0], Integer.parseInt(entry[1]));
|
ItemDust.addDustType(entry[0], Integer.parseInt(entry[1]));
|
||||||
for (int j = 0; j < ores.size(); j++)
|
for (int j = 0; j < ores.size(); j++)
|
||||||
ElectroextractorRecipes.getInstance().addRecipe(ores.get(j), new ItemStack(CCItems.dusts, electroQTY, dustNames.size() - 1));
|
ElectroextractorRecipes.getInstance().addRecipe(ores.get(j),
|
||||||
|
new ItemStack(CCItems.dusts, electroQTY, dustNames.size() - 1));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,54 +1,57 @@
|
||||||
package com.oitsjustjose.criss_cross.Recipes;
|
package com.oitsjustjose.criss_cross.Recipes;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
|
||||||
|
|
||||||
public class CropomatorRecipes
|
public class CropomatorRecipes
|
||||||
{
|
{
|
||||||
private static final CropomatorRecipes recipeBase = new CropomatorRecipes();
|
private static final CropomatorRecipes recipeBase = new CropomatorRecipes();
|
||||||
private Map recipes = Maps.newHashMap();
|
public static final ArrayList<ItemStack> inputs = new ArrayList<ItemStack>();
|
||||||
|
public static final ArrayList<ItemStack> outputs = new ArrayList<ItemStack>();
|
||||||
|
|
||||||
|
private Map recipes = Maps.newHashMap();
|
||||||
|
|
||||||
public static CropomatorRecipes getInstance()
|
public static CropomatorRecipes getInstance()
|
||||||
{
|
{
|
||||||
return recipeBase;
|
return recipeBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addRecipe(ItemStack input, ItemStack stack)
|
public void addRecipe(ItemStack input, ItemStack stack)
|
||||||
{
|
{
|
||||||
this.recipes.put(input, stack);
|
this.recipes.put(input, stack);
|
||||||
|
inputs.add(input);
|
||||||
|
outputs.add(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getResult(ItemStack stack)
|
public ItemStack getResult(ItemStack stack)
|
||||||
{
|
{
|
||||||
Iterator iterator = this.recipes.entrySet().iterator();
|
Iterator iterator = this.recipes.entrySet().iterator();
|
||||||
Entry entry;
|
Entry entry;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (!iterator.hasNext())
|
if (!iterator.hasNext())
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
entry = (Entry) iterator.next();
|
entry = (Entry) iterator.next();
|
||||||
}
|
}
|
||||||
while (!this.compareItemStacks(stack, (ItemStack) entry.getKey()));
|
while (!this.compareItemStacks(stack, (ItemStack) entry.getKey()));
|
||||||
|
|
||||||
return (ItemStack) entry.getValue();
|
return (ItemStack) entry.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean compareItemStacks(ItemStack stack1, ItemStack stack2)
|
private boolean compareItemStacks(ItemStack stack1, ItemStack stack2)
|
||||||
{
|
{
|
||||||
return stack2.getItem() == stack1.getItem() && (stack2.getItemDamage() == 32767 || stack2.getItemDamage() == stack1.getItemDamage());
|
return stack2.getItem() == stack1.getItem()
|
||||||
|
&& (stack2.getItemDamage() == 32767 || stack2.getItemDamage() == stack1.getItemDamage());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map getRecipeList()
|
public Map getRecipeList()
|
||||||
{
|
{
|
||||||
return this.recipes;
|
return this.recipes;
|
||||||
|
|
|
||||||
|
|
@ -15,40 +15,41 @@ import net.minecraftforge.oredict.OreDictionary;
|
||||||
public class ElectroextractorRecipes
|
public class ElectroextractorRecipes
|
||||||
{
|
{
|
||||||
private static final ElectroextractorRecipes recipeBase = new ElectroextractorRecipes();
|
private static final ElectroextractorRecipes recipeBase = new ElectroextractorRecipes();
|
||||||
private Map recipes = Maps.newHashMap();
|
private Map recipes = Maps.newHashMap();
|
||||||
|
|
||||||
public static ElectroextractorRecipes getInstance()
|
public static ElectroextractorRecipes getInstance()
|
||||||
{
|
{
|
||||||
return recipeBase;
|
return recipeBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addRecipe(ItemStack input, ItemStack stack)
|
public void addRecipe(ItemStack input, ItemStack stack)
|
||||||
{
|
{
|
||||||
this.recipes.put(input, stack);
|
this.recipes.put(input, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getResult(ItemStack stack)
|
public ItemStack getResult(ItemStack stack)
|
||||||
{
|
{
|
||||||
Iterator iterator = this.recipes.entrySet().iterator();
|
Iterator iterator = this.recipes.entrySet().iterator();
|
||||||
Entry entry;
|
Entry entry;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (!iterator.hasNext())
|
if (!iterator.hasNext())
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
entry = (Entry) iterator.next();
|
entry = (Entry) iterator.next();
|
||||||
}
|
}
|
||||||
while (!this.compareItemStacks(stack, (ItemStack) entry.getKey()));
|
while (!this.compareItemStacks(stack, (ItemStack) entry.getKey()));
|
||||||
|
|
||||||
return (ItemStack) entry.getValue();
|
return (ItemStack) entry.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean compareItemStacks(ItemStack stack1, ItemStack stack2)
|
private boolean compareItemStacks(ItemStack stack1, ItemStack stack2)
|
||||||
{
|
{
|
||||||
return stack2.getItem() == stack1.getItem() && (stack2.getItemDamage() == 32767 || stack2.getItemDamage() == stack1.getItemDamage());
|
return stack2.getItem() == stack1.getItem()
|
||||||
|
&& (stack2.getItemDamage() == 32767 || stack2.getItemDamage() == stack1.getItemDamage());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map getRecipeList()
|
public Map getRecipeList()
|
||||||
{
|
{
|
||||||
return this.recipes;
|
return this.recipes;
|
||||||
|
|
|
||||||
|
|
@ -15,40 +15,41 @@ import net.minecraftforge.oredict.OreDictionary;
|
||||||
public class WoodchipperRecipes
|
public class WoodchipperRecipes
|
||||||
{
|
{
|
||||||
private static final WoodchipperRecipes recipeBase = new WoodchipperRecipes();
|
private static final WoodchipperRecipes recipeBase = new WoodchipperRecipes();
|
||||||
private Map recipes = Maps.newHashMap();
|
private Map recipes = Maps.newHashMap();
|
||||||
|
|
||||||
public static WoodchipperRecipes getInstance()
|
public static WoodchipperRecipes getInstance()
|
||||||
{
|
{
|
||||||
return recipeBase;
|
return recipeBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addRecipe(ItemStack input, ItemStack stack)
|
public void addRecipe(ItemStack input, ItemStack stack)
|
||||||
{
|
{
|
||||||
this.recipes.put(input, stack);
|
this.recipes.put(input, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getResult(ItemStack stack)
|
public ItemStack getResult(ItemStack stack)
|
||||||
{
|
{
|
||||||
Iterator iterator = this.recipes.entrySet().iterator();
|
Iterator iterator = this.recipes.entrySet().iterator();
|
||||||
Entry entry;
|
Entry entry;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (!iterator.hasNext())
|
if (!iterator.hasNext())
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
entry = (Entry) iterator.next();
|
entry = (Entry) iterator.next();
|
||||||
}
|
}
|
||||||
while (!this.compareItemStacks(stack, (ItemStack) entry.getKey()));
|
while (!this.compareItemStacks(stack, (ItemStack) entry.getKey()));
|
||||||
|
|
||||||
return (ItemStack) entry.getValue();
|
return (ItemStack) entry.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean compareItemStacks(ItemStack stack1, ItemStack stack2)
|
private boolean compareItemStacks(ItemStack stack1, ItemStack stack2)
|
||||||
{
|
{
|
||||||
return stack2.getItem() == stack1.getItem() && (stack2.getItemDamage() == 32767 || stack2.getItemDamage() == stack1.getItemDamage());
|
return stack2.getItem() == stack1.getItem()
|
||||||
|
&& (stack2.getItemDamage() == 32767 || stack2.getItemDamage() == stack1.getItemDamage());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map getRecipeList()
|
public Map getRecipeList()
|
||||||
{
|
{
|
||||||
return this.recipes;
|
return this.recipes;
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,11 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
|
||||||
public int processTime;
|
public int processTime;
|
||||||
public int catalystInUseTime;
|
public int catalystInUseTime;
|
||||||
|
|
||||||
|
public static ArrayList<ItemStack> getFuels()
|
||||||
|
{
|
||||||
|
return fuelItems;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSizeInventory()
|
public int getSizeInventory()
|
||||||
{
|
{
|
||||||
|
|
@ -289,7 +294,7 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
|
||||||
|
|
||||||
public static boolean isValid(ItemStack itemstack)
|
public static boolean isValid(ItemStack itemstack)
|
||||||
{
|
{
|
||||||
if(CropomatorRecipes.getInstance().getResult(itemstack) != null)
|
if (CropomatorRecipes.getInstance().getResult(itemstack) != null)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -298,7 +303,7 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
|
||||||
{
|
{
|
||||||
if (this.canProcess())
|
if (this.canProcess())
|
||||||
{
|
{
|
||||||
|
|
||||||
ItemStack input = ItemStacks[0];
|
ItemStack input = ItemStacks[0];
|
||||||
ItemStack output = CropomatorRecipes.getInstance().getResult(input);
|
ItemStack output = CropomatorRecipes.getInstance().getResult(input);
|
||||||
ItemStack outputSlot = ItemStacks[2];
|
ItemStack outputSlot = ItemStacks[2];
|
||||||
|
|
@ -306,11 +311,12 @@ public class TileEntityCropomator extends TileEntity implements ISidedInventory
|
||||||
{
|
{
|
||||||
ItemStacks[2] = output.copy();
|
ItemStacks[2] = output.copy();
|
||||||
}
|
}
|
||||||
else if (outputSlot.isItemEqual(output))
|
else
|
||||||
{
|
if (outputSlot.isItemEqual(output))
|
||||||
outputSlot.stackSize += output.stackSize;
|
{
|
||||||
}
|
outputSlot.stackSize += output.stackSize;
|
||||||
|
}
|
||||||
|
|
||||||
--input.stackSize;
|
--input.stackSize;
|
||||||
if (input.stackSize <= 0)
|
if (input.stackSize <= 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -291,7 +291,7 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
|
||||||
|
|
||||||
public static boolean isValid(ItemStack itemstack)
|
public static boolean isValid(ItemStack itemstack)
|
||||||
{
|
{
|
||||||
if(ElectroextractorRecipes.getInstance().getResult(itemstack) != null)
|
if (ElectroextractorRecipes.getInstance().getResult(itemstack) != null)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -300,7 +300,7 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
|
||||||
{
|
{
|
||||||
if (this.canProcess())
|
if (this.canProcess())
|
||||||
{
|
{
|
||||||
|
|
||||||
ItemStack input = ItemStacks[0];
|
ItemStack input = ItemStacks[0];
|
||||||
ItemStack output = ElectroextractorRecipes.getInstance().getResult(input);
|
ItemStack output = ElectroextractorRecipes.getInstance().getResult(input);
|
||||||
ItemStack outputSlot = ItemStacks[2];
|
ItemStack outputSlot = ItemStacks[2];
|
||||||
|
|
@ -308,11 +308,12 @@ public class TileEntityElectroextractor extends TileEntity implements ISidedInve
|
||||||
{
|
{
|
||||||
ItemStacks[2] = output.copy();
|
ItemStacks[2] = output.copy();
|
||||||
}
|
}
|
||||||
else if (outputSlot.isItemEqual(output))
|
else
|
||||||
{
|
if (outputSlot.isItemEqual(output))
|
||||||
outputSlot.stackSize += output.stackSize;
|
{
|
||||||
}
|
outputSlot.stackSize += output.stackSize;
|
||||||
|
}
|
||||||
|
|
||||||
--input.stackSize;
|
--input.stackSize;
|
||||||
if (input.stackSize <= 0)
|
if (input.stackSize <= 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -293,7 +293,7 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
|
||||||
|
|
||||||
public static boolean isValidForWoodchipper(ItemStack itemstack)
|
public static boolean isValidForWoodchipper(ItemStack itemstack)
|
||||||
{
|
{
|
||||||
if(WoodchipperRecipes.getInstance().getResult(itemstack) != null)
|
if (WoodchipperRecipes.getInstance().getResult(itemstack) != null)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -302,7 +302,7 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
|
||||||
{
|
{
|
||||||
if (this.canProcess())
|
if (this.canProcess())
|
||||||
{
|
{
|
||||||
|
|
||||||
ItemStack input = ItemStacks[0];
|
ItemStack input = ItemStacks[0];
|
||||||
ItemStack output = WoodchipperRecipes.getInstance().getResult(input);
|
ItemStack output = WoodchipperRecipes.getInstance().getResult(input);
|
||||||
ItemStack outputSlot = ItemStacks[2];
|
ItemStack outputSlot = ItemStacks[2];
|
||||||
|
|
@ -310,11 +310,12 @@ public class TileEntityWoodchipper extends TileEntity implements ISidedInventory
|
||||||
{
|
{
|
||||||
ItemStacks[2] = output.copy();
|
ItemStacks[2] = output.copy();
|
||||||
}
|
}
|
||||||
else if (outputSlot.isItemEqual(output))
|
else
|
||||||
{
|
if (outputSlot.isItemEqual(output))
|
||||||
outputSlot.stackSize += output.stackSize;
|
{
|
||||||
}
|
outputSlot.stackSize += output.stackSize;
|
||||||
|
}
|
||||||
|
|
||||||
--input.stackSize;
|
--input.stackSize;
|
||||||
if (input.stackSize <= 0)
|
if (input.stackSize <= 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,6 @@ package com.oitsjustjose.criss_cross.Util;
|
||||||
public class Reference
|
public class Reference
|
||||||
{
|
{
|
||||||
public static final String modid = "CrissCross";
|
public static final String modid = "CrissCross";
|
||||||
public static final String version = "1.0_a";
|
public static final String version = "1.2";
|
||||||
public static final String guifactory = "com.oitsjustjose.criss_cross.GUI.GUIFactory";
|
public static final String guifactory = "com.oitsjustjose.criss_cross.GUI.GUIFactory";
|
||||||
}
|
}
|
||||||
|
|
@ -23,5 +23,13 @@ container.cropomator=Cropomator
|
||||||
container.electroextractor=ElectroExtractor
|
container.electroextractor=ElectroExtractor
|
||||||
container.woodchipper=Wood Chipper
|
container.woodchipper=Wood Chipper
|
||||||
|
|
||||||
|
#NEI Integration
|
||||||
|
recipe.cropomatorfuel=Cropomator Fuels
|
||||||
|
recipe.cropomator=Cropomator
|
||||||
|
recipe.electroextractor=ElectroExtractor
|
||||||
|
recipe.electroextractorfuel=ElectorExtractor Fuels
|
||||||
|
recipe.woodchipper=Wood Chipper
|
||||||
|
recipe.woodchipperfuel=Wood Chipper Fuels
|
||||||
|
|
||||||
#Tab
|
#Tab
|
||||||
itemGroup.tabCrissCross=Criss Cross
|
itemGroup.tabCrissCross=Criss Cross
|
||||||
Loading…
Reference in a new issue