From 72799a94742260d3ec471b6624cec284b5fab54e Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Tue, 8 Sep 2015 13:26:24 +0100 Subject: [PATCH] Added some fuels to forestry's api, might write our own and import bc's and forest into ours. --- .../java/techreborn/compat/CompatManager.java | 1 + .../compat/recipes/FuelsNoForestry.java | 36 +++++++++++++++++++ .../compat/recipes/RecipesBuildcraft.java | 10 +++++- src/main/java/techreborn/init/ModFluids.java | 4 +++ 4 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 src/main/java/techreborn/compat/recipes/FuelsNoForestry.java diff --git a/src/main/java/techreborn/compat/CompatManager.java b/src/main/java/techreborn/compat/CompatManager.java index 38f6d410e..d765d3e43 100644 --- a/src/main/java/techreborn/compat/CompatManager.java +++ b/src/main/java/techreborn/compat/CompatManager.java @@ -25,6 +25,7 @@ public class CompatManager { registerCompact(RecipesBiomesOPlenty.class, "BiomesOPlenty"); registerCompact(RecipesThaumcraft.class, "Thaumcraft"); registerCompact(RecipesForestry.class, "Forestry"); + registerCompact(FuelsNoForestry.class, "!Forestry"); registerCompact(MinetweakerCompat.class, "MineTweaker3"); } diff --git a/src/main/java/techreborn/compat/recipes/FuelsNoForestry.java b/src/main/java/techreborn/compat/recipes/FuelsNoForestry.java new file mode 100644 index 000000000..35675da58 --- /dev/null +++ b/src/main/java/techreborn/compat/recipes/FuelsNoForestry.java @@ -0,0 +1,36 @@ +package techreborn.compat.recipes; + +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 forestry.api.fuels.FuelManager; +import forestry.api.fuels.GeneratorFuel; +import net.minecraftforge.fluids.Fluid; +import techreborn.compat.ICompatModule; + +import java.util.HashMap; + + +public class FuelsNoForestry implements ICompatModule { + @Override + public void preInit(FMLPreInitializationEvent event) { + if(FuelManager.generatorFuel == null){ + FuelManager.generatorFuel = new HashMap(); + } + } + + @Override + public void init(FMLInitializationEvent event) { + } + + @Override + public void postInit(FMLPostInitializationEvent event) { + + } + + @Override + public void serverStarting(FMLServerStartingEvent event) { + + } +} diff --git a/src/main/java/techreborn/compat/recipes/RecipesBuildcraft.java b/src/main/java/techreborn/compat/recipes/RecipesBuildcraft.java index da62f2971..f21a0758b 100644 --- a/src/main/java/techreborn/compat/recipes/RecipesBuildcraft.java +++ b/src/main/java/techreborn/compat/recipes/RecipesBuildcraft.java @@ -1,15 +1,21 @@ package techreborn.compat.recipes; +import buildcraft.BuildCraftEnergy; +import buildcraft.api.core.BuildCraftAPI; +import buildcraft.api.fuels.BuildcraftFuelRegistry; 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 forestry.api.fuels.FuelManager; +import forestry.api.fuels.GeneratorFuel; import ic2.api.item.IC2Items; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; import techreborn.compat.ICompatModule; import techreborn.util.CraftingHelper; @@ -48,7 +54,9 @@ public class RecipesBuildcraft implements ICompatModule { @Override public void init(FMLInitializationEvent event) { - + if(!FuelManager.generatorFuel.containsKey(BuildCraftEnergy.fluidFuel)){ + FuelManager.generatorFuel.put(BuildCraftEnergy.fluidFuel, new GeneratorFuel(new FluidStack(BuildCraftEnergy.fluidFuel, 1000), 38400, 6000)); + } } @Override diff --git a/src/main/java/techreborn/init/ModFluids.java b/src/main/java/techreborn/init/ModFluids.java index 6c01a1399..b429aa296 100644 --- a/src/main/java/techreborn/init/ModFluids.java +++ b/src/main/java/techreborn/init/ModFluids.java @@ -1,10 +1,13 @@ package techreborn.init; import cpw.mods.fml.common.registry.GameRegistry; +import forestry.api.fuels.FuelManager; +import forestry.api.fuels.GeneratorFuel; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; import techreborn.blocks.fluid.BlockFluidTechReborn; import techreborn.lib.ModInfo; @@ -149,6 +152,7 @@ public class ModFluids { BlockFluidNitrocoalfuel = new BlockFluidTechReborn(fluidNitrocoalfuel, Material.water, "techreborn.nitrocoalfuel"); GameRegistry.registerBlock(BlockFluidNitrocoalfuel, ModInfo.MOD_ID + "_" + BlockFluidNitrocoalfuel.getUnlocalizedName().substring(5)); fluidNitrocoalfuel.setUnlocalizedName(fluidNitrocoalfuel.getUnlocalizedName()); + FuelManager.generatorFuel.put(fluidNitrocoalfuel, new GeneratorFuel(new FluidStack(fluidNitrocoalfuel, 1000), 48000, 6000)); FluidRegistry.registerFluid(fluidNitrofuel); BlockFluidNitrofuel = new BlockFluidTechReborn(fluidNitrofuel, Material.water, "techreborn.nitrofuel");