2014-05-02 21:31:20 +02:00
/*******************************************************************************
2014-08-07 08:29:25 +02:00
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
2014-08-07 02:56:58 -07:00
* http://www.gnu.org/licenses/lgpl-3.0.txt
2014-05-02 21:31:20 +02:00
*
2014-08-07 08:29:25 +02:00
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
2014-05-02 21:31:20 +02:00
******************************************************************************/
package forestry.plugins ;
import cpw.mods.fml.common.SidedProxy ;
import cpw.mods.fml.common.network.IGuiHandler ;
import forestry.api.circuits.ChipsetManager ;
import forestry.api.circuits.ICircuitLayout ;
2014-09-18 02:23:08 -07:00
import forestry.api.fuels.FuelManager ;
2014-05-02 21:31:20 +02:00
import forestry.api.fuels.GeneratorFuel ;
import forestry.core.GameMode ;
import forestry.core.circuits.Circuit ;
import forestry.core.circuits.CircuitId ;
import forestry.core.config.Defaults ;
import forestry.core.config.ForestryBlock ;
import forestry.core.config.ForestryItem ;
import forestry.core.gadgets.BlockBase ;
import forestry.core.gadgets.MachineDefinition ;
import forestry.core.interfaces.IOreDictionaryHandler ;
import forestry.core.interfaces.ISaveEventHandler ;
import forestry.core.items.ItemForestryBlock ;
import forestry.core.proxy.Proxies ;
import forestry.core.utils.LiquidHelper ;
import forestry.core.utils.ShapedRecipeCustom ;
import forestry.energy.GuiHandlerEnergy ;
import forestry.energy.circuits.CircuitElectricBoost ;
import forestry.energy.circuits.CircuitElectricChoke ;
import forestry.energy.circuits.CircuitElectricEfficiency ;
import forestry.energy.circuits.CircuitFireDampener ;
import forestry.energy.gadgets.EngineBronze ;
import forestry.energy.gadgets.EngineClockwork ;
import forestry.energy.gadgets.EngineCopper ;
import forestry.energy.gadgets.EngineDefinition ;
import forestry.energy.gadgets.EngineTin ;
import forestry.energy.gadgets.MachineGenerator ;
import forestry.energy.proxy.ProxyEnergy ;
2014-09-22 22:41:25 -07:00
import net.minecraft.block.material.Material ;
import net.minecraft.init.Blocks ;
import net.minecraft.init.Items ;
import net.minecraftforge.fluids.FluidStack ;
2014-05-02 21:31:20 +02:00
2014-09-20 22:43:13 -07:00
@Plugin ( pluginID = "Energy" , name = "Energy" , author = "SirSengir" , url = Defaults . URL , description = "Adds several engines compatible with BuildCraft 3 as well as a generator for IC2." )
public class PluginEnergy extends ForestryPlugin {
2014-05-02 21:31:20 +02:00
@SidedProxy ( clientSide = "forestry.energy.proxy.ClientProxyEnergy" , serverSide = "forestry.energy.proxy.ProxyEnergy" )
public static ProxyEnergy proxy ;
public static MachineDefinition definitionEngineCopper ;
public static MachineDefinition definitionEngineBronze ;
public static MachineDefinition definitionEngineClockwork ;
@Override
public void preInit () {
super . preInit ();
2014-08-18 05:20:29 -07:00
ForestryBlock . engine . registerBlock ( new BlockBase ( Material . iron , true ), ItemForestryBlock . class , "engine" );
2014-05-02 21:31:20 +02:00
2014-08-18 05:20:29 -07:00
definitionEngineCopper = (( BlockBase ) ForestryBlock . engine . block ()). addDefinition ( new EngineDefinition ( Defaults . DEFINITION_ENGINECOPPER_META , "forestry.EngineCopper" , EngineCopper . class ,
2014-05-02 21:31:20 +02:00
PluginEnergy . proxy . getRenderDefaultEngine ( Defaults . TEXTURE_PATH_BLOCKS + "/engine_copper_" ), ShapedRecipeCustom . createShapedRecipe (
2014-08-18 05:20:29 -07:00
ForestryBlock . engine . getItemStack ( 1 , Defaults . DEFINITION_ENGINECOPPER_META ),
2014-05-02 21:31:20 +02:00
"###" ,
" X " ,
"YVY" ,
'#' , "ingotCopper" ,
'X' , Blocks . glass ,
'Y' , "gearCopper" ,
'V' , Blocks . piston )));
2014-08-18 05:20:29 -07:00
definitionEngineBronze = (( BlockBase ) ForestryBlock . engine . block ()). addDefinition ( new EngineDefinition ( Defaults . DEFINITION_ENGINEBRONZE_META , "forestry.EngineBronze" , EngineBronze . class ,
2014-05-02 21:31:20 +02:00
PluginEnergy . proxy . getRenderDefaultEngine ( Defaults . TEXTURE_PATH_BLOCKS + "/engine_bronze_" ), ShapedRecipeCustom . createShapedRecipe (
2014-08-18 05:20:29 -07:00
ForestryBlock . engine . getItemStack ( 1 , Defaults . DEFINITION_ENGINEBRONZE_META ),
2014-05-02 21:31:20 +02:00
"###" ,
" X " ,
"YVY" ,
'#' , "ingotBronze" ,
'X' , Blocks . glass ,
'Y' , "gearBronze" ,
'V' , Blocks . piston )));
ShapedRecipeCustom clockworkRecipe = null ;
2014-08-18 05:20:29 -07:00
if ( GameMode . getGameMode (). getBooleanSetting ( "energy.engine.clockwork" ))
2014-05-02 21:31:20 +02:00
clockworkRecipe = ShapedRecipeCustom . createShapedRecipe (
2014-08-18 05:20:29 -07:00
ForestryBlock . engine . getItemStack ( 1 , Defaults . DEFINITION_ENGINECLOCKWORK_META ),
2014-05-02 21:31:20 +02:00
"###" ,
" X " ,
"ZVY" ,
'#' , "plankWood" ,
'X' , Blocks . glass ,
'Y' , Items . clock ,
'Z' , ForestryItem . gearCopper ,
'V' , Blocks . piston );
2014-08-18 05:20:29 -07:00
definitionEngineClockwork = (( BlockBase ) ForestryBlock . engine . block ()). addDefinition ( new EngineDefinition ( Defaults . DEFINITION_ENGINECLOCKWORK_META , "forestry.EngineClockwork" , EngineClockwork . class ,
2014-05-02 21:31:20 +02:00
PluginEnergy . proxy . getRenderDefaultEngine ( Defaults . TEXTURE_PATH_BLOCKS + "/engine_clock_" ), clockworkRecipe ));
ChipsetManager . circuitRegistry . registerLegacyMapping ( CircuitId . ELECTRIC_CHOKE_I , "forestry.energyChoke1" );
ChipsetManager . circuitRegistry . registerLegacyMapping ( CircuitId . FIRE_DAMPENER_I , "forestry.energyDampener1" );
ChipsetManager . circuitRegistry . registerLegacyMapping ( CircuitId . ELECTRIC_EFFICIENCY_I , "forestry.energyEfficiency1" );
ChipsetManager . circuitRegistry . registerLegacyMapping ( CircuitId . ELECTRIC_BOOST_I , "forestry.energyBoost1" );
ChipsetManager . circuitRegistry . registerLegacyMapping ( CircuitId . ELECTRIC_BOOST_II , "forestry.energyBoost2" );
}
@Override
public void doInit () {
super . doInit ();
definitionEngineCopper . register ();
definitionEngineBronze . register ();
definitionEngineClockwork . register ();
2014-09-18 02:23:08 -07:00
FluidStack ethanol = LiquidHelper . getLiquid ( Defaults . LIQUID_ETHANOL , 1 );
GeneratorFuel ethanolFuel = new GeneratorFuel ( ethanol , ( int ) ( 32 * GameMode . getGameMode (). getFloatSetting ( "fuel.ethanol.generator" )), 4 );
FuelManager . generatorFuel . put ( ethanol . getFluid (), ethanolFuel );
FluidStack biomass = LiquidHelper . getLiquid ( Defaults . LIQUID_BIOMASS , 1 );
GeneratorFuel biomassFuel = new GeneratorFuel ( biomass , ( int ) ( 8 * GameMode . getGameMode (). getFloatSetting ( "fuel.biomass.generator" )), 1 );
FuelManager . generatorFuel . put ( biomass . getFluid (), biomassFuel );
2014-05-02 21:31:20 +02:00
2014-09-19 21:00:21 -07:00
Circuit . energyElectricChoke1 = new CircuitElectricChoke ( "electric.choke.1" );
Circuit . energyFireDampener1 = new CircuitFireDampener ( "dampener.1" );
Circuit . energyElectricEfficiency1 = new CircuitElectricEfficiency ( "electric.efficiency.1" );
Circuit . energyElectricBoost1 = new CircuitElectricBoost ( "electric.boost.1" , 2 , 7 , 2 );
Circuit . energyElectricBoost2 = new CircuitElectricBoost ( "electric.boost.2" , 2 , 15 , 4 );
2014-05-02 21:31:20 +02:00
}
@Override
protected void registerItems () {
}
@Override
protected void registerBackpackItems () {
}
@Override
protected void registerRecipes () {
ICircuitLayout layout = ChipsetManager . circuitRegistry . getLayout ( "forestry.engine.tin" );
// / Solder Manager
ChipsetManager . solderManager . addRecipe ( layout , ForestryItem . tubes . getItemStack ( 1 , 0 ), Circuit . energyElectricChoke1 );
ChipsetManager . solderManager . addRecipe ( layout , ForestryItem . tubes . getItemStack ( 1 , 1 ), Circuit . energyElectricBoost1 );
ChipsetManager . solderManager . addRecipe ( layout , ForestryItem . tubes . getItemStack ( 1 , 2 ), Circuit . energyElectricBoost2 );
ChipsetManager . solderManager . addRecipe ( layout , ForestryItem . tubes . getItemStack ( 1 , 3 ), Circuit . energyElectricEfficiency1 );
}
@Override
protected void registerCrates () {
}
@Override
public IGuiHandler getGuiHandler () {
return new GuiHandlerEnergy ();
}
@Override
public ISaveEventHandler getSaveEventHandler () {
return null ;
}
@Override
public IOreDictionaryHandler getDictionaryHandler () {
return null ;
}
}