Improved the way we handle other mods

This commit is contained in:
modmuss50 2015-06-12 18:40:08 +01:00
parent 0d20ba6d55
commit 6deb0b1d32
27 changed files with 2074 additions and 1969 deletions

View file

@ -9,7 +9,7 @@ import techreborn.api.recipe.RecipeHandler;
import techreborn.client.GuiHandler;
import techreborn.command.TechRebornDevCommand;
import techreborn.compat.CompatManager;
import techreborn.compat.recipes.RecipeManager;
import techreborn.compat.ICompatModule;
import techreborn.config.ConfigTechReborn;
import techreborn.init.ModBlocks;
import techreborn.init.ModFluids;
@ -52,6 +52,9 @@ public class Core {
config = ConfigTechReborn.initialize(new File(path));
LogHelper.info("PreInitialization Complete");
for(ICompatModule compatModule : CompatManager.INSTANCE.compatModules){
compatModule.preInit(event);
}
}
@Mod.EventHandler
@ -71,7 +74,9 @@ public class Core {
//Client only init, needs to be done before parts system
proxy.init();
// Compat
CompatManager.init(event);
for(ICompatModule compatModule : CompatManager.INSTANCE.compatModules){
compatModule.init(event);
}
// WorldGen
GameRegistry.registerWorldGenerator(new TROreGen(), 0);
// Register Gui Handler
@ -93,18 +98,20 @@ public class Core {
// Has to be done here as Buildcraft registers there recipes late
StopWatch watch = new StopWatch();
watch.start();
RecipeManager.init();
LogHelper.all(watch + " : main recipes");
watch.stop();
//Has to be done after the recipes have been added
CompatManager.postInit(event);
for(ICompatModule compatModule : CompatManager.INSTANCE.compatModules){
compatModule.postInit(event);
}
LogHelper.info(RecipeHandler.recipeList.size() + " recipes loaded");
}
@Mod.EventHandler
public void serverStarting(FMLServerStartingEvent event){
event.registerServerCommand(new TechRebornDevCommand());
for(ICompatModule compatModule : CompatManager.INSTANCE.compatModules){
compatModule.serverStarting(event);
}
}
@SubscribeEvent

View file

@ -1,34 +1,40 @@
package techreborn.compat;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import techreborn.compat.ee3.EmcValues;
import techreborn.compat.waila.CompatModuleWaila;
import techreborn.init.ModParts;
import techreborn.util.LogHelper;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import techreborn.compat.ee3.EmcValues;
import techreborn.compat.qLib.QLib;
import techreborn.compat.recipes.RecipesBuildcraft;
import techreborn.compat.recipes.RecipesIC2;
import techreborn.compat.recipes.RecipesThermalExpansion;
import techreborn.compat.waila.CompatModuleWaila;
import java.util.ArrayList;
public class CompatManager {
public static void init(FMLInitializationEvent event)
{
if (Loader.isModLoaded("Waila"))
{
new CompatModuleWaila().init(event);
LogHelper.info("Waila Compat Loaded");
}
if(Loader.isModLoaded("qmunitylib"))
{
// Register Multiparts
ModParts.init();
}
public ArrayList<ICompatModule> compatModules = new ArrayList<ICompatModule>();
public static CompatManager INSTANCE = new CompatManager();
public CompatManager() {
registerCompact(CompatModuleWaila.class, "Waila");
registerCompact(RecipesIC2.class, "IC2");
registerCompact(RecipesBuildcraft.class, "BuildCraft");
registerCompact(RecipesThermalExpansion.class, "ThermalExpansion");
registerCompact(EmcValues.class, "EE3");
registerCompact(QLib.class, "qmunitylib");
}
public static void postInit(FMLPostInitializationEvent event){
if(Loader.isModLoaded("EE3"))
{
// Register Emc Values and machine crafting handlers
EmcValues.init();
}
}
public void registerCompact(Class<?> moduleClass, String modid) {
if (Loader.isModLoaded(modid)) {
try {
compatModules.add((ICompatModule) moduleClass.newInstance());
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
}

View file

@ -0,0 +1,17 @@
package techreborn.compat;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
public interface ICompatModule {
public void preInit(FMLPreInitializationEvent event);
public void init(FMLInitializationEvent event);
public void postInit(FMLPostInitializationEvent event);
public void serverStarting(FMLServerStartingEvent event);
}

View file

@ -1,18 +1,37 @@
package techreborn.compat.ee3;
import com.pahimar.ee3.api.exchange.RecipeRegistryProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import techreborn.api.recipe.IBaseRecipeType;
import techreborn.api.recipe.RecipeHandler;
import techreborn.compat.ICompatModule;
public class EmcValues implements ICompatModule {
@Override
public void preInit(FMLPreInitializationEvent event) {
public class EmcValues {
public static void init()
{
for(IBaseRecipeType recipeType : RecipeHandler.recipeList){
if(recipeType.getOutputsSize() == 1){
RecipeRegistryProxy.addRecipe(recipeType.getOutput(0), recipeType.getInputs());
}
}
}
@Override
public void init(FMLInitializationEvent event) {
for (IBaseRecipeType recipeType : RecipeHandler.recipeList) {
if (recipeType.getOutputsSize() == 1) {
RecipeRegistryProxy.addRecipe(recipeType.getOutput(0), recipeType.getInputs());
}
}
}
@Override
public void postInit(FMLPostInitializationEvent event) {
}
@Override
public void serverStarting(FMLServerStartingEvent event) {
}
}

View file

@ -21,138 +21,138 @@ import java.util.List;
*/
public class BlastFurnaceRecipeHandler extends TemplateRecipeHandler {
public class CachedBlastFurnaceRecipe extends CachedRecipe {
public class CachedBlastFurnaceRecipe extends CachedRecipe {
private List<PositionedStack> input = new ArrayList<PositionedStack>();
private List<PositionedStack> outputs = new ArrayList<PositionedStack>();
public Point focus;
public BlastFurnaceRecipe centrifugeRecipie;
private List<PositionedStack> input = new ArrayList<PositionedStack>();
private List<PositionedStack> outputs = new ArrayList<PositionedStack>();
public Point focus;
public BlastFurnaceRecipe centrifugeRecipie;
public CachedBlastFurnaceRecipe(BlastFurnaceRecipe recipie) {
this.centrifugeRecipie = recipie;
int offset = 4;
PositionedStack pStack = new PositionedStack(
recipie.getInput1(), 56 - offset, 25 - offset);
public CachedBlastFurnaceRecipe(BlastFurnaceRecipe recipie) {
this.centrifugeRecipie = recipie;
int offset = 4;
PositionedStack pStack = new PositionedStack(
recipie.getInput1(), 56 - offset, 25 - offset);
pStack.setMaxSize(1);
this.input.add(pStack);
pStack.setMaxSize(1);
this.input.add(pStack);
PositionedStack pStack2 = new PositionedStack(
recipie.getInput2(), 56 - offset, 43 - offset);
PositionedStack pStack2 = new PositionedStack(
recipie.getInput2(), 56 - offset, 43 - offset);
pStack.setMaxSize(1);
this.input.add(pStack2);
pStack.setMaxSize(1);
this.input.add(pStack2);
if (recipie.getOutput1() != null) {
this.outputs.add(new PositionedStack(recipie.getOutput1(),
116 - offset, 35 - offset));
}
if (recipie.getOutput2() != null) {
this.outputs.add(new PositionedStack(recipie.getOutput2(),
116 - offset, 53 - offset));
}
}
if (recipie.getOutput1() != null) {
this.outputs.add(new PositionedStack(recipie.getOutput1(),
116 - offset, 35 - offset));
}
if (recipie.getOutput2() != null) {
this.outputs.add(new PositionedStack(recipie.getOutput2(),
116 - offset, 53 - offset));
}
}
@Override
public List<PositionedStack> getIngredients() {
return this.getCycledIngredients(cycleticks / 20, this.input);
}
@Override
public List<PositionedStack> getIngredients() {
return this.getCycledIngredients(cycleticks / 20, this.input);
}
@Override
public List<PositionedStack> getOtherStacks() {
return this.outputs;
}
@Override
public List<PositionedStack> getOtherStacks() {
return this.outputs;
}
@Override
public PositionedStack getResult() {
return null;
}
}
@Override
public PositionedStack getResult() {
return null;
}
}
@Override
public String getRecipeName() {
return "Blast Furnace";
}
@Override
public String getRecipeName() {
return "Blast Furnace";
}
@Override
public String getGuiTexture() {
return "techreborn:textures/gui/industrial_blast_furnace.png";
}
@Override
public String getGuiTexture() {
return "techreborn:textures/gui/industrial_blast_furnace.png";
}
@Override
public Class<? extends GuiContainer> getGuiClass() {
return GuiBlastFurnace.class;
}
@Override
public Class<? extends GuiContainer> getGuiClass() {
return GuiBlastFurnace.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 CachedBlastFurnaceRecipe) {
CachedBlastFurnaceRecipe centrifugeRecipie = (CachedBlastFurnaceRecipe) 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 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 CachedBlastFurnaceRecipe) {
CachedBlastFurnaceRecipe centrifugeRecipie = (CachedBlastFurnaceRecipe) 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 int recipiesPerPage() {
return 1;
}
@Override
public void loadTransferRects() {
this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(
new Rectangle(0, 0, 20, 20), "tr.blast", new Object[0]));
}
@Override
public void loadTransferRects() {
this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(
new Rectangle(0, 0, 20, 20), "tr.blast", new Object[0]));
}
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals("tr.blast")) {
for (BlastFurnaceRecipe centrifugeRecipie : TechRebornAPI.blastFurnaceRecipes) {
addCached(centrifugeRecipie);
}
} else {
super.loadCraftingRecipes(outputId, results);
}
}
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals("tr.blast")) {
for (BlastFurnaceRecipe centrifugeRecipie : TechRebornAPI.blastFurnaceRecipes) {
addCached(centrifugeRecipie);
}
} else {
super.loadCraftingRecipes(outputId, results);
}
}
@Override
public void loadCraftingRecipes(ItemStack result) {
for (BlastFurnaceRecipe centrifugeRecipie : TechRebornAPI.blastFurnaceRecipes) {
if (NEIServerUtils.areStacksSameTypeCrafting(
centrifugeRecipie.getOutput1(), result)) {
addCached(centrifugeRecipie);
}
if (NEIServerUtils.areStacksSameTypeCrafting(
centrifugeRecipie.getOutput2(), result)) {
addCached(centrifugeRecipie);
}
}
}
@Override
public void loadCraftingRecipes(ItemStack result) {
for (BlastFurnaceRecipe centrifugeRecipie : TechRebornAPI.blastFurnaceRecipes) {
if (NEIServerUtils.areStacksSameTypeCrafting(
centrifugeRecipie.getOutput1(), result)) {
addCached(centrifugeRecipie);
}
if (NEIServerUtils.areStacksSameTypeCrafting(
centrifugeRecipie.getOutput2(), result)) {
addCached(centrifugeRecipie);
}
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
for (BlastFurnaceRecipe centrifugeRecipie : TechRebornAPI.blastFurnaceRecipes) {
if (NEIServerUtils.areStacksSameTypeCrafting(centrifugeRecipie.getInput1(), ingredient) || NEIServerUtils.areStacksSameTypeCrafting(centrifugeRecipie.getInput2(), ingredient)) {
addCached(centrifugeRecipie);
}
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
for (BlastFurnaceRecipe centrifugeRecipie : TechRebornAPI.blastFurnaceRecipes) {
if (NEIServerUtils.areStacksSameTypeCrafting(centrifugeRecipie.getInput1(), ingredient) || NEIServerUtils.areStacksSameTypeCrafting(centrifugeRecipie.getInput2(), ingredient)) {
addCached(centrifugeRecipie);
}
}
}
private void addCached(BlastFurnaceRecipe recipie) {
this.arecipes.add(new CachedBlastFurnaceRecipe(recipie));
}
private void addCached(BlastFurnaceRecipe recipie) {
this.arecipes.add(new CachedBlastFurnaceRecipe(recipie));
}
}

View file

@ -2,74 +2,81 @@ package techreborn.compat.nei;
import codechicken.nei.api.API;
import codechicken.nei.api.IConfigureNEI;
import techreborn.api.recipe.machines.GrinderRecipe;
import techreborn.compat.nei.recipes.*;
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.GrinderRecipeHandler;
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;
public class NEIConfig implements IConfigureNEI {
@Override
public String getName() {
return ModInfo.MOD_ID;
}
@Override
public String getName() {
return ModInfo.MOD_ID;
}
@Override
public String getVersion() {
return ModInfo.MOD_VERSION;
}
@Override
public String getVersion() {
return ModInfo.MOD_VERSION;
}
public static BlastFurnaceRecipeHandler blastFurnaceRecipeHandle;
public static BlastFurnaceRecipeHandler blastFurnaceRecipeHandle;
@Override
public void loadConfig() {
ShapedRollingMachineHandler shapedRollingMachineHandler = new ShapedRollingMachineHandler();
ShapelessRollingMachineHandler shapelessRollingMachineHandler = new ShapelessRollingMachineHandler();
NEIConfig.blastFurnaceRecipeHandle = new BlastFurnaceRecipeHandler();
@Override
public void loadConfig() {
ShapedRollingMachineHandler shapedRollingMachineHandler = new ShapedRollingMachineHandler();
ShapelessRollingMachineHandler shapelessRollingMachineHandler = new ShapelessRollingMachineHandler();
NEIConfig.blastFurnaceRecipeHandle = new BlastFurnaceRecipeHandler();
ImplosionCompressorRecipeHandler implosion = new ImplosionCompressorRecipeHandler();
API.registerUsageHandler(implosion);
API.registerRecipeHandler(implosion);
ImplosionCompressorRecipeHandler implosion = new ImplosionCompressorRecipeHandler();
API.registerUsageHandler(implosion);
API.registerRecipeHandler(implosion);
AlloySmelterRecipeHandler alloy = new AlloySmelterRecipeHandler();
API.registerUsageHandler(alloy);
API.registerRecipeHandler(alloy);
AlloySmelterRecipeHandler alloy = new AlloySmelterRecipeHandler();
API.registerUsageHandler(alloy);
API.registerRecipeHandler(alloy);
AssemblingMachineRecipeHandler assembling = new AssemblingMachineRecipeHandler();
API.registerUsageHandler(assembling);
API.registerRecipeHandler(assembling);
AssemblingMachineRecipeHandler assembling = new AssemblingMachineRecipeHandler();
API.registerUsageHandler(assembling);
API.registerRecipeHandler(assembling);
LatheRecipeHandler lathe = new LatheRecipeHandler();
API.registerUsageHandler(lathe);
API.registerRecipeHandler(lathe);
LatheRecipeHandler lathe = new LatheRecipeHandler();
API.registerUsageHandler(lathe);
API.registerRecipeHandler(lathe);
IndustrialSawmillRecipeHandler sawmill = new IndustrialSawmillRecipeHandler();
API.registerUsageHandler(sawmill);
API.registerRecipeHandler(sawmill);
IndustrialSawmillRecipeHandler sawmill = new IndustrialSawmillRecipeHandler();
API.registerUsageHandler(sawmill);
API.registerRecipeHandler(sawmill);
PlateCuttingMachineRecipeHandler plate = new PlateCuttingMachineRecipeHandler();
API.registerUsageHandler(plate);
API.registerRecipeHandler(plate);
PlateCuttingMachineRecipeHandler plate = new PlateCuttingMachineRecipeHandler();
API.registerUsageHandler(plate);
API.registerRecipeHandler(plate);
ChemicalReactorRecipeHandler chem = new ChemicalReactorRecipeHandler();
API.registerUsageHandler(chem);
API.registerRecipeHandler(chem);
ChemicalReactorRecipeHandler chem = new ChemicalReactorRecipeHandler();
API.registerUsageHandler(chem);
API.registerRecipeHandler(chem);
CentrifugeRecipeHandler cent = new CentrifugeRecipeHandler();
API.registerUsageHandler(cent);
API.registerRecipeHandler(cent);
CentrifugeRecipeHandler cent = new CentrifugeRecipeHandler();
API.registerUsageHandler(cent);
API.registerRecipeHandler(cent);
GrinderRecipeHandler grind = new GrinderRecipeHandler();
API.registerUsageHandler(grind);
API.registerRecipeHandler(grind);
API.registerUsageHandler(shapedRollingMachineHandler);
API.registerRecipeHandler(shapedRollingMachineHandler);
API.registerUsageHandler(shapedRollingMachineHandler);
API.registerRecipeHandler(shapedRollingMachineHandler);
API.registerUsageHandler(shapelessRollingMachineHandler);
API.registerRecipeHandler(shapelessRollingMachineHandler);
API.registerUsageHandler(shapelessRollingMachineHandler);
API.registerRecipeHandler(shapelessRollingMachineHandler);
API.registerUsageHandler(NEIConfig.blastFurnaceRecipeHandle);
API.registerRecipeHandler(NEIConfig.blastFurnaceRecipeHandle);
}
API.registerUsageHandler(NEIConfig.blastFurnaceRecipeHandle);
API.registerRecipeHandler(NEIConfig.blastFurnaceRecipeHandle);
}
}

View file

@ -16,91 +16,91 @@ import java.util.List;
public class ShapedRollingMachineHandler extends ShapedRecipeHandler {
@Override
public Class<? extends GuiContainer> getGuiClass() {
return GuiRollingMachine.class;
}
@Override
public Class<? extends GuiContainer> getGuiClass() {
return GuiRollingMachine.class;
}
@Override
public void loadTransferRects() {
this.transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24,
18), "rollingcrafting", new Object[0]));
}
@Override
public void loadTransferRects() {
this.transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24,
18), "rollingcrafting", new Object[0]));
}
@Override
public String getRecipeName() {
return "rollingcrafting";
}
@Override
public String getRecipeName() {
return "rollingcrafting";
}
@Override
public String getOverlayIdentifier() {
return "rollingcrafting";
}
@Override
public String getOverlayIdentifier() {
return "rollingcrafting";
}
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals("rollingcrafting")
&& getClass() == ShapedRollingMachineHandler.class) {
for (IRecipe irecipe : (List<IRecipe>) RollingMachineRecipe.instance
.getRecipeList()) {
CachedShapedRecipe recipe = null;
if (irecipe instanceof ShapedRecipes)
recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
else if (irecipe instanceof ShapedOreRecipe)
recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals("rollingcrafting")
&& getClass() == ShapedRollingMachineHandler.class) {
for (IRecipe irecipe : (List<IRecipe>) RollingMachineRecipe.instance
.getRecipeList()) {
CachedShapedRecipe recipe = null;
if (irecipe instanceof ShapedRecipes)
recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
else if (irecipe instanceof ShapedOreRecipe)
recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);
if (recipe == null)
continue;
if (recipe == null)
continue;
recipe.computeVisuals();
arecipes.add(recipe);
}
} else {
super.loadCraftingRecipes(outputId, results);
}
}
recipe.computeVisuals();
arecipes.add(recipe);
}
} else {
super.loadCraftingRecipes(outputId, results);
}
}
@Override
public void loadCraftingRecipes(ItemStack result) {
for (IRecipe irecipe : (List<IRecipe>) RollingMachineRecipe.instance
.getRecipeList()) {
if (NEIServerUtils.areStacksSameTypeCrafting(
irecipe.getRecipeOutput(), result)) {
CachedShapedRecipe recipe = null;
if (irecipe instanceof ShapedRecipes)
recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
else if (irecipe instanceof ShapedOreRecipe)
recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);
@Override
public void loadCraftingRecipes(ItemStack result) {
for (IRecipe irecipe : (List<IRecipe>) RollingMachineRecipe.instance
.getRecipeList()) {
if (NEIServerUtils.areStacksSameTypeCrafting(
irecipe.getRecipeOutput(), result)) {
CachedShapedRecipe recipe = null;
if (irecipe instanceof ShapedRecipes)
recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
else if (irecipe instanceof ShapedOreRecipe)
recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);
if (recipe == null)
continue;
if (recipe == null)
continue;
recipe.computeVisuals();
arecipes.add(recipe);
}
}
}
recipe.computeVisuals();
arecipes.add(recipe);
}
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
for (IRecipe irecipe : (List<IRecipe>) RollingMachineRecipe.instance
.getRecipeList()) {
CachedShapedRecipe recipe = null;
if (irecipe instanceof ShapedRecipes)
recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
else if (irecipe instanceof ShapedOreRecipe)
recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);
@Override
public void loadUsageRecipes(ItemStack ingredient) {
for (IRecipe irecipe : (List<IRecipe>) RollingMachineRecipe.instance
.getRecipeList()) {
CachedShapedRecipe recipe = null;
if (irecipe instanceof ShapedRecipes)
recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
else if (irecipe instanceof ShapedOreRecipe)
recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);
if (recipe == null
|| !recipe.contains(recipe.ingredients,
ingredient.getItem()))
continue;
if (recipe == null
|| !recipe.contains(recipe.ingredients,
ingredient.getItem()))
continue;
recipe.computeVisuals();
if (recipe.contains(recipe.ingredients, ingredient)) {
recipe.setIngredientPermutation(recipe.ingredients, ingredient);
arecipes.add(recipe);
}
}
}
recipe.computeVisuals();
if (recipe.contains(recipe.ingredients, ingredient)) {
recipe.setIngredientPermutation(recipe.ingredients, ingredient);
arecipes.add(recipe);
}
}
}
}

View file

@ -16,96 +16,96 @@ import java.util.List;
public class ShapelessRollingMachineHandler extends ShapelessRecipeHandler {
@Override
public Class<? extends GuiContainer> getGuiClass() {
return GuiRollingMachine.class;
}
@Override
public Class<? extends GuiContainer> getGuiClass() {
return GuiRollingMachine.class;
}
public String getRecipeName() {
return "Shapeless Rolling Machine";
}
public String getRecipeName() {
return "Shapeless Rolling Machine";
}
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18),
"rollingcraftingnoshape"));
}
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18),
"rollingcraftingnoshape"));
}
@Override
public String getOverlayIdentifier() {
return "rollingcraftingnoshape";
}
@Override
public String getOverlayIdentifier() {
return "rollingcraftingnoshape";
}
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals("rollingcraftingnoshape")
&& getClass() == ShapelessRollingMachineHandler.class) {
List<IRecipe> allrecipes = RollingMachineRecipe.instance
.getRecipeList();
for (IRecipe irecipe : allrecipes) {
CachedShapelessRecipe recipe = null;
if (irecipe instanceof ShapelessRecipes)
recipe = shapelessRecipe((ShapelessRecipes) irecipe);
else if (irecipe instanceof ShapelessOreRecipe)
recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals("rollingcraftingnoshape")
&& getClass() == ShapelessRollingMachineHandler.class) {
List<IRecipe> allrecipes = RollingMachineRecipe.instance
.getRecipeList();
for (IRecipe irecipe : allrecipes) {
CachedShapelessRecipe recipe = null;
if (irecipe instanceof ShapelessRecipes)
recipe = shapelessRecipe((ShapelessRecipes) irecipe);
else if (irecipe instanceof ShapelessOreRecipe)
recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);
if (recipe == null)
continue;
if (recipe == null)
continue;
arecipes.add(recipe);
}
} else {
super.loadCraftingRecipes(outputId, results);
}
}
arecipes.add(recipe);
}
} else {
super.loadCraftingRecipes(outputId, results);
}
}
@Override
public void loadCraftingRecipes(ItemStack result) {
List<IRecipe> allrecipes = RollingMachineRecipe.instance
.getRecipeList();
for (IRecipe irecipe : allrecipes) {
if (NEIServerUtils.areStacksSameTypeCrafting(
irecipe.getRecipeOutput(), result)) {
CachedShapelessRecipe recipe = null;
if (irecipe instanceof ShapelessRecipes)
recipe = shapelessRecipe((ShapelessRecipes) irecipe);
else if (irecipe instanceof ShapelessOreRecipe)
recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);
@Override
public void loadCraftingRecipes(ItemStack result) {
List<IRecipe> allrecipes = RollingMachineRecipe.instance
.getRecipeList();
for (IRecipe irecipe : allrecipes) {
if (NEIServerUtils.areStacksSameTypeCrafting(
irecipe.getRecipeOutput(), result)) {
CachedShapelessRecipe recipe = null;
if (irecipe instanceof ShapelessRecipes)
recipe = shapelessRecipe((ShapelessRecipes) irecipe);
else if (irecipe instanceof ShapelessOreRecipe)
recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);
if (recipe == null)
continue;
if (recipe == null)
continue;
arecipes.add(recipe);
}
}
}
arecipes.add(recipe);
}
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
List<IRecipe> allrecipes = RollingMachineRecipe.instance
.getRecipeList();
for (IRecipe irecipe : allrecipes) {
CachedShapelessRecipe recipe = null;
if (irecipe instanceof ShapelessRecipes)
recipe = shapelessRecipe((ShapelessRecipes) irecipe);
else if (irecipe instanceof ShapelessOreRecipe)
recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);
@Override
public void loadUsageRecipes(ItemStack ingredient) {
List<IRecipe> allrecipes = RollingMachineRecipe.instance
.getRecipeList();
for (IRecipe irecipe : allrecipes) {
CachedShapelessRecipe recipe = null;
if (irecipe instanceof ShapelessRecipes)
recipe = shapelessRecipe((ShapelessRecipes) irecipe);
else if (irecipe instanceof ShapelessOreRecipe)
recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);
if (recipe == null)
continue;
if (recipe == null)
continue;
if (recipe.contains(recipe.ingredients, ingredient)) {
recipe.setIngredientPermutation(recipe.ingredients, ingredient);
arecipes.add(recipe);
}
}
}
if (recipe.contains(recipe.ingredients, ingredient)) {
recipe.setIngredientPermutation(recipe.ingredients, ingredient);
arecipes.add(recipe);
}
}
}
private CachedShapelessRecipe shapelessRecipe(ShapelessRecipes recipe) {
if (recipe.recipeItems == null)
return null;
private CachedShapelessRecipe shapelessRecipe(ShapelessRecipes recipe) {
if (recipe.recipeItems == null)
return null;
return new CachedShapelessRecipe(recipe.recipeItems,
recipe.getRecipeOutput());
}
return new CachedShapelessRecipe(recipe.recipeItems,
recipe.getRecipeOutput());
}
}

View file

@ -9,36 +9,36 @@ import techreborn.util.ItemUtils;
import java.util.List;
public class AlloySmelterRecipeHandler 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)), 47 - offset, 17 - offset);
input.add(pStack);
@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)), 47 - offset, 17 - offset);
input.add(pStack);
PositionedStack pStack2 = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(1)), 65 - offset, 17 - offset);
input.add(pStack2);
PositionedStack pStack2 = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(1)), 65 - offset, 17 - offset);
input.add(pStack2);
PositionedStack pStack3 = new PositionedStack(recipeType.getOutput(0), 116 - offset, 35 - offset);
outputs.add(pStack3);
}
PositionedStack pStack3 = new PositionedStack(recipeType.getOutput(0), 116 - offset, 35 - offset);
outputs.add(pStack3);
}
@Override
public String getRecipeName() {
return "alloySmelterRecipe";
}
@Override
public String getRecipeName() {
return "alloySmelterRecipe";
}
@Override
public String getGuiTexture() {
return "techreborn:textures/gui/electric_alloy_furnace.png";
}
@Override
public String getGuiTexture() {
return "techreborn:textures/gui/electric_alloy_furnace.png";
}
@Override
public Class<? extends GuiContainer> getGuiClass() {
return GuiAlloySmelter.class;
}
@Override
public Class<? extends GuiContainer> getGuiClass() {
return GuiAlloySmelter.class;
}
@Override
public INeiBaseRecipe getNeiBaseRecipe() {
return this;
}
@Override
public INeiBaseRecipe getNeiBaseRecipe() {
return this;
}
}

View file

@ -9,42 +9,42 @@ import techreborn.util.ItemUtils;
import java.util.List;
public class AssemblingMachineRecipeHandler extends GenericRecipeHander implements INeiBaseRecipe {
@Override
public void addPositionedStacks(List<PositionedStack> input, List<PositionedStack> outputs, IBaseRecipeType recipeType) {
int offset = 4;
if (recipeType.getInputs().size() > 0) {
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 47 - offset, 17 - offset);
input.add(pStack);
}
if (recipeType.getInputs().size() > 1) {
PositionedStack pStack2 = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(1)), 65 - offset, 17 - offset);
input.add(pStack2);
}
@Override
public void addPositionedStacks(List<PositionedStack> input, List<PositionedStack> outputs, IBaseRecipeType recipeType) {
int offset = 4;
if (recipeType.getInputs().size() > 0) {
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 47 - offset, 17 - offset);
input.add(pStack);
}
if (recipeType.getInputs().size() > 1) {
PositionedStack pStack2 = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(1)), 65 - offset, 17 - offset);
input.add(pStack2);
}
if (recipeType.getOutputsSize() > 0) {
PositionedStack pStack3 = new PositionedStack(recipeType.getOutput(0), 116 - offset, 35 - offset);
outputs.add(pStack3);
}
if (recipeType.getOutputsSize() > 0) {
PositionedStack pStack3 = new PositionedStack(recipeType.getOutput(0), 116 - offset, 35 - offset);
outputs.add(pStack3);
}
}
}
@Override
public String getRecipeName() {
return "assemblingMachineRecipe";
}
@Override
public String getRecipeName() {
return "assemblingMachineRecipe";
}
@Override
public String getGuiTexture() {
return "techreborn:textures/gui/assembling_machine.png";
}
@Override
public String getGuiTexture() {
return "techreborn:textures/gui/assembling_machine.png";
}
@Override
public Class<? extends GuiContainer> getGuiClass() {
return GuiAssemblingMachine.class;
}
@Override
public Class<? extends GuiContainer> getGuiClass() {
return GuiAssemblingMachine.class;
}
@Override
public INeiBaseRecipe getNeiBaseRecipe() {
return this;
}
@Override
public INeiBaseRecipe getNeiBaseRecipe() {
return this;
}
}

View file

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

View file

@ -9,42 +9,42 @@ import techreborn.util.ItemUtils;
import java.util.List;
public class ChemicalReactorRecipeHandler extends GenericRecipeHander implements INeiBaseRecipe {
@Override
public void addPositionedStacks(List<PositionedStack> input, List<PositionedStack> outputs, IBaseRecipeType recipeType) {
int offset = 4;
if (recipeType.getInputs().size() > 0) {
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 70 - offset, 21 - offset);
input.add(pStack);
}
@Override
public void addPositionedStacks(List<PositionedStack> input, List<PositionedStack> outputs, IBaseRecipeType recipeType) {
int offset = 4;
if (recipeType.getInputs().size() > 0) {
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 70 - offset, 21 - offset);
input.add(pStack);
}
if (recipeType.getInputs().size() > 1) {
PositionedStack pStack2 = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(1)), 90 - offset, 21 - offset);
input.add(pStack2);
}
if (recipeType.getInputs().size() > 1) {
PositionedStack pStack2 = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(1)), 90 - offset, 21 - offset);
input.add(pStack2);
}
if (recipeType.getOutputsSize() > 0) {
PositionedStack pStack3 = new PositionedStack(recipeType.getOutput(0), 80 - offset, 51 - offset);
outputs.add(pStack3);
}
}
if (recipeType.getOutputsSize() > 0) {
PositionedStack pStack3 = new PositionedStack(recipeType.getOutput(0), 80 - offset, 51 - offset);
outputs.add(pStack3);
}
}
@Override
public String getRecipeName() {
return "chemicalReactorRecipe";
}
@Override
public String getRecipeName() {
return "chemicalReactorRecipe";
}
@Override
public String getGuiTexture() {
return "techreborn:textures/gui/chemical_reactor.png";
}
@Override
public String getGuiTexture() {
return "techreborn:textures/gui/chemical_reactor.png";
}
@Override
public Class<? extends GuiContainer> getGuiClass() {
return GuiChemicalReactor.class;
}
@Override
public Class<? extends GuiContainer> getGuiClass() {
return GuiChemicalReactor.class;
}
@Override
public INeiBaseRecipe getNeiBaseRecipe() {
return this;
}
@Override
public INeiBaseRecipe getNeiBaseRecipe() {
return this;
}
}

View file

@ -17,123 +17,123 @@ import java.util.List;
public abstract class GenericRecipeHander extends TemplateRecipeHandler {
public INeiBaseRecipe getNeiBaseRecipe() {
return null;
}
public INeiBaseRecipe getNeiBaseRecipe() {
return null;
}
public class CachedGenericRecipe extends CachedRecipe {
public class CachedGenericRecipe extends CachedRecipe {
private List<PositionedStack> input = new ArrayList<PositionedStack>();
private List<PositionedStack> outputs = new ArrayList<PositionedStack>();
public Point focus;
public IBaseRecipeType recipie;
public INeiBaseRecipe neiBaseRecipe;
private List<PositionedStack> input = new ArrayList<PositionedStack>();
private List<PositionedStack> outputs = new ArrayList<PositionedStack>();
public Point focus;
public IBaseRecipeType recipie;
public INeiBaseRecipe neiBaseRecipe;
public CachedGenericRecipe(IBaseRecipeType recipe, INeiBaseRecipe neiBaseRecipe) {
this.recipie = recipe;
this.neiBaseRecipe = neiBaseRecipe;
neiBaseRecipe.addPositionedStacks(input, outputs, recipe);
}
public CachedGenericRecipe(IBaseRecipeType recipe, INeiBaseRecipe neiBaseRecipe) {
this.recipie = recipe;
this.neiBaseRecipe = neiBaseRecipe;
neiBaseRecipe.addPositionedStacks(input, outputs, recipe);
}
@Override
public List<PositionedStack> getIngredients() {
return this.getCycledIngredients(cycleticks / 20, this.input);
}
@Override
public List<PositionedStack> getIngredients() {
return this.getCycledIngredients(cycleticks / 20, this.input);
}
@Override
public List<PositionedStack> getOtherStacks() {
return this.outputs;
}
@Override
public List<PositionedStack> getOtherStacks() {
return this.outputs;
}
@Override
public PositionedStack getResult() {
return null;
}
}
@Override
public PositionedStack getResult() {
return null;
}
}
@Override
public String getRecipeName() {
return getNeiBaseRecipe().getRecipeName();
}
@Override
public String getRecipeName() {
return getNeiBaseRecipe().getRecipeName();
}
@Override
public String getGuiTexture() {
return getNeiBaseRecipe().getGuiTexture();
}
@Override
public String getGuiTexture() {
return getNeiBaseRecipe().getGuiTexture();
}
@Override
public Class<? extends GuiContainer> getGuiClass() {
return getNeiBaseRecipe().getGuiClass();
}
@Override
public Class<? extends GuiContainer> getGuiClass() {
return getNeiBaseRecipe().getGuiClass();
}
@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 CachedGenericRecipe) {
CachedGenericRecipe genericRecipe = (CachedGenericRecipe) recipe;
GuiDraw.drawString(
"EU needed: "
+ (ConfigTechReborn.CentrifugeInputTick * genericRecipe.recipie
.tickTime()), 14, 94, -1);
GuiDraw.drawString("Ticks to smelt: "
+ genericRecipe.recipie.tickTime(), 14,
104, -1);
GuiDraw.drawString("Time to smelt: "
+ genericRecipe.recipie.tickTime() / 20
+ " seconds", 14, 114, -1);
}
@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 CachedGenericRecipe) {
CachedGenericRecipe genericRecipe = (CachedGenericRecipe) recipe;
GuiDraw.drawString(
"EU needed: "
+ (ConfigTechReborn.CentrifugeInputTick * genericRecipe.recipie
.tickTime()), 14, 94, -1);
GuiDraw.drawString("Ticks to smelt: "
+ genericRecipe.recipie.tickTime(), 14,
104, -1);
GuiDraw.drawString("Time to smelt: "
+ genericRecipe.recipie.tickTime() / 20
+ " seconds", 14, 114, -1);
}
}
}
@Override
public int recipiesPerPage() {
return 1;
}
@Override
public int recipiesPerPage() {
return 1;
}
public void loadTransferRects() {
this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(
new Rectangle(0, 0, 20, 20), getNeiBaseRecipe().getRecipeName(), new Object[0]));
}
public void loadTransferRects() {
this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(
new Rectangle(0, 0, 20, 20), getNeiBaseRecipe().getRecipeName(), new Object[0]));
}
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals(getNeiBaseRecipe().getRecipeName())) {
for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(getNeiBaseRecipe().getRecipeName())) {
addCached(recipeType);
}
} else {
super.loadCraftingRecipes(outputId, results);
}
}
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals(getNeiBaseRecipe().getRecipeName())) {
for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(getNeiBaseRecipe().getRecipeName())) {
addCached(recipeType);
}
} else {
super.loadCraftingRecipes(outputId, results);
}
}
@Override
public void loadCraftingRecipes(ItemStack result) {
for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(getNeiBaseRecipe().getRecipeName())) {
@Override
public void loadCraftingRecipes(ItemStack result) {
for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(getNeiBaseRecipe().getRecipeName())) {
for (int i = 0; i < recipeType.getOutputsSize(); i++) {
if (ItemUtils.isItemEqual(recipeType.getOutput(i), result, true, false, true)) {
addCached(recipeType);
}
}
}
}
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(getNeiBaseRecipe().getRecipeName())) {
for (ItemStack input : recipeType.getInputs()) {
if (ItemUtils.isItemEqual(ingredient, input, true, false, true)) {
addCached(recipeType);
}
}
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(getNeiBaseRecipe().getRecipeName())) {
for (ItemStack input : recipeType.getInputs()) {
if (ItemUtils.isItemEqual(ingredient, input, true, false, true)) {
addCached(recipeType);
}
}
}
}
private void addCached(IBaseRecipeType recipie) {
this.arecipes.add(new CachedGenericRecipe(recipie, getNeiBaseRecipe()));
}
private void addCached(IBaseRecipeType recipie) {
this.arecipes.add(new CachedGenericRecipe(recipie, getNeiBaseRecipe()));
}
}

View file

@ -74,10 +74,10 @@ public class GrinderRecipeHandler extends GenericRecipeHander implements INeiBas
public void drawBackground(int recipeIndex) {
super.drawBackground(recipeIndex);
CachedRecipe recipe = arecipes.get(recipeIndex);
if(recipe instanceof CachedGenericRecipe){
if(((CachedGenericRecipe) recipe).recipie instanceof GrinderRecipe){
if (recipe instanceof CachedGenericRecipe) {
if (((CachedGenericRecipe) recipe).recipie instanceof GrinderRecipe) {
GrinderRecipe grinderRecipe = (GrinderRecipe) ((CachedGenericRecipe) recipe).recipie;
if(grinderRecipe.fluidStack != null){
if (grinderRecipe.fluidStack != null) {
IIcon fluidIcon = grinderRecipe.fluidStack.getFluid().getIcon();
if (fluidIcon != null) {
// GuiDraw.drawRect(7, 16, 176, 31, 0);

View file

@ -11,26 +11,26 @@ import java.util.List;
*/
public interface INeiBaseRecipe {
/**
* Add the inputs and the outputs
*
* @param input add the input stacks to this
* @param outputs add this output stacks to this
*/
public void addPositionedStacks(List<PositionedStack> input, List<PositionedStack> outputs, IBaseRecipeType recipeType);
/**
* Add the inputs and the outputs
*
* @param input add the input stacks to this
* @param outputs add this output stacks to this
*/
public void addPositionedStacks(List<PositionedStack> input, List<PositionedStack> outputs, IBaseRecipeType recipeType);
/**
* @return the recipe name that is used for the recipe
*/
public String getRecipeName();
/**
* @return the recipe name that is used for the recipe
*/
public String getRecipeName();
/**
* @return the guiTexture location
*/
public String getGuiTexture();
/**
* @return the guiTexture location
*/
public String getGuiTexture();
/**
* @return the gui class for the recipe
*/
public Class<? extends GuiContainer> getGuiClass();
/**
* @return the gui class for the recipe
*/
public Class<? extends GuiContainer> getGuiClass();
}

View file

@ -9,47 +9,47 @@ import techreborn.util.ItemUtils;
import java.util.List;
public class ImplosionCompressorRecipeHandler extends GenericRecipeHander implements INeiBaseRecipe {
@Override
public void addPositionedStacks(List<PositionedStack> input, List<PositionedStack> outputs, IBaseRecipeType recipeType) {
int offset = 4;
if (recipeType.getInputs().size() > 0) {
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 37 - offset, 26 - offset);
input.add(pStack);
}
@Override
public void addPositionedStacks(List<PositionedStack> input, List<PositionedStack> outputs, IBaseRecipeType recipeType) {
int offset = 4;
if (recipeType.getInputs().size() > 0) {
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 37 - offset, 26 - offset);
input.add(pStack);
}
if (recipeType.getInputs().size() > 1) {
PositionedStack pStack2 = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(1)), 37 - offset, 44 - offset);
input.add(pStack2);
}
if (recipeType.getInputs().size() > 1) {
PositionedStack pStack2 = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(1)), 37 - offset, 44 - offset);
input.add(pStack2);
}
if (recipeType.getOutputsSize() > 0) {
PositionedStack pStack3 = new PositionedStack(recipeType.getOutput(0), 93 - offset, 35 - offset);
outputs.add(pStack3);
}
if (recipeType.getOutputsSize() > 0) {
PositionedStack pStack3 = new PositionedStack(recipeType.getOutput(0), 93 - offset, 35 - offset);
outputs.add(pStack3);
}
if (recipeType.getOutputsSize() > 1) {
PositionedStack pStack4 = new PositionedStack(recipeType.getOutput(1), 111 - offset, 35 - offset);
outputs.add(pStack4);
}
}
if (recipeType.getOutputsSize() > 1) {
PositionedStack pStack4 = new PositionedStack(recipeType.getOutput(1), 111 - offset, 35 - offset);
outputs.add(pStack4);
}
}
@Override
public String getRecipeName() {
return "implosionCompressorRecipe";
}
@Override
public String getRecipeName() {
return "implosionCompressorRecipe";
}
@Override
public String getGuiTexture() {
return "techreborn:textures/gui/implosion_compressor.png";
}
@Override
public String getGuiTexture() {
return "techreborn:textures/gui/implosion_compressor.png";
}
@Override
public Class<? extends GuiContainer> getGuiClass() {
return GuiImplosionCompressor.class;
}
@Override
public Class<? extends GuiContainer> getGuiClass() {
return GuiImplosionCompressor.class;
}
@Override
public INeiBaseRecipe getNeiBaseRecipe() {
return this;
}
@Override
public INeiBaseRecipe getNeiBaseRecipe() {
return this;
}
}

View file

@ -4,57 +4,56 @@ import codechicken.nei.PositionedStack;
import net.minecraft.client.gui.inventory.GuiContainer;
import techreborn.api.recipe.IBaseRecipeType;
import techreborn.client.gui.GuiIndustrialSawmill;
import techreborn.util.ItemUtils;
import java.util.List;
public class IndustrialSawmillRecipeHandler extends GenericRecipeHander implements INeiBaseRecipe {
@Override
public void addPositionedStacks(List<PositionedStack> input, List<PositionedStack> outputs, IBaseRecipeType recipeType) {
int offset = 4;
if (recipeType.getInputs().size() > 0) {
PositionedStack pStack = new PositionedStack(recipeType.getInputs().get(0), 32 - offset, 26 - offset);
input.add(pStack);
}
@Override
public void addPositionedStacks(List<PositionedStack> input, List<PositionedStack> outputs, IBaseRecipeType recipeType) {
int offset = 4;
if (recipeType.getInputs().size() > 0) {
PositionedStack pStack = new PositionedStack(recipeType.getInputs().get(0), 32 - offset, 26 - offset);
input.add(pStack);
}
if (recipeType.getInputs().size() > 1) {
PositionedStack pStack2 = new PositionedStack(recipeType.getInputs().get(1), 32 - offset, 44 - offset);
input.add(pStack2);
}
if (recipeType.getInputs().size() > 1) {
PositionedStack pStack2 = new PositionedStack(recipeType.getInputs().get(1), 32 - offset, 44 - offset);
input.add(pStack2);
}
if (recipeType.getOutputsSize() > 0) {
PositionedStack pStack3 = new PositionedStack(recipeType.getOutput(0), 84 - offset, 35 - offset);
outputs.add(pStack3);
}
if (recipeType.getOutputsSize() > 0) {
PositionedStack pStack3 = new PositionedStack(recipeType.getOutput(0), 84 - offset, 35 - offset);
outputs.add(pStack3);
}
if (recipeType.getOutputsSize() > 1) {
PositionedStack pStack4 = new PositionedStack(recipeType.getOutput(1), 102 - offset, 35 - offset);
outputs.add(pStack4);
}
if (recipeType.getOutputsSize() > 1) {
PositionedStack pStack4 = new PositionedStack(recipeType.getOutput(1), 102 - offset, 35 - offset);
outputs.add(pStack4);
}
if (recipeType.getOutputsSize() > 2) {
PositionedStack pStack5 = new PositionedStack(recipeType.getOutput(2), 120 - offset, 35 - offset);
outputs.add(pStack5);
}
}
if (recipeType.getOutputsSize() > 2) {
PositionedStack pStack5 = new PositionedStack(recipeType.getOutput(2), 120 - offset, 35 - offset);
outputs.add(pStack5);
}
}
@Override
public String getRecipeName() {
return "industrialSawmillRecipe";
}
@Override
public String getRecipeName() {
return "industrialSawmillRecipe";
}
@Override
public String getGuiTexture() {
return "techreborn:textures/gui/industrial_sawmill.png";
}
@Override
public String getGuiTexture() {
return "techreborn:textures/gui/industrial_sawmill.png";
}
@Override
public Class<? extends GuiContainer> getGuiClass() {
return GuiIndustrialSawmill.class;
}
@Override
public Class<? extends GuiContainer> getGuiClass() {
return GuiIndustrialSawmill.class;
}
@Override
public INeiBaseRecipe getNeiBaseRecipe() {
return this;
}
@Override
public INeiBaseRecipe getNeiBaseRecipe() {
return this;
}
}

View file

@ -9,37 +9,37 @@ import techreborn.util.ItemUtils;
import java.util.List;
public class LatheRecipeHandler extends GenericRecipeHander implements INeiBaseRecipe {
@Override
public void addPositionedStacks(List<PositionedStack> input, List<PositionedStack> outputs, IBaseRecipeType recipeType) {
int offset = 4;
if (recipeType.getInputs().size() > 0) {
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 56 - offset, 17 - offset);
input.add(pStack);
}
@Override
public void addPositionedStacks(List<PositionedStack> input, List<PositionedStack> outputs, IBaseRecipeType recipeType) {
int offset = 4;
if (recipeType.getInputs().size() > 0) {
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 56 - offset, 17 - offset);
input.add(pStack);
}
if (recipeType.getOutputsSize() > 0) {
PositionedStack pStack3 = new PositionedStack(recipeType.getOutput(0), 116 - offset, 35 - offset);
outputs.add(pStack3);
}
}
if (recipeType.getOutputsSize() > 0) {
PositionedStack pStack3 = new PositionedStack(recipeType.getOutput(0), 116 - offset, 35 - offset);
outputs.add(pStack3);
}
}
@Override
public String getRecipeName() {
return "latheRecipe";
}
@Override
public String getRecipeName() {
return "latheRecipe";
}
@Override
public String getGuiTexture() {
return "techreborn:textures/gui/lathe.png";
}
@Override
public String getGuiTexture() {
return "techreborn:textures/gui/lathe.png";
}
@Override
public Class<? extends GuiContainer> getGuiClass() {
return GuiLathe.class;
}
@Override
public Class<? extends GuiContainer> getGuiClass() {
return GuiLathe.class;
}
@Override
public INeiBaseRecipe getNeiBaseRecipe() {
return this;
}
@Override
public INeiBaseRecipe getNeiBaseRecipe() {
return this;
}
}

View file

@ -9,36 +9,36 @@ import techreborn.util.ItemUtils;
import java.util.List;
public class PlateCuttingMachineRecipeHandler extends GenericRecipeHander implements INeiBaseRecipe {
@Override
public void addPositionedStacks(List<PositionedStack> input, List<PositionedStack> outputs, IBaseRecipeType recipeType) {
int offset = 4;
if (recipeType.getInputs().size() > 0) {
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 56 - offset, 17 - offset);
input.add(pStack);
}
if (recipeType.getOutputsSize() > 0) {
PositionedStack pStack3 = new PositionedStack(recipeType.getOutput(0), 116 - offset, 35 - offset);
outputs.add(pStack3);
}
}
@Override
public void addPositionedStacks(List<PositionedStack> input, List<PositionedStack> outputs, IBaseRecipeType recipeType) {
int offset = 4;
if (recipeType.getInputs().size() > 0) {
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 56 - offset, 17 - offset);
input.add(pStack);
}
if (recipeType.getOutputsSize() > 0) {
PositionedStack pStack3 = new PositionedStack(recipeType.getOutput(0), 116 - offset, 35 - offset);
outputs.add(pStack3);
}
}
@Override
public String getRecipeName() {
return "plateCuttingMachineRecipe";
}
@Override
public String getRecipeName() {
return "plateCuttingMachineRecipe";
}
@Override
public String getGuiTexture() {
return "techreborn:textures/gui/plate_cutting_machine.png";
}
@Override
public String getGuiTexture() {
return "techreborn:textures/gui/plate_cutting_machine.png";
}
@Override
public Class<? extends GuiContainer> getGuiClass() {
return GuiPlateCuttingMachine.class;
}
@Override
public Class<? extends GuiContainer> getGuiClass() {
return GuiPlateCuttingMachine.class;
}
@Override
public INeiBaseRecipe getNeiBaseRecipe() {
return this;
}
@Override
public INeiBaseRecipe getNeiBaseRecipe() {
return this;
}
}

View file

@ -0,0 +1,30 @@
package techreborn.compat.qLib;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import techreborn.compat.ICompatModule;
import techreborn.init.ModParts;
public class QLib implements ICompatModule {
@Override
public void preInit(FMLPreInitializationEvent event) {
}
@Override
public void init(FMLInitializationEvent event) {
ModParts.init();
}
@Override
public void postInit(FMLPostInitializationEvent event) {
}
@Override
public void serverStarting(FMLServerStartingEvent event) {
}
}

View file

@ -1,31 +0,0 @@
package techreborn.compat.recipes;
import techreborn.util.LogHelper;
import cpw.mods.fml.common.Loader;
public class RecipeManager {
public static void init()
{
if (Loader.isModLoaded("IC2"))
{
RecipesIC2.init();
LogHelper.info("IC2 Compat Loaded");
}
if (Loader.isModLoaded("BuildCraft"))
{
RecipesBuildcraft.init();
LogHelper.info("Buildcraft Compat Loaded");
}
if (Loader.isModLoaded("ThermalExpansion"))
{
RecipesThermalExpansion.init();
LogHelper.info("ThermalExpansion Compat Loaded");
}
}
}

View file

@ -3,38 +3,21 @@ package techreborn.compat.recipes;
import buildcraft.builders.BlockQuarry;
import buildcraft.core.Version;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import ic2.api.item.IC2Items;
import net.minecraft.item.ItemStack;
import techreborn.compat.ICompatModule;
import techreborn.util.CraftingHelper;
import techreborn.util.LogHelper;
import techreborn.util.RecipeRemover;
public class RecipesBuildcraft {
public class RecipesBuildcraft implements ICompatModule {
public static BlockQuarry quarryBlock;
public static void init() {
try {
String itemClass = "buildcraft.BuildCraftBuilders";
if (!Version.getVersion().startsWith("7")) {//Buildcraft 6
if (Loader.isModLoaded("BuildCraft|Factory")) {
itemClass = "buildcraft.BuildCraftFactory";
}
} else if (!Loader.isModLoaded("Buildcraft|Builders")) { //Buildcraft 7
return;
}
Object obj = Class.forName(itemClass).getField("quarryBlock").get(null);
if (obj instanceof BlockQuarry) {
quarryBlock = (BlockQuarry) obj;
}
} catch (Exception ex) {
LogHelper.fatal("Could not retrieve quarry block from Buildcraft! This is a fatal error!");
ex.printStackTrace();
}
removeRecipes();
addRecipies();
}
public static void removeRecipes() {
RecipeRemover.removeAnyRecipe(new ItemStack(
quarryBlock));
@ -56,4 +39,41 @@ public class RecipesBuildcraft {
);
}
@Override
public void preInit(FMLPreInitializationEvent event) {
}
@Override
public void init(FMLInitializationEvent event) {
try {
String itemClass = "buildcraft.BuildCraftBuilders";
if (!Version.getVersion().startsWith("7")) {//Buildcraft 6
if (Loader.isModLoaded("BuildCraft|Factory")) {
itemClass = "buildcraft.BuildCraftFactory";
}
} else if (!Loader.isModLoaded("Buildcraft|Builders")) { //Buildcraft 7
return;
}
Object obj = Class.forName(itemClass).getField("quarryBlock").get(null);
if (obj instanceof BlockQuarry) {
quarryBlock = (BlockQuarry) obj;
}
} catch (Exception ex) {
LogHelper.fatal("Could not retrieve quarry block from Buildcraft! This is a fatal error!");
ex.printStackTrace();
}
removeRecipes();
addRecipies();
}
@Override
public void postInit(FMLPostInitializationEvent event) {
}
@Override
public void serverStarting(FMLServerStartingEvent event) {
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,10 +1,31 @@
package techreborn.compat.recipes;
public class RecipesThermalExpansion {
public static void init()
{
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import techreborn.compat.ICompatModule;
public class RecipesThermalExpansion implements ICompatModule {
@Override
public void preInit(FMLPreInitializationEvent event) {
}
@Override
public void init(FMLInitializationEvent event) {
// TODO remove basic machine frame recipe
// TODO replace iron in recipe to steel
}
@Override
public void postInit(FMLPostInitializationEvent event) {
}
@Override
public void serverStarting(FMLServerStartingEvent event) {
}
}

View file

@ -1,20 +1,37 @@
package techreborn.compat.waila;
import mcp.mobius.waila.api.IWailaRegistrar;
import techreborn.tiles.TileMachineBase;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import mcp.mobius.waila.api.IWailaRegistrar;
import techreborn.compat.ICompatModule;
import techreborn.tiles.TileMachineBase;
public class CompatModuleWaila {
public class CompatModuleWaila implements ICompatModule {
public void init(FMLInitializationEvent event)
{
@Override
public void preInit(FMLPreInitializationEvent event) {
}
public void init(FMLInitializationEvent event) {
FMLInterModComms.sendMessage("Waila", "register", getClass().getName()
+ ".callbackRegister");
}
public static void callbackRegister(IWailaRegistrar registrar)
{
@Override
public void postInit(FMLPostInitializationEvent event) {
}
@Override
public void serverStarting(FMLServerStartingEvent event) {
}
public static void callbackRegister(IWailaRegistrar registrar) {
registrar.registerBodyProvider(new WailaProviderMachines(),
TileMachineBase.class);
}

View file

@ -1,8 +1,5 @@
package techreborn.compat.waila;
import java.util.ArrayList;
import java.util.List;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
@ -13,14 +10,16 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import techreborn.tiles.TileMachineBase;
import java.util.ArrayList;
import java.util.List;
public class WailaProviderMachines implements IWailaDataProvider {
private List<String> info = new ArrayList<String>();
@Override
public List<String> getWailaBody(ItemStack item, List<String> tip,
IWailaDataAccessor accessor, IWailaConfigHandler config)
{
IWailaDataAccessor accessor, IWailaConfigHandler config) {
TileMachineBase machine = (TileMachineBase) accessor.getTileEntity();
@ -33,32 +32,28 @@ public class WailaProviderMachines implements IWailaDataProvider {
@Override
public List<String> getWailaHead(ItemStack item, List<String> tip,
IWailaDataAccessor accessor, IWailaConfigHandler config)
{
IWailaDataAccessor accessor, IWailaConfigHandler config) {
return tip;
}
@Override
public List<String> getWailaTail(ItemStack item, List<String> tip,
IWailaDataAccessor accessor, IWailaConfigHandler config)
{
IWailaDataAccessor accessor, IWailaConfigHandler config) {
return tip;
}
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor,
IWailaConfigHandler config)
{
IWailaConfigHandler config) {
return null;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te,
NBTTagCompound tag, World w, int x, int y, int z)
{
NBTTagCompound tag, World w, int x, int y, int z) {
return tag;
}

View file

@ -13,10 +13,6 @@ import java.util.List;
public abstract class TileMachineBase extends TileEntity {
@Deprecated
/**
* Try not to use this
*/
public void syncWithAll() {
if (!worldObj.isRemote) {
PacketHandler.sendPacketToAllPlayers(getDescriptionPacket(),