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 net.minecraft.block.material.Material;
|
|
|
|
|
import net.minecraft.init.Blocks;
|
|
|
|
|
import net.minecraft.init.Items;
|
2014-09-18 02:23:08 -07:00
|
|
|
|
|
|
|
|
import net.minecraftforge.fluids.FluidStack;
|
2014-05-02 21:31:20 +02:00
|
|
|
|
|
|
|
|
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.Config;
|
|
|
|
|
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-27 12:46:54 -07:00
|
|
|
@Plugin(pluginID = "Energy", name = "Energy", author = "SirSengir", url = Defaults.URL, unlocalizedDescription = "for.plugin.energy.description")
|
2014-09-20 22:43:13 -07:00
|
|
|
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));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void doInit() {
|
|
|
|
|
super.doInit();
|
|
|
|
|
|
|
|
|
|
definitionEngineCopper.register();
|
|
|
|
|
definitionEngineBronze.register();
|
|
|
|
|
definitionEngineClockwork.register();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void registerItems() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void registerBackpackItems() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void registerRecipes() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void registerCrates() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public IGuiHandler getGuiHandler() {
|
|
|
|
|
return new GuiHandlerEnergy();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ISaveEventHandler getSaveEventHandler() {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public IOreDictionaryHandler getDictionaryHandler() {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|