Organized imports

Changed centrifuge to new recipe system
This commit is contained in:
Gig 2015-05-19 23:00:36 +01:00
parent 6de2cc351a
commit 1f9600b33c
155 changed files with 450 additions and 1664 deletions

View file

@ -2,10 +2,10 @@ package techreborn.compat;
import techreborn.compat.ee3.EmcValues;
import techreborn.compat.waila.CompatModuleWaila;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import techreborn.init.ModParts;
import techreborn.util.LogHelper;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.event.FMLInitializationEvent;
public class CompatManager {

View file

@ -1,21 +1,23 @@
package techreborn.compat.nei;
import java.awt.Point;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import techreborn.api.BlastFurnaceRecipe;
import techreborn.api.TechRebornAPI;
import techreborn.client.gui.GuiBlastFurnace;
import techreborn.config.ConfigTechReborn;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.TemplateRecipeHandler;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import techreborn.api.BlastFurnaceRecipe;
import techreborn.api.TechRebornAPI;
import techreborn.client.gui.GuiBlastFurnace;
import techreborn.client.gui.GuiCentrifuge;
import techreborn.config.ConfigTechReborn;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
/**
* Created by mark on 29/04/15.

View file

@ -1,206 +0,0 @@
package techreborn.compat.nei;
import ic2.api.item.IC2Items;
import java.awt.Point;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import techreborn.api.CentrifugeRecipie;
import techreborn.api.TechRebornAPI;
import techreborn.client.gui.GuiCentrifuge;
import techreborn.config.ConfigTechReborn;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.TemplateRecipeHandler;
public class CentrifugeRecipeHandler extends TemplateRecipeHandler {
public class CachedCentrifugeRecipe extends CachedRecipe {
private List<PositionedStack> input = new ArrayList<PositionedStack>();
private List<PositionedStack> outputs = new ArrayList<PositionedStack>();
public Point focus;
public CentrifugeRecipie centrifugeRecipie;
public CachedCentrifugeRecipe(CentrifugeRecipie recipie)
{
this.centrifugeRecipie = recipie;
int offset = 4;
PositionedStack pStack = new PositionedStack(
recipie.getInputItem(), 80 - offset, 35 - offset);
pStack.setMaxSize(1);
this.input.add(pStack);
if (recipie.getOutput1() != null)
{
this.outputs.add(new PositionedStack(recipie.getOutput1(),
80 - offset, 5 - offset));
}
if (recipie.getOutput2() != null)
{
this.outputs.add(new PositionedStack(recipie.getOutput2(),
110 - offset, 35 - offset));
}
if (recipie.getOutput3() != null)
{
this.outputs.add(new PositionedStack(recipie.getOutput3(),
80 - offset, 65 - offset));
}
if (recipie.getOutput4() != null)
{
this.outputs.add(new PositionedStack(recipie.getOutput4(),
50 - offset, 35 - offset));
}
ItemStack cellStack = IC2Items.getItem("cell");
cellStack.stackSize = recipie.getCells();
this.outputs.add(new PositionedStack(cellStack, 50 - offset,
5 - offset));
}
@Override
public List<PositionedStack> getIngredients()
{
return this.getCycledIngredients(cycleticks / 20, this.input);
}
@Override
public List<PositionedStack> getOtherStacks()
{
return this.outputs;
}
@Override
public PositionedStack getResult()
{
return null;
}
}
@Override
public String getRecipeName()
{
return "Centrifuge";
}
@Override
public String getGuiTexture()
{
return "techreborn:textures/gui/centrifuge.png";
}
@Override
public Class<? extends GuiContainer> getGuiClass()
{
return GuiCentrifuge.class;
}
@Override
public void drawBackground(int recipeIndex)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GuiDraw.changeTexture(getGuiTexture());
GuiDraw.drawTexturedModalRect(0, 0, 4, 4, 166, 78);
GuiDraw.drawTooltipBox(10, 80, 145, 50);
GuiDraw.drawString("Info:", 14, 84, -1);
CachedRecipe recipe = arecipes.get(recipeIndex);
if (recipe instanceof CachedCentrifugeRecipe)
{
CachedCentrifugeRecipe centrifugeRecipie = (CachedCentrifugeRecipe) recipe;
GuiDraw.drawString(
"EU needed: "
+ (ConfigTechReborn.CentrifugeInputTick * centrifugeRecipie.centrifugeRecipie
.getTickTime()), 14, 94, -1);
GuiDraw.drawString("Ticks to smelt: "
+ centrifugeRecipie.centrifugeRecipie.getTickTime(), 14,
104, -1);
GuiDraw.drawString("Time to smelt: "
+ centrifugeRecipie.centrifugeRecipie.getTickTime() / 20
+ " seconds", 14, 114, -1);
}
}
@Override
public int recipiesPerPage()
{
return 1;
}
@Override
public void loadTransferRects()
{
this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(
new Rectangle(0, 0, 20, 20), "tr.centrifuge", new Object[0]));
}
public void loadCraftingRecipes(String outputId, Object... results)
{
if (outputId.equals("tr.centrifuge"))
{
for (CentrifugeRecipie centrifugeRecipie : TechRebornAPI.centrifugeRecipies)
{
addCached(centrifugeRecipie);
}
} else
{
super.loadCraftingRecipes(outputId, results);
}
}
@Override
public void loadCraftingRecipes(ItemStack result)
{
for (CentrifugeRecipie centrifugeRecipie : TechRebornAPI.centrifugeRecipies)
{
if (NEIServerUtils.areStacksSameTypeCrafting(
centrifugeRecipie.getOutput1(), result))
{
addCached(centrifugeRecipie);
}
if (NEIServerUtils.areStacksSameTypeCrafting(
centrifugeRecipie.getOutput2(), result))
{
addCached(centrifugeRecipie);
}
if (NEIServerUtils.areStacksSameTypeCrafting(
centrifugeRecipie.getOutput3(), result))
{
addCached(centrifugeRecipie);
}
if (NEIServerUtils.areStacksSameTypeCrafting(
centrifugeRecipie.getOutput4(), result))
{
addCached(centrifugeRecipie);
}
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient)
{
for (CentrifugeRecipie centrifugeRecipie : TechRebornAPI.centrifugeRecipies)
{
if (NEIServerUtils.areStacksSameTypeCrafting(
centrifugeRecipie.getInputItem(), ingredient))
{
addCached(centrifugeRecipie);
}
}
}
private void addCached(CentrifugeRecipie recipie)
{
this.arecipes.add(new CachedCentrifugeRecipe(recipie));
}
}

View file

@ -1,22 +1,14 @@
package techreborn.compat.nei;
import codechicken.nei.recipe.GuiCraftingRecipe;
import codechicken.nei.recipe.TemplateRecipeHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.inventory.GuiContainer;
import scala.tools.nsc.backend.icode.analysis.TypeFlowAnalysis;
import techreborn.compat.nei.recipes.AlloySmelterRecipeHandler;
import techreborn.compat.nei.recipes.AssemblingMachineRecipeHandler;
import techreborn.compat.nei.recipes.CentrifugeRecipeHandler;
import techreborn.compat.nei.recipes.ChemicalReactorRecipeHandler;
import techreborn.compat.nei.recipes.GenericRecipeHander;
import techreborn.compat.nei.recipes.ImplosionCompressorRecipeHandler;
import techreborn.compat.nei.recipes.IndustrialSawmillRecipeHandler;
import techreborn.compat.nei.recipes.LatheRecipeHandler;
import techreborn.compat.nei.recipes.PlateCuttingMachineRecipeHandler;
import techreborn.lib.ModInfo;
import techreborn.recipes.IndustrialSawmillRecipe;
import techreborn.recipes.PlateCuttingMachineRecipe;
import codechicken.nei.api.API;
import codechicken.nei.api.IConfigureNEI;
@ -37,7 +29,6 @@ public class NEIConfig implements IConfigureNEI {
@Override
public void loadConfig() {
CentrifugeRecipeHandler centrifugeRecipeHandler = new CentrifugeRecipeHandler();
ShapedRollingMachineHandler shapedRollingMachineHandler = new ShapedRollingMachineHandler();
ShapelessRollingMachineHandler shapelessRollingMachineHandler = new ShapelessRollingMachineHandler();
NEIConfig.blastFurnaceRecipeHandle = new BlastFurnaceRecipeHandler();
@ -70,9 +61,10 @@ public class NEIConfig implements IConfigureNEI {
ChemicalReactorRecipeHandler chem = new ChemicalReactorRecipeHandler();
API.registerUsageHandler(chem);
API.registerRecipeHandler(chem);
API.registerRecipeHandler(centrifugeRecipeHandler);
API.registerUsageHandler(centrifugeRecipeHandler);
CentrifugeRecipeHandler cent = new CentrifugeRecipeHandler();
API.registerUsageHandler(cent);
API.registerRecipeHandler(cent);
API.registerUsageHandler(shapedRollingMachineHandler);
API.registerRecipeHandler(shapedRollingMachineHandler);

View file

@ -1,14 +1,12 @@
package techreborn.compat.nei.recipes;
import codechicken.nei.PositionedStack;
import java.util.List;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraftforge.oredict.OreDictionary;
import techreborn.api.recipe.IBaseRecipeType;
import techreborn.client.gui.GuiAlloySmelter;
import techreborn.client.gui.GuiImplosionCompressor;
import techreborn.util.ItemUtils;
import java.util.List;
import codechicken.nei.PositionedStack;
public class AlloySmelterRecipeHandler extends GenericRecipeHander implements INeiBaseRecipe {
@Override

View file

@ -1,13 +1,12 @@
package techreborn.compat.nei.recipes;
import codechicken.nei.PositionedStack;
import java.util.List;
import net.minecraft.client.gui.inventory.GuiContainer;
import techreborn.api.recipe.IBaseRecipeType;
import techreborn.client.gui.GuiAssemblingMachine;
import techreborn.client.gui.GuiImplosionCompressor;
import techreborn.util.ItemUtils;
import java.util.List;
import codechicken.nei.PositionedStack;
public class AssemblingMachineRecipeHandler extends GenericRecipeHander implements INeiBaseRecipe {
@Override

View file

@ -0,0 +1,53 @@
package techreborn.compat.nei.recipes;
import java.util.List;
import net.minecraft.client.gui.inventory.GuiContainer;
import techreborn.api.recipe.IBaseRecipeType;
import techreborn.client.gui.GuiCentrifuge;
import techreborn.util.ItemUtils;
import codechicken.nei.PositionedStack;
public class CentrifugeRecipeHandler extends GenericRecipeHander implements INeiBaseRecipe {
@Override
public void addPositionedStacks(List<PositionedStack> input, List<PositionedStack> outputs, IBaseRecipeType recipeType) {
int offset = 4;
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 80 - offset, 35 - offset);
input.add(pStack);
PositionedStack pStack2 = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(1)), 50 - offset, 5 - offset);
input.add(pStack2);
PositionedStack pStack3 = new PositionedStack(recipeType.getOutputs().get(0), 80 - offset, 5 - offset);
outputs.add(pStack3);
PositionedStack pStack4 = new PositionedStack(recipeType.getOutputs().get(1), 110 - offset, 35 - offset);
outputs.add(pStack4);
PositionedStack pStack5 = new PositionedStack(recipeType.getOutputs().get(2), 80 - offset, 65 - offset);
outputs.add(pStack5);
PositionedStack pStack6 = new PositionedStack(recipeType.getOutputs().get(3), 50 - offset, 35 - offset);
outputs.add(pStack6);
}
@Override
public String getRecipeName() {
return "centrifugeRecipe";
}
@Override
public String getGuiTexture() {
return "techreborn:textures/gui/industrial_centrifuge.png";
}
@Override
public Class<? extends GuiContainer> getGuiClass() {
return GuiCentrifuge.class;
}
@Override
public INeiBaseRecipe getNeiBaseRecipe() {
return this;
}
}

View file

@ -1,16 +1,13 @@
package techreborn.compat.nei.recipes;
import codechicken.nei.PositionedStack;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraftforge.oredict.OreDictionary;
import techreborn.api.recipe.IBaseRecipeType;
import techreborn.client.gui.GuiAlloySmelter;
import techreborn.client.gui.GuiChemicalReactor;
import techreborn.client.gui.GuiImplosionCompressor;
import techreborn.util.ItemUtils;
import java.util.List;
import net.minecraft.client.gui.inventory.GuiContainer;
import techreborn.api.recipe.IBaseRecipeType;
import techreborn.client.gui.GuiChemicalReactor;
import techreborn.util.ItemUtils;
import codechicken.nei.PositionedStack;
public class ChemicalReactorRecipeHandler extends GenericRecipeHander implements INeiBaseRecipe {
@Override
public void addPositionedStacks(List<PositionedStack> input, List<PositionedStack> outputs, IBaseRecipeType recipeType) {

View file

@ -1,20 +1,22 @@
package techreborn.compat.nei.recipes;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.TemplateRecipeHandler;
import java.awt.Point;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import org.lwjgl.opengl.GL11;
import techreborn.api.recipe.IBaseRecipeType;
import techreborn.api.recipe.RecipeHanderer;
import techreborn.config.ConfigTechReborn;
import techreborn.util.ItemUtils;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.TemplateRecipeHandler;
public abstract class GenericRecipeHander extends TemplateRecipeHandler {

View file

@ -1,10 +1,10 @@
package techreborn.compat.nei.recipes;
import codechicken.nei.PositionedStack;
import java.util.List;
import net.minecraft.client.gui.inventory.GuiContainer;
import techreborn.api.recipe.IBaseRecipeType;
import java.util.List;
import codechicken.nei.PositionedStack;
/**
* Use this to make your neiHandler

View file

@ -1,16 +1,12 @@
package techreborn.compat.nei.recipes;
import codechicken.nei.PositionedStack;
import java.util.List;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import techreborn.api.recipe.IBaseRecipeType;
import techreborn.client.gui.GuiImplosionCompressor;
import techreborn.util.ItemUtils;
import java.util.ArrayList;
import java.util.List;
import codechicken.nei.PositionedStack;
public class ImplosionCompressorRecipeHandler extends GenericRecipeHander implements INeiBaseRecipe {
@Override

View file

@ -1,15 +1,12 @@
package techreborn.compat.nei.recipes;
import codechicken.nei.PositionedStack;
import java.util.List;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraftforge.oredict.OreDictionary;
import techreborn.api.recipe.IBaseRecipeType;
import techreborn.client.gui.GuiAlloySmelter;
import techreborn.client.gui.GuiImplosionCompressor;
import techreborn.client.gui.GuiIndustrialSawmill;
import techreborn.util.ItemUtils;
import java.util.List;
import codechicken.nei.PositionedStack;
public class IndustrialSawmillRecipeHandler extends GenericRecipeHander implements INeiBaseRecipe {
@Override

View file

@ -1,14 +1,12 @@
package techreborn.compat.nei.recipes;
import codechicken.nei.PositionedStack;
import java.util.List;
import net.minecraft.client.gui.inventory.GuiContainer;
import techreborn.api.recipe.IBaseRecipeType;
import techreborn.client.gui.GuiAlloySmelter;
import techreborn.client.gui.GuiImplosionCompressor;
import techreborn.client.gui.GuiLathe;
import techreborn.util.ItemUtils;
import java.util.List;
import codechicken.nei.PositionedStack;
public class LatheRecipeHandler extends GenericRecipeHander implements INeiBaseRecipe {
@Override

View file

@ -1,15 +1,12 @@
package techreborn.compat.nei.recipes;
import codechicken.nei.PositionedStack;
import java.util.List;
import net.minecraft.client.gui.inventory.GuiContainer;
import techreborn.api.recipe.IBaseRecipeType;
import techreborn.client.gui.GuiAlloySmelter;
import techreborn.client.gui.GuiImplosionCompressor;
import techreborn.client.gui.GuiLathe;
import techreborn.client.gui.GuiPlateCuttingMachine;
import techreborn.util.ItemUtils;
import java.util.List;
import codechicken.nei.PositionedStack;
public class PlateCuttingMachineRecipeHandler extends GenericRecipeHander implements INeiBaseRecipe {
@Override

View file

@ -1,7 +1,6 @@
package techreborn.compat.recipes;
import ic2.api.item.IC2Items;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import techreborn.util.CraftingHelper;
import techreborn.util.RecipeRemover;

View file

@ -1,13 +1,11 @@
package techreborn.compat.recipes;
import cpw.mods.fml.common.Mod;
import ic2.api.item.IC2Items;
import ic2.api.recipe.RecipeInputOreDict;
import ic2.api.recipe.Recipes;
import ic2.core.IC2;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import ic2.api.item.IC2Items;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.oredict.OreDictionary;
import techreborn.api.recipe.RecipeHanderer;