Move engine blocks to PluginEnergy.blocks

This commit is contained in:
mezz committed 2015-11-19 01:04:38 -08:00
1 parent 10e5391f48
commit ce2a2ec8ed
32 files changed
+313 -191

No files matched your search

@@ -10,21 +10,13 @@
******************************************************************************/
package forestry.apiculture.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.item.ItemStack;
import forestry.api.core.Tabs;
import forestry.core.blocks.BlockBase;
public class BlockApiculture extends BlockBase {
public BlockApiculture(Material material) {
super(material);
public class BlockApiculture extends BlockBase<BlockApicultureType> {
public BlockApiculture() {
super();
setCreativeTab(Tabs.tabApiculture);
setHarvestLevel("axe", 0);
}
public ItemStack get(BlockApicultureType type, int amount) {
return new ItemStack(this, amount, type.ordinal());
}
}
@@ -55,9 +55,4 @@ public enum BlockApicultureType implements IMachineProperties {
public Class<? extends TileForestry> getTeClass() {
return teClass;
}
@Override
public String getGfxBase() {
return null;
}
}
@@ -10,8 +10,6 @@
******************************************************************************/
package forestry.apiculture.blocks;
import net.minecraft.block.material.Material;
import forestry.api.core.Tabs;
import forestry.apiculture.items.ItemBlockCandle;
import forestry.core.blocks.BlockBase;
@@ -27,9 +25,9 @@ public class BlockRegistryApiculture extends BlockRegistry {
public final BlockAlveary alveary;
public BlockRegistryApiculture() {
apiculture = registerBlock(new BlockApiculture(Material.iron), ItemBlockForestry.class, "apiculture");
apiculture = registerBlock(new BlockApiculture(), ItemBlockForestry.class, "apiculture");
apicultureChest = registerBlock(new BlockBase(Material.iron, true), ItemBlockForestry.class, "apicultureChest");
apicultureChest = registerBlock(new BlockBase(true), ItemBlockForestry.class, "apicultureChest");
apicultureChest.setCreativeTab(Tabs.tabApiculture);
apicultureChest.setHarvestLevel("axe", 0);
@@ -10,23 +10,12 @@
******************************************************************************/
package forestry.arboriculture.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.item.ItemStack;
import forestry.api.core.Tabs;
import forestry.core.blocks.BlockBase;
public class BlockArboriculture extends BlockBase {
public enum Type {
ARBCHEST;
}
public class BlockArboriculture extends BlockBase<BlockArboricultureType> {
public BlockArboriculture() {
super(Material.iron, true);
super(true);
setCreativeTab(Tabs.tabArboriculture);
}
public ItemStack get(Type type, int amount) {
return new ItemStack(this, amount, type.ordinal());
}
}
@@ -0,0 +1,54 @@
/*******************************************************************************
* 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
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.arboriculture.blocks;
import javax.annotation.Nullable;
import forestry.arboriculture.tiles.TileArboristChest;
import forestry.core.blocks.IMachinePropertiesTESR;
import forestry.core.proxy.Proxies;
import forestry.core.render.IBlockRenderer;
import forestry.core.tiles.TileForestry;
public enum BlockArboricultureType implements IMachinePropertiesTESR {
ARBCHEST(TileArboristChest.class, "ArbChest") {
@Nullable
@Override
public IBlockRenderer getRenderer() {
return Proxies.render.getRenderChest("arbchest");
}
};
public static final BlockArboricultureType[] VALUES = values();
private final String teIdent;
private final Class<? extends TileForestry> teClass;
BlockArboricultureType(Class<? extends TileForestry> teClass, String teName) {
this.teIdent = "forestry." + teName;
this.teClass = teClass;
}
@Override
public int getMeta() {
return ordinal();
}
@Override
public String getTeIdent() {
return teIdent;
}
@Override
public Class<? extends TileForestry> getTeClass() {
return teClass;
}
}
@@ -48,17 +48,16 @@ import forestry.core.tiles.TileUtil;
import forestry.core.utils.InventoryUtil;
import forestry.core.utils.PlayerUtil;
public class BlockBase extends BlockForestry {
public class BlockBase<T extends IMachineProperties> extends BlockForestry {
private final List<MachineDefinition> definitions = new ArrayList<>();
private final boolean hasTESR;
public BlockBase(Material material) {
this(material, false);
public BlockBase() {
this(false);
}
public BlockBase(Material material, boolean hasTESR) {
super(material);
public BlockBase(boolean hasTESR) {
super(Material.iron);
this.hasTESR = hasTESR;
this.opaque = this.isOpaqueCube();
@@ -247,7 +246,7 @@ public class BlockBase extends BlockForestry {
return metadata;
}
public void registerDefinitions() {
public void init() {
for (MachineDefinition def : definitions) {
def.register();
}
@@ -288,4 +287,12 @@ public class BlockBase extends BlockForestry {
public boolean getUseNeighborBrightness() {
return hasTESR;
}
public final ItemStack get(T type) {
return get(type, 1);
}
public final ItemStack get(T type, int amount) {
return new ItemStack(this, amount, type.getMeta());
}
}
@@ -10,16 +10,8 @@
******************************************************************************/
package forestry.core.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.item.ItemStack;
public class BlockCore extends BlockBase {
public BlockCore(Material material, boolean hasTESR) {
super(material, hasTESR);
}
public ItemStack get(BlockCoreType type, int amount) {
return new ItemStack(this, amount, type.ordinal());
public class BlockCore extends BlockBase<BlockCoreType> {
public BlockCore() {
super(true);
}
}
@@ -10,9 +10,54 @@
******************************************************************************/
package forestry.core.blocks;
public enum BlockCoreType {
ANALYZER,
ESCRITOIRE;
import javax.annotation.Nullable;
import forestry.core.config.Constants;
import forestry.core.proxy.Proxies;
import forestry.core.render.IBlockRenderer;
import forestry.core.tiles.TileAnalyzer;
import forestry.core.tiles.TileEscritoire;
import forestry.core.tiles.TileForestry;
import forestry.plugins.PluginApiculture;
public enum BlockCoreType implements IMachinePropertiesTESR {
ANALYZER(TileAnalyzer.class, "Analyzer") {
@Nullable
@Override
public IBlockRenderer getRenderer() {
return PluginApiculture.proxy.getRendererAnalyzer(Constants.TEXTURE_PATH_BLOCKS + "/analyzer_");
}
},
ESCRITOIRE(TileEscritoire.class, "Escritoire") {
@Nullable
@Override
public IBlockRenderer getRenderer() {
return Proxies.render.getRenderEscritoire();
}
};
public static final BlockCoreType[] VALUES = values();
private final String teIdent;
private final Class<? extends TileForestry> teClass;
BlockCoreType(Class<? extends TileForestry> teClass, String teName) {
this.teIdent = "forestry." + teName;
this.teClass = teClass;
}
@Override
public int getMeta() {
return ordinal();
}
@Override
public String getTeIdent() {
return teIdent;
}
@Override
public Class<? extends TileForestry> getTeClass() {
return teClass;
}
}
@@ -10,7 +10,6 @@
******************************************************************************/
package forestry.core.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraftforge.oredict.OreDictionary;
@@ -25,7 +24,7 @@ public class BlockRegistryCore extends BlockRegistry {
public final BlockResourceStorage resourceStorage;
public BlockRegistryCore() {
core = registerBlock(new BlockCore(Material.iron, true), ItemBlockForestry.class, "core");
core = registerBlock(new BlockCore(), ItemBlockForestry.class, "core");
soil = registerBlock(new BlockSoil(), ItemBlockTyped.class, "soil");
soil.setHarvestLevel("shovel", 0, 0);
@@ -10,8 +10,6 @@
******************************************************************************/
package forestry.core.blocks;
import javax.annotation.Nullable;
import forestry.core.tiles.TileForestry;
public interface IMachineProperties {
@@ -20,7 +18,4 @@ public interface IMachineProperties {
String getTeIdent();
Class<? extends TileForestry> getTeClass();
@Nullable
String getGfxBase();
}
@@ -0,0 +1,17 @@
/*******************************************************************************
* 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
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.core.blocks;
import forestry.core.render.IBlockRenderer;
public interface IMachinePropertiesTESR extends IMachineProperties {
IBlockRenderer getRenderer();
}
@@ -48,13 +48,6 @@ public class Constants implements IForestryConstants {
// Village Chest Gen hook
public static final String CHEST_GEN_HOOK_NATURALIST_CHEST = "naturalistChest";
// Definition IDs
public static final int DEFINITION_ENGINE_ELECTRIC_META = 0;
public static final int DEFINITION_ENGINE_PEAT_META = 1;
public static final int DEFINITION_ENGINE_BIOGAS_META = 2;
public static final int DEFINITION_GENERATOR_META = 3;
public static final int DEFINITION_ENGINE_CLOCKWORK_META = 4;
public static final int DEFINITION_LEPICHEST_META = 0;
// Item Ids
@@ -34,7 +34,6 @@ import forestry.plugins.PluginManager.Stage;
* @author SirSengir
*/
public enum ForestryBlock {
engine,
lepidopterology;
private Block block;
@@ -33,6 +33,7 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.core.blocks.IMachineProperties;
import forestry.core.blocks.IMachinePropertiesTESR;
import forestry.core.proxy.Proxies;
import forestry.core.render.IBlockRenderer;
import forestry.core.render.TextureManager;
@@ -56,7 +57,11 @@ public class MachineDefinition {
}
public MachineDefinition(IMachineProperties properties) {
this(properties.getMeta(), properties.getTeIdent(), properties.getTeClass(), Proxies.render.getRenderDefaultMachine(properties.getGfxBase()));
this(properties.getMeta(), properties.getTeIdent(), properties.getTeClass(), null);
}
public MachineDefinition(IMachinePropertiesTESR properties) {
this(properties.getMeta(), properties.getTeIdent(), properties.getTeClass(), properties.getRenderer());
}
public MachineDefinition(int meta, String teIdent, Class<? extends TileForestry> teClass, IBlockRenderer renderer) {
@@ -15,7 +15,6 @@ import com.google.common.collect.ImmutableList;
import java.util.EnumMap;
import java.util.List;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MovingObjectPosition;
@@ -28,7 +27,7 @@ import forestry.core.blocks.BlockBase;
import forestry.core.tiles.TileEngine;
import forestry.core.tiles.TileUtil;
public class BlockEngine extends BlockBase {
public class BlockEngine extends BlockBase<BlockEngineType> {
private static final EnumMap<ForgeDirection, List<AxisAlignedBB>> boundingBoxesForDirections = new EnumMap<>(ForgeDirection.class);
static {
@@ -52,8 +51,8 @@ public class BlockEngine extends BlockBase {
));
}
public BlockEngine(Material material) {
super(material, true);
public BlockEngine() {
super(true);
}
@Override
@@ -0,0 +1,62 @@
/*******************************************************************************
* 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
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.energy.blocks;
import forestry.core.blocks.IMachinePropertiesTESR;
import forestry.core.config.Constants;
import forestry.core.render.IBlockRenderer;
import forestry.core.tiles.TileForestry;
import forestry.energy.tiles.TileEngineBiogas;
import forestry.energy.tiles.TileEngineClockwork;
import forestry.energy.tiles.TileEngineElectric;
import forestry.energy.tiles.TileEnginePeat;
import forestry.energy.tiles.TileGenerator;
import forestry.plugins.PluginEnergy;
public enum BlockEngineType implements IMachinePropertiesTESR {
ELECTRIC(TileEngineElectric.class, "EngineTin", "/engine_tin_"),
PEAT(TileEnginePeat.class, "EngineCopper", "/engine_copper_"),
BIOGAS(TileEngineBiogas.class, "EngineBronze", "/engine_bronze_"),
GENERATOR(TileGenerator.class, "Generator", "/generator_"),
CLOCKWORK(TileEngineClockwork.class, "EngineClockwork", "/engine_clock_");
public static final BlockEngineType[] VALUES = values();
private final String teIdent;
private final Class<? extends TileForestry> teClass;
private final IBlockRenderer renderer;
BlockEngineType(Class<? extends TileForestry> teClass, String teName, String textureName) {
this.teIdent = "forestry." + teName;
this.teClass = teClass;
this.renderer = PluginEnergy.proxy.getRenderDefaultEngine(Constants.TEXTURE_PATH_BLOCKS + textureName);
}
@Override
public int getMeta() {
return ordinal();
}
@Override
public String getTeIdent() {
return teIdent;
}
@Override
public Class<? extends TileForestry> getTeClass() {
return teClass;
}
@Override
public IBlockRenderer getRenderer() {
return renderer;
}
}
@@ -0,0 +1,22 @@
/*******************************************************************************
* 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
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.energy.blocks;
import forestry.core.blocks.BlockRegistry;
import forestry.core.items.ItemBlockForestry;
public class BlockRegistryEnergy extends BlockRegistry {
public final BlockEngine engine;
public BlockRegistryEnergy() {
engine = registerBlock(new BlockEngine(), ItemBlockForestry.class, "engine");
}
}
@@ -12,6 +12,7 @@ package forestry.energy.tiles;
import net.minecraft.world.IBlockAccess;
import forestry.core.blocks.IMachineProperties;
import forestry.core.render.IBlockRenderer;
import forestry.core.tiles.MachineDefinition;
import forestry.core.tiles.TileEngine;
@@ -20,6 +21,10 @@ import forestry.core.tiles.TileUtil;
public class EngineDefinition extends MachineDefinition {
public EngineDefinition(IMachineProperties properties) {
super(properties);
}
public EngineDefinition(int meta, String teIdent, Class<? extends TileForestry> teClass, IBlockRenderer renderer) {
super(meta, teIdent, teClass, renderer);
}
@@ -10,17 +10,10 @@
******************************************************************************/
package forestry.factory.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.item.ItemStack;
import forestry.core.blocks.BlockBase;
public class BlockFactoryPlain extends BlockBase {
public class BlockFactoryPlain extends BlockBase<BlockFactoryPlainType> {
public BlockFactoryPlain() {
super(Material.iron);
}
public ItemStack get(BlockFactoryPlainType type) {
return new ItemStack(this, 1, type.ordinal());
super();
}
}
@@ -50,9 +50,4 @@ public enum BlockFactoryPlainType implements IMachineProperties {
public Class<? extends TileForestry> getTeClass() {
return teClass;
}
@Override
public String getGfxBase() {
return null;
}
}
@@ -10,17 +10,10 @@
******************************************************************************/
package forestry.factory.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.item.ItemStack;
import forestry.core.blocks.BlockBase;
public class BlockFactoryTesr extends BlockBase {
public class BlockFactoryTesr extends BlockBase<BlockFactoryTesrType> {
public BlockFactoryTesr() {
super(Material.iron, true);
}
public ItemStack get(BlockFactoryTesrType type) {
return new ItemStack(this, 1, type.ordinal());
super(true);
}
}
@@ -14,8 +14,10 @@ import java.util.Locale;
import org.apache.commons.lang3.text.WordUtils;
import forestry.core.blocks.IMachineProperties;
import forestry.core.blocks.IMachinePropertiesTESR;
import forestry.core.config.Constants;
import forestry.core.proxy.Proxies;
import forestry.core.render.IBlockRenderer;
import forestry.core.tiles.TileForestry;
import forestry.factory.tiles.TileBottler;
import forestry.factory.tiles.TileCarpenter;
@@ -26,7 +28,7 @@ import forestry.factory.tiles.TileMoistener;
import forestry.factory.tiles.TileSqueezer;
import forestry.factory.tiles.TileStill;
public enum BlockFactoryTesrType implements IMachineProperties {
public enum BlockFactoryTesrType implements IMachinePropertiesTESR {
BOTTLER(TileBottler.class),
CARPENTER(TileCarpenter.class),
CENTRIFUGE(TileCentrifuge.class),
@@ -40,13 +42,13 @@ public enum BlockFactoryTesrType implements IMachineProperties {
private final String teIdent;
private final Class<? extends TileForestry> teClass;
private final String gfxBase;
private final IBlockRenderer renderer;
BlockFactoryTesrType(Class<? extends TileForestry> teClass) {
String name = toString().toLowerCase(Locale.ENGLISH);
this.teIdent = "forestry." + WordUtils.capitalize(name);
this.teClass = teClass;
this.gfxBase = Constants.TEXTURE_PATH_BLOCKS + "/" + name + "_";
this.renderer = Proxies.render.getRenderDefaultMachine(Constants.TEXTURE_PATH_BLOCKS + "/" + name + "_");
}
@Override
@@ -65,7 +67,7 @@ public enum BlockFactoryTesrType implements IMachineProperties {
}
@Override
public String getGfxBase() {
return gfxBase;
public IBlockRenderer getRenderer() {
return renderer;
}
}
@@ -10,17 +10,10 @@
******************************************************************************/
package forestry.mail.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.item.ItemStack;
import forestry.core.blocks.BlockBase;
public class BlockMail extends BlockBase {
public class BlockMail extends BlockBase<BlockMailType> {
public BlockMail() {
super(Material.iron);
}
public ItemStack get(BlockMailType type) {
return new ItemStack(this, 1, type.ordinal());
super();
}
}
@@ -50,9 +50,4 @@ public enum BlockMailType implements IMachineProperties {
public Class<? extends TileForestry> getTeClass() {
return teClass;
}
@Override
public String getGfxBase() {
return null;
}
}
@@ -313,8 +313,8 @@ public class PluginApiculture extends ForestryPlugin {
proxy.initializeRendering();
blocks.apiculture.registerDefinitions();
blocks.apicultureChest.registerDefinitions();
blocks.apiculture.init();
blocks.apicultureChest.init();
}
@Override
@@ -41,7 +41,7 @@ import forestry.api.storage.StorageManager;
import forestry.arboriculture.GuiHandlerArboriculture;
import forestry.arboriculture.VillageHandlerArboriculture;
import forestry.arboriculture.WoodItemAccess;
import forestry.arboriculture.blocks.BlockArboriculture;
import forestry.arboriculture.blocks.BlockArboricultureType;
import forestry.arboriculture.blocks.BlockRegistryArboriculture;
import forestry.arboriculture.commands.CommandTree;
import forestry.arboriculture.genetics.TreeBranchDefinition;
@@ -137,7 +137,7 @@ public class PluginArboriculture extends ForestryPlugin {
WoodItemAccess.registerStairs(blocks.stairsFireproof, woodType, true);
}
MachineDefinition definitionChest = new MachineDefinition(BlockArboriculture.Type.ARBCHEST.ordinal(),
MachineDefinition definitionChest = new MachineDefinition(BlockArboricultureType.ARBCHEST.ordinal(),
"forestry.ArbChest", TileArboristChest.class, Proxies.render.getRenderChest("arbchest"))
.setBoundingBox(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
blocks.arboriculture.addDefinition(definitionChest);
@@ -170,7 +170,7 @@ public class PluginArboriculture extends ForestryPlugin {
GameRegistry.registerTileEntity(TileWood.class, "forestry.Wood");
GameRegistry.registerTileEntity(TileFruitPod.class, "forestry.Pods");
blocks.arboriculture.registerDefinitions();
blocks.arboriculture.init();
if (Config.enableVillagers) {
VillagerRegistry.instance().registerVillagerId(Constants.ID_VILLAGER_LUMBERJACK);
@@ -328,7 +328,7 @@ public class PluginArboriculture extends ForestryPlugin {
'T', items.treealyzer,
'X', "ingotBronze");
RecipeUtil.addRecipe(blocks.arboriculture.get(BlockArboriculture.Type.ARBCHEST, 1),
RecipeUtil.addRecipe(blocks.arboriculture.get(BlockArboricultureType.ARBCHEST, 1),
" # ",
"XYX",
"XXX",
@@ -59,8 +59,6 @@ import forestry.core.recipes.RecipeUtil;
import forestry.core.recipes.ShapedRecipeCustom;
import forestry.core.recipes.ShapelessRecipeCustom;
import forestry.core.tiles.MachineDefinition;
import forestry.core.tiles.TileAnalyzer;
import forestry.core.tiles.TileEscritoire;
import forestry.core.utils.ClimateUtil;
import forestry.core.utils.ForestryModEnvWarningCallable;
@@ -103,9 +101,8 @@ public class PluginCore extends ForestryPlugin {
rootCommand.addChildCommand(new CommandPlugins());
blocks.core.addDefinitions(
new MachineDefinition(BlockCoreType.ESCRITOIRE.ordinal(), "forestry.Escritoire", TileEscritoire.class, Proxies.render.getRenderEscritoire()),
new MachineDefinition(BlockCoreType.ANALYZER.ordinal(), "forestry.Analyzer", TileAnalyzer.class,
PluginApiculture.proxy.getRendererAnalyzer(Constants.TEXTURE_PATH_BLOCKS + "/analyzer_"))
new MachineDefinition(BlockCoreType.ESCRITOIRE),
new MachineDefinition(BlockCoreType.ANALYZER)
);
}
@@ -115,7 +112,7 @@ public class PluginCore extends ForestryPlugin {
Proxies.render.init();
blocks.core.registerDefinitions();
blocks.core.init();
ForestryModEnvWarningCallable.register();
@@ -10,7 +10,6 @@
******************************************************************************/
package forestry.plugins;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
@@ -18,18 +17,13 @@ import cpw.mods.fml.common.SidedProxy;
import forestry.api.core.ForestryAPI;
import forestry.core.GuiHandlerBase;
import forestry.core.blocks.BlockBase;
import forestry.core.config.Constants;
import forestry.core.config.ForestryBlock;
import forestry.core.items.ItemBlockForestry;
import forestry.core.recipes.RecipeUtil;
import forestry.energy.GuiHandlerEnergy;
import forestry.energy.blocks.BlockEngine;
import forestry.energy.blocks.BlockEngineType;
import forestry.energy.blocks.BlockRegistryEnergy;
import forestry.energy.proxy.ProxyEnergy;
import forestry.energy.tiles.EngineDefinition;
import forestry.energy.tiles.TileEngineBiogas;
import forestry.energy.tiles.TileEngineClockwork;
import forestry.energy.tiles.TileEnginePeat;
@Plugin(pluginID = "Energy", name = "Energy", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.energy.description")
public class PluginEnergy extends ForestryPlugin {
@@ -37,38 +31,35 @@ public class PluginEnergy extends ForestryPlugin {
@SidedProxy(clientSide = "forestry.energy.proxy.ProxyEnergyClient", serverSide = "forestry.energy.proxy.ProxyEnergy")
public static ProxyEnergy proxy;
public static BlockRegistryEnergy blocks;
@Override
protected void registerItemsAndBlocks() {
super.registerItemsAndBlocks();
ForestryBlock.engine.registerBlock(new BlockEngine(Material.iron), ItemBlockForestry.class, "engine");
blocks = new BlockRegistryEnergy();
}
@Override
public void preInit() {
EngineDefinition definitionEnginePeat = new EngineDefinition(Constants.DEFINITION_ENGINE_PEAT_META, "forestry.EngineCopper", TileEnginePeat.class,
PluginEnergy.proxy.getRenderDefaultEngine(Constants.TEXTURE_PATH_BLOCKS + "/engine_copper_"));
((BlockBase) ForestryBlock.engine.block()).addDefinition(definitionEnginePeat);
blocks.engine.addDefinitions(
new EngineDefinition(BlockEngineType.PEAT),
new EngineDefinition(BlockEngineType.BIOGAS)
);
EngineDefinition definitionEngineBiogas = new EngineDefinition(Constants.DEFINITION_ENGINE_BIOGAS_META, "forestry.EngineBronze", TileEngineBiogas.class,
PluginEnergy.proxy.getRenderDefaultEngine(Constants.TEXTURE_PATH_BLOCKS + "/engine_bronze_"));
((BlockBase) ForestryBlock.engine.block()).addDefinition(definitionEngineBiogas);
EngineDefinition definitionEngineClockwork = new EngineDefinition(Constants.DEFINITION_ENGINE_CLOCKWORK_META, "forestry.EngineClockwork", TileEngineClockwork.class,
PluginEnergy.proxy.getRenderDefaultEngine(Constants.TEXTURE_PATH_BLOCKS + "/engine_clock_"));
((BlockBase) ForestryBlock.engine.block()).addDefinition(definitionEngineClockwork);
if (ForestryAPI.activeMode.getBooleanSetting("energy.engine.clockwork")) {
blocks.engine.addDefinition(new EngineDefinition(BlockEngineType.CLOCKWORK));
}
}
@Override
public void doInit() {
((BlockBase) ForestryBlock.engine.block()).registerDefinitions();
blocks.engine.init();
}
@Override
protected void registerRecipes() {
super.registerRecipes();
RecipeUtil.addRecipe(ForestryBlock.engine.getItemStack(1, Constants.DEFINITION_ENGINE_PEAT_META),
RecipeUtil.addRecipe(blocks.engine.get(BlockEngineType.PEAT),
"###",
" X ",
"YVY",
@@ -77,7 +68,7 @@ public class PluginEnergy extends ForestryPlugin {
'Y', "gearCopper",
'V', Blocks.piston);
RecipeUtil.addRecipe(ForestryBlock.engine.getItemStack(1, Constants.DEFINITION_ENGINE_BIOGAS_META),
RecipeUtil.addRecipe(blocks.engine.get(BlockEngineType.BIOGAS),
"###",
" X ",
"YVY",
@@ -87,7 +78,7 @@ public class PluginEnergy extends ForestryPlugin {
'V', Blocks.piston);
if (ForestryAPI.activeMode.getBooleanSetting("energy.engine.clockwork")) {
RecipeUtil.addRecipe(ForestryBlock.engine.getItemStack(1, Constants.DEFINITION_ENGINE_CLOCKWORK_META),
RecipeUtil.addRecipe(blocks.engine.get(BlockEngineType.CLOCKWORK),
"###",
" X ",
"ZVY",
@@ -218,8 +218,8 @@ public class PluginFactory extends ForestryPlugin {
public void doInit() {
super.doInit();
blocks.factoryTESR.registerDefinitions();
blocks.factoryPlain.registerDefinitions();
blocks.factoryTESR.init();
blocks.factoryPlain.init();
Circuit.machineSpeedUpgrade1 = new CircuitSpeedUpgrade("machine.speed.boost.1", 0.125f, 0.05f, 4);
Circuit.machineSpeedUpgrade2 = new CircuitSpeedUpgrade("machine.speed.boost.2", 0.250f, 0.10f, 4);
@@ -13,7 +13,6 @@ package forestry.plugins;
import java.io.File;
import java.util.EnumSet;
import net.minecraft.block.material.Material;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
@@ -80,7 +79,7 @@ public class PluginLepidopterology extends ForestryPlugin {
protected void registerItemsAndBlocks() {
items = new ItemRegistryLepidopterology();
ForestryBlock.lepidopterology.registerBlock(new BlockBase(Material.iron, true), ItemBlockForestry.class, "lepidopterology");
ForestryBlock.lepidopterology.registerBlock(new BlockBase(true), ItemBlockForestry.class, "lepidopterology");
ForestryBlock.lepidopterology.block().setCreativeTab(Tabs.tabLepidopterology);
}
@@ -115,7 +114,7 @@ public class PluginLepidopterology extends ForestryPlugin {
MothDefinition.initMoths();
ButterflyDefinition.initButterflies();
((BlockBase) ForestryBlock.lepidopterology.block()).registerDefinitions();
((BlockBase) ForestryBlock.lepidopterology.block()).init();
TreeManager.treeRoot.registerLeafTickHandler(new ButterflySpawner());
@@ -88,7 +88,7 @@ public class PluginMail extends ForestryPlugin {
public void doInit() {
super.doInit();
blocks.mail.registerDefinitions();
blocks.mail.init();
}
@Override
@@ -37,25 +37,21 @@ import forestry.api.storage.ICrateRegistry;
import forestry.api.storage.StorageManager;
import forestry.apiculture.items.EnumPropolis;
import forestry.apiculture.items.ItemRegistryApiculture;
import forestry.core.blocks.BlockBase;
import forestry.core.circuits.Circuit;
import forestry.core.circuits.CircuitLayout;
import forestry.core.config.Constants;
import forestry.core.config.ForestryBlock;
import forestry.core.fluids.Fluids;
import forestry.core.items.EnumElectronTube;
import forestry.core.proxy.Proxies;
import forestry.core.recipes.RecipeUtil;
import forestry.core.tiles.MachineDefinition;
import forestry.core.utils.ItemStackUtil;
import forestry.core.utils.Log;
import forestry.core.utils.ModUtil;
import forestry.energy.blocks.BlockEngineType;
import forestry.energy.blocks.BlockRegistryEnergy;
import forestry.energy.circuits.CircuitElectricBoost;
import forestry.energy.circuits.CircuitElectricChoke;
import forestry.energy.circuits.CircuitElectricEfficiency;
import forestry.energy.tiles.EngineDefinition;
import forestry.energy.tiles.TileEngineElectric;
import forestry.energy.tiles.TileGenerator;
import forestry.farming.circuits.CircuitFarmLogic;
import forestry.farming.logic.FarmLogicRubber;
import forestry.plugins.ForestryPlugin;
@@ -113,7 +109,6 @@ public class PluginIC2 extends ForestryPlugin {
EnumSet<PluginManager.Module> deps = super.getDependancies();
deps.add(PluginManager.Module.FARMING);
deps.add(PluginManager.Module.FACTORY);
deps.add(PluginManager.Module.ENERGY);
return deps;
}
@@ -122,13 +117,13 @@ public class PluginIC2 extends ForestryPlugin {
public void preInit() {
super.preInit();
EngineDefinition definitionEngineElectric = new EngineDefinition(Constants.DEFINITION_ENGINE_ELECTRIC_META, "forestry.EngineTin", TileEngineElectric.class,
PluginEnergy.proxy.getRenderDefaultEngine(Constants.TEXTURE_PATH_BLOCKS + "/engine_tin_"));
((BlockBase) ForestryBlock.engine.block()).addDefinition(definitionEngineElectric);
MachineDefinition definitionGenerator = new MachineDefinition(Constants.DEFINITION_GENERATOR_META, "forestry.Generator", TileGenerator.class,
Proxies.render.getRenderDefaultMachine(Constants.TEXTURE_PATH_BLOCKS + "/generator_"));
((BlockBase) ForestryBlock.engine.block()).addDefinition(definitionGenerator);
BlockRegistryEnergy energyBlocks = PluginEnergy.blocks;
if (energyBlocks != null) {
energyBlocks.engine.addDefinitions(
new EngineDefinition(BlockEngineType.ELECTRIC),
new EngineDefinition(BlockEngineType.GENERATOR)
);
}
emptyCell = IC2Items.getItem("cell");
if (emptyCell != null) {
@@ -179,8 +174,6 @@ public class PluginIC2 extends ForestryPlugin {
Log.severe("IC2 Recipes.recyclerBlacklist not found.");
}
((BlockBase) ForestryBlock.engine.block()).registerDefinitions();
Circuit.energyElectricChoke1 = new CircuitElectricChoke("electric.choke.1");
Circuit.energyElectricEfficiency1 = new CircuitElectricEfficiency("electric.efficiency.1");
Circuit.energyElectricBoost1 = new CircuitElectricBoost("electric.boost.1", 2, 7, 20);
@@ -307,21 +300,24 @@ public class PluginIC2 extends ForestryPlugin {
ChipsetManager.solderManager.addRecipe(layoutManual, PluginCore.items.tubes.get(EnumElectronTube.RUBBER, 1), Circuit.farmRubberManual);
}
RecipeUtil.addRecipe(ForestryBlock.engine.getItemStack(1, Constants.DEFINITION_GENERATOR_META),
"X#X",
"XYX",
"X#X",
'#', "blockGlass",
'X', "ingotGold",
'Y', PluginCore.items.sturdyCasing);
BlockRegistryEnergy energyBlocks = PluginEnergy.blocks;
if (energyBlocks != null) {
RecipeUtil.addRecipe(energyBlocks.engine.get(BlockEngineType.GENERATOR),
"X#X",
"XYX",
"X#X",
'#', "blockGlass",
'X', "ingotGold",
'Y', PluginCore.items.sturdyCasing);
RecipeUtil.addRecipe(ForestryBlock.engine.getItemStack(1, Constants.DEFINITION_ENGINE_ELECTRIC_META),
"###",
" X ",
"YVY",
'#', "ingotTin",
'X', "blockGlass",
'Y', "gearTin",
'V', Blocks.piston);
RecipeUtil.addRecipe(energyBlocks.engine.get(BlockEngineType.ELECTRIC),
"###",
" X ",
"YVY",
'#', "ingotTin",
'X', "blockGlass",
'Y', "gearTin",
'V', Blocks.piston);
}
}
}