Close #390 Forestry Fluids should have FluidBlocks

This commit is contained in:
mezz committed 2014-12-23 01:16:29 -08:00
1 parent eb20049b6d
commit 43bd276389
41 files changed
+1090 -236

No files matched your search

@@ -10,15 +10,23 @@
******************************************************************************/
package forestry.plugins;
import buildcraft.api.fuels.BuildcraftFuelRegistry;
import java.awt.Color;
import net.minecraft.block.Block;
import net.minecraftforge.fluids.Fluid;
import cpw.mods.fml.common.Optional;
import forestry.core.GameMode;
import forestry.core.config.Defaults;
import forestry.core.config.ForestryItem;
import forestry.core.fluids.Fluids;
import forestry.core.proxy.Proxies;
import forestry.core.utils.LiquidHelper;
import net.minecraftforge.fluids.Fluid;
import buildcraft.api.fuels.BuildcraftFuelRegistry;
import forestry.core.items.ItemLiquidContainer.EnumContainerType;
@Plugin(pluginID = "BC6|Fuels", name = "BuildCraft 6 Fuels", author = "mezz", url = Defaults.URL, unlocalizedDescription = "for.plugin.buildcraft6.description")
public class PluginBuildCraftFuels extends ForestryPlugin {
@@ -39,16 +47,41 @@ public class PluginBuildCraftFuels extends ForestryPlugin {
BuildcraftFuelRegistry.coolant.addCoolant(Fluids.ICE.get(), 10.0f);
Fluid ethanol = Fluids.BIOETHANOL.get();
int ethanolPower = 40;
int ethanolBurnTime = Math.round(Defaults.ENGINE_CYCLE_DURATION_ETHANOL * GameMode.getGameMode().getFloatSetting("fuel.ethanol.combustion"));
BuildcraftFuelRegistry.fuel.addFuel(ethanol, ethanolPower, ethanolBurnTime);
if (ethanol != null) {
int ethanolPower = 40;
int ethanolBurnTime = Math.round(Defaults.ENGINE_CYCLE_DURATION_ETHANOL * GameMode.getGameMode().getFloatSetting("fuel.ethanol.combustion"));
BuildcraftFuelRegistry.fuel.addFuel(ethanol, ethanolPower, ethanolBurnTime);
}
LiquidHelper.injectWaxContainer(Fluids.OIL, Defaults.BUCKET_VOLUME, ForestryItem.waxCapsuleOil.getItemStack(), ForestryItem.waxCapsule.getItemStack());
LiquidHelper.injectWaxContainer(Fluids.FUEL, Defaults.BUCKET_VOLUME, ForestryItem.waxCapsuleFuel.getItemStack(), ForestryItem.waxCapsule.getItemStack());
LiquidHelper.injectRefractoryContainer(Fluids.OIL, Defaults.BUCKET_VOLUME, ForestryItem.refractoryOil.getItemStack(), ForestryItem.refractoryEmpty.getItemStack());
LiquidHelper.injectRefractoryContainer(Fluids.FUEL, Defaults.BUCKET_VOLUME, ForestryItem.refractoryFuel.getItemStack(), ForestryItem.refractoryEmpty.getItemStack());
LiquidHelper.injectTinContainer(Fluids.OIL, Defaults.BUCKET_VOLUME, ForestryItem.canOil.getItemStack(), ForestryItem.canEmpty.getItemStack());
LiquidHelper.injectTinContainer(Fluids.FUEL, Defaults.BUCKET_VOLUME, ForestryItem.canFuel.getItemStack(), ForestryItem.canEmpty.getItemStack());
Fluid oil = Fluids.OIL.get();
if (oil != null) {
Block oilBlock = oil.getBlock();
if (oilBlock != null) {
Color oilColor = new Color(0x404040);
ForestryItem.waxCapsuleOil.registerContainer(EnumContainerType.CAPSULE, oilBlock, oilColor);
ForestryItem.canOil.registerContainer(EnumContainerType.CAN, oilBlock, oilColor);
ForestryItem.refractoryOil.registerContainer(EnumContainerType.REFRACTORY, oilBlock, oilColor);
LiquidHelper.injectLiquidContainer(Fluids.OIL, ForestryItem.waxCapsuleOil.getItemStack());
LiquidHelper.injectLiquidContainer(Fluids.OIL, ForestryItem.refractoryOil.getItemStack());
LiquidHelper.injectLiquidContainer(Fluids.OIL, ForestryItem.canOil.getItemStack());
}
}
Fluid fuel = Fluids.FUEL.get();
if (fuel != null) {
Block fuelBlock = fuel.getBlock();
if (fuelBlock != null) {
Color fuelColor = new Color(0xffff00);
ForestryItem.waxCapsuleFuel.registerContainer(EnumContainerType.CAPSULE, fuelBlock, fuelColor);
ForestryItem.canFuel.registerContainer(EnumContainerType.CAN, fuelBlock, fuelColor);
ForestryItem.refractoryFuel.registerContainer(EnumContainerType.REFRACTORY, fuelBlock, fuelColor);
LiquidHelper.injectLiquidContainer(Fluids.FUEL, ForestryItem.waxCapsuleFuel.getItemStack());
LiquidHelper.injectLiquidContainer(Fluids.FUEL, ForestryItem.refractoryFuel.getItemStack());
LiquidHelper.injectLiquidContainer(Fluids.FUEL, ForestryItem.canFuel.getItemStack());
}
}
}
}
+68 -45
View File
@@ -10,8 +10,22 @@
******************************************************************************/
package forestry.plugins;
import java.awt.Color;
import java.util.ArrayList;
import net.minecraft.block.material.Material;
import net.minecraft.command.ICommand;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.RecipeSorter;
import cpw.mods.fml.common.IFuelHandler;
import cpw.mods.fml.common.network.IGuiHandler;
import forestry.api.circuits.ChipsetManager;
import forestry.api.core.Tabs;
import forestry.api.genetics.AlleleManager;
@@ -29,6 +43,7 @@ import forestry.core.config.Config;
import forestry.core.config.Defaults;
import forestry.core.config.ForestryBlock;
import forestry.core.config.ForestryItem;
import forestry.core.fluids.ForestryFluids;
import forestry.core.gadgets.BlockBase;
import forestry.core.gadgets.BlockResource;
import forestry.core.gadgets.BlockResourceStorageBlock;
@@ -51,7 +66,6 @@ import forestry.core.items.ItemForestryPickaxe;
import forestry.core.items.ItemForestryShovel;
import forestry.core.items.ItemFruit;
import forestry.core.items.ItemLiquidContainer;
import forestry.core.items.ItemLiquidContainer.EnumContainerType;
import forestry.core.items.ItemMisc;
import forestry.core.items.ItemOverlay;
import forestry.core.items.ItemOverlay.OverlayInfo;
@@ -61,15 +75,11 @@ import forestry.core.items.ItemWrench;
import forestry.core.proxy.Proxies;
import forestry.core.utils.ForestryModEnvWarningCallable;
import forestry.core.utils.ShapedRecipeCustom;
import java.util.ArrayList;
import net.minecraft.block.material.Material;
import net.minecraft.command.ICommand;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.RecipeSorter;
import static forestry.core.items.ItemLiquidContainer.EnumContainerType.BUCKET;
import static forestry.core.items.ItemLiquidContainer.EnumContainerType.CAN;
import static forestry.core.items.ItemLiquidContainer.EnumContainerType.CAPSULE;
import static forestry.core.items.ItemLiquidContainer.EnumContainerType.REFRACTORY;
@Plugin(pluginID = "Core", name = "Core", author = "SirSengir", url = Defaults.URL, unlocalizedDescription = "for.plugin.core.description")
public class PluginCore extends ForestryPlugin {
@@ -86,6 +96,10 @@ public class PluginCore extends ForestryPlugin {
rootCommand.addChildCommand(new CommandVersion());
rootCommand.addChildCommand(new CommandPlugins());
ForestryFluids.preInit();
MinecraftForge.EVENT_BUS.register(ForestryFluids.getTextureHook());
MinecraftForge.EVENT_BUS.register(ForestryFluids.getFillBucketHook());
ChipsetManager.solderManager = new ItemSolderingIron.SolderManager();
CircuitRegistry circuitRegistry = new CircuitRegistry();
@@ -135,6 +149,8 @@ public class PluginCore extends ForestryPlugin {
public void doInit() {
super.doInit();
ForestryFluids.init();
definitionEscritoire.register();
crashCallable = new ForestryModEnvWarningCallable();
@@ -264,49 +280,56 @@ public class PluginCore extends ForestryPlugin {
ForestryItem.fruits.registerItem(new ItemFruit(), "fruits");
// / EMPTY LIQUID CONTAINERS
ForestryItem.waxCapsule.registerItem(new ItemLiquidContainer(EnumContainerType.CAPSULE, -1).setMaxStackSize(64), "waxCapsule");
ForestryItem.canEmpty.registerItem(new ItemLiquidContainer(EnumContainerType.CAN, -1).setMaxStackSize(64), "canEmpty");
ForestryItem.refractoryEmpty.registerItem(new ItemLiquidContainer(EnumContainerType.REFRACTORY, -1).setMaxStackSize(64), "refractoryEmpty");
ForestryItem.waxCapsule.registerItem(new ItemLiquidContainer(CAPSULE, Blocks.air, null).setMaxStackSize(64), "waxCapsule");
ForestryItem.canEmpty.registerItem(new ItemLiquidContainer(CAN, Blocks.air, null).setMaxStackSize(64), "canEmpty");
ForestryItem.refractoryEmpty.registerItem(new ItemLiquidContainer(REFRACTORY, Blocks.air, null).setMaxStackSize(64), "refractoryEmpty");
// / BUCKETS
ForestryItem.bucketBiomass.registerItem(new ItemForestry().setContainerItem(Items.bucket).setMaxStackSize(1), "bucketBiomass");
ForestryItem.bucketBiofuel.registerItem(new ItemForestry().setContainerItem(Items.bucket).setMaxStackSize(1), "bucketBiofuel");
ForestryItem.bucketBiomass.registerContainer(BUCKET, ForestryFluids.BIOMASS);
ForestryItem.bucketEthanol.registerContainer(BUCKET, ForestryFluids.ETHANOL);
ForestryItem.bucketGlass.registerContainer(BUCKET, ForestryFluids.LIQUID_GLASS);
ForestryItem.bucketHoney.registerContainer(BUCKET, ForestryFluids.HONEY);
ForestryItem.bucketIce.registerContainer(BUCKET, ForestryFluids.ICE);
ForestryItem.bucketJuice.registerContainer(BUCKET, ForestryFluids.JUICE);
ForestryItem.bucketSeedoil.registerContainer(BUCKET, ForestryFluids.SEEDOIL);
ForestryItem.bucketShortMead.registerContainer(BUCKET, ForestryFluids.SHORT_MEAD);
Color colorWater = new Color(0x2432ec);
Color colorLava = new Color(0xfd461f);
// / WAX CAPSULES
ForestryItem.waxCapsuleWater.registerItem((new ItemLiquidContainer(EnumContainerType.CAPSULE, 0x2432ec)), "waxCapsuleWater");
ForestryItem.waxCapsuleBiomass.registerItem((new ItemLiquidContainer(EnumContainerType.CAPSULE, 0x83d41c)), "waxCapsuleBiomass");
ForestryItem.waxCapsuleBiofuel.registerItem((new ItemLiquidContainer(EnumContainerType.CAPSULE, 0xff7909)), "waxCapsuleBiofuel");
ForestryItem.waxCapsuleOil.registerItem((new ItemLiquidContainer(EnumContainerType.CAPSULE, 0x404040)), "waxCapsuleOil");
ForestryItem.waxCapsuleFuel.registerItem((new ItemLiquidContainer(EnumContainerType.CAPSULE, 0xffff00)), "waxCapsuleFuel");
ForestryItem.waxCapsuleSeedOil.registerItem((new ItemLiquidContainer(EnumContainerType.CAPSULE, 0xffffa9)), "waxCapsuleSeedOil");
ForestryItem.waxCapsuleHoney.registerItem((new ItemLiquidContainer(EnumContainerType.CAPSULE, 0xffda47)).setDrink(Defaults.FOOD_HONEY_HEAL, Defaults.FOOD_HONEY_SATURATION), "waxCapsuleHoney");
ForestryItem.waxCapsuleJuice.registerItem((new ItemLiquidContainer(EnumContainerType.CAPSULE, 0x99d04e)).setDrink(Defaults.FOOD_JUICE_HEAL, Defaults.FOOD_JUICE_SATURATION), "waxCapsuleJuice");
ForestryItem.waxCapsuleIce.registerItem((new ItemLiquidContainer(EnumContainerType.CAPSULE, 0xdcffff)), "waxCapsuleIce");
ForestryItem.waxCapsuleBiomass.registerContainer(CAPSULE, ForestryFluids.BIOMASS);
ForestryItem.waxCapsuleEthanol.registerContainer(CAPSULE, ForestryFluids.ETHANOL);
ForestryItem.waxCapsuleHoney.registerContainer(CAPSULE, ForestryFluids.HONEY, Defaults.FOOD_HONEY_HEAL, Defaults.FOOD_HONEY_SATURATION);
ForestryItem.waxCapsuleIce.registerContainer(CAPSULE, ForestryFluids.ICE);
ForestryItem.waxCapsuleJuice.registerContainer(CAPSULE, ForestryFluids.JUICE, Defaults.FOOD_JUICE_HEAL, Defaults.FOOD_JUICE_SATURATION);
ForestryItem.waxCapsuleSeedOil.registerContainer(CAPSULE, ForestryFluids.SEEDOIL);
ForestryItem.waxCapsuleWater.registerContainer(CAPSULE, Blocks.flowing_water, colorWater);
// / CANS
ForestryItem.canWater.registerItem((new ItemLiquidContainer(EnumContainerType.CAN, 0x2432ec)), "waterCan");
ForestryItem.canBiomass.registerItem((new ItemLiquidContainer(EnumContainerType.CAN, 0x83d41c)), "biomassCan");
ForestryItem.canBiofuel.registerItem((new ItemLiquidContainer(EnumContainerType.CAN, 0xff7909)), "biofuelCan");
ForestryItem.canOil.registerItem((new ItemLiquidContainer(EnumContainerType.CAN, 0x404040)), "canOil");
ForestryItem.canFuel.registerItem((new ItemLiquidContainer(EnumContainerType.CAN, 0xffff00)), "canFuel");
ForestryItem.canLava.registerItem((new ItemLiquidContainer(EnumContainerType.CAN, 0xfd461f)), "canLava");
ForestryItem.canSeedOil.registerItem((new ItemLiquidContainer(EnumContainerType.CAN, 0xffffa9)), "canSeedOil");
ForestryItem.canHoney.registerItem((new ItemLiquidContainer(EnumContainerType.CAN, 0xffda47)).setDrink(Defaults.FOOD_HONEY_HEAL, Defaults.FOOD_HONEY_SATURATION), "canHoney");
ForestryItem.canJuice.registerItem((new ItemLiquidContainer(EnumContainerType.CAN, 0x99d04e)).setDrink(Defaults.FOOD_JUICE_HEAL, Defaults.FOOD_JUICE_SATURATION), "canJuice");
ForestryItem.canIce.registerItem((new ItemLiquidContainer(EnumContainerType.CAN, 0xdcffff)), "canIce");
ForestryItem.canBiomass.registerContainer(CAN, ForestryFluids.BIOMASS);
ForestryItem.canEthanol.registerContainer(CAN, ForestryFluids.ETHANOL);
ForestryItem.canLava.registerContainer(CAN, Blocks.flowing_lava, colorLava);
ForestryItem.canHoney.registerContainer(CAN, ForestryFluids.HONEY, Defaults.FOOD_HONEY_HEAL, Defaults.FOOD_HONEY_SATURATION);
ForestryItem.canIce.registerContainer(CAN, ForestryFluids.ICE);
ForestryItem.canJuice.registerContainer(CAN, ForestryFluids.JUICE, Defaults.FOOD_JUICE_HEAL, Defaults.FOOD_JUICE_SATURATION);
ForestryItem.canSeedOil.registerContainer(CAN, ForestryFluids.SEEDOIL);
ForestryItem.canWater.registerContainer(CAN, Blocks.flowing_water, colorWater);
// / REFRACTORY CAPSULES
ForestryItem.refractoryWater.registerItem((new ItemLiquidContainer(EnumContainerType.REFRACTORY, 0x2432ec)), "refractoryWater");
ForestryItem.refractoryBiomass.registerItem((new ItemLiquidContainer(EnumContainerType.REFRACTORY, 0x83d41c)), "refractoryBiomass");
ForestryItem.refractoryBiofuel.registerItem((new ItemLiquidContainer(EnumContainerType.REFRACTORY, 0xff7909)), "refractoryBiofuel");
ForestryItem.refractoryOil.registerItem((new ItemLiquidContainer(EnumContainerType.REFRACTORY, 0x404040)), "refractoryOil");
ForestryItem.refractoryFuel.registerItem((new ItemLiquidContainer(EnumContainerType.REFRACTORY, 0xffff00)), "refractoryFuel");
ForestryItem.refractoryLava.registerItem((new ItemLiquidContainer(EnumContainerType.REFRACTORY, 0xfd461f)), "refractoryLava");
ForestryItem.refractorySeedOil.registerItem((new ItemLiquidContainer(EnumContainerType.REFRACTORY, 0xffffa9)), "refractorySeedOil");
ForestryItem.refractoryHoney.registerItem((new ItemLiquidContainer(EnumContainerType.REFRACTORY, 0xffda47)).setDrink(Defaults.FOOD_HONEY_HEAL, Defaults.FOOD_HONEY_SATURATION), "refractoryHoney");
ForestryItem.refractoryJuice.registerItem((new ItemLiquidContainer(EnumContainerType.REFRACTORY, 0x99d04e)).setDrink(Defaults.FOOD_JUICE_HEAL, Defaults.FOOD_JUICE_SATURATION), "refractoryJuice");
ForestryItem.refractoryIce.registerItem((new ItemLiquidContainer(EnumContainerType.REFRACTORY, 0xdcffff)), "refractoryIce");
ForestryItem.refractoryBiomass.registerContainer(REFRACTORY, ForestryFluids.BIOMASS);
ForestryItem.refractoryEthanol.registerContainer(REFRACTORY, ForestryFluids.ETHANOL);
ForestryItem.refractoryLava.registerContainer(REFRACTORY, Blocks.flowing_lava, colorLava);
ForestryItem.refractoryHoney.registerContainer(REFRACTORY, ForestryFluids.HONEY, Defaults.FOOD_HONEY_HEAL, Defaults.FOOD_HONEY_SATURATION);
ForestryItem.refractoryIce.registerContainer(REFRACTORY, ForestryFluids.ICE);
ForestryItem.refractoryJuice.registerContainer(REFRACTORY, ForestryFluids.JUICE, Defaults.FOOD_JUICE_HEAL, Defaults.FOOD_JUICE_SATURATION);
ForestryItem.refractorySeedOil.registerContainer(REFRACTORY, ForestryFluids.SEEDOIL);
ForestryItem.refractoryWater.registerContainer(REFRACTORY, Blocks.flowing_water, colorWater);
}
@Override
public void postInit() {
ForestryFluids.postInit();
}
@Override
@@ -365,7 +388,7 @@ public class PluginCore extends ForestryPlugin {
Proxies.common.addSmelting(ForestryBlock.resources.getItemStack(1, 2), ForestryItem.ingotTin.getItemStack(), 0.5f);
/* BRONZE INGOTS */
if (Config.getCraftingBronzeEnabled())
if (Config.isCraftingBronzeEnabled())
Proxies.common.addShapelessRecipe(ForestryItem.ingotBronze.getItemStack(4), "ingotTin", "ingotCopper", "ingotCopper", "ingotCopper");
/* STURDY MACHINE */
@@ -67,7 +67,6 @@ public class PluginFood extends ForestryPlugin {
ItemStack meadBottle = ForestryItem.beverage.getItemStack();
((ItemBeverage) ForestryItem.beverage.item()).beverages[0].saveEffects(meadBottle, new IBeverageEffect[] { BeverageEffect.weakAlcoholic });
Fluids.SHORT_MEAD.register();
LiquidHelper.injectLiquidContainer(Fluids.SHORT_MEAD, Defaults.BUCKET_VOLUME, meadBottle, new ItemStack(Items.glass_bottle));
}