From e7e138f1562365254a292a46be97866944f7bdd1 Mon Sep 17 00:00:00 2001 From: DarkGuardsman Date: Fri, 30 Aug 2013 08:10:42 -0400 Subject: [PATCH] Added basic machine class This will hold 4 basic machines for the mod. First will be the compost box, and then maybe the bio fuel compressor. I'll have to think of another 2 basic machines to use for this blockID. --- .../farmtech/machines/BlockBasicMachine.java | 77 +++++++++++++++++++ .../farmtech/machines/TileEntityCompBox.java | 6 ++ 2 files changed, 83 insertions(+) create mode 100644 src/dark/farmtech/machines/BlockBasicMachine.java create mode 100644 src/dark/farmtech/machines/TileEntityCompBox.java diff --git a/src/dark/farmtech/machines/BlockBasicMachine.java b/src/dark/farmtech/machines/BlockBasicMachine.java new file mode 100644 index 00000000..16c1afa4 --- /dev/null +++ b/src/dark/farmtech/machines/BlockBasicMachine.java @@ -0,0 +1,77 @@ +package dark.farmtech.machines; + +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Icon; +import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class BlockBasicMachine extends BlockFT +{ + Icon generic_side, wood_side, box_Top; + + enum basicMachine + { + COMP_BOX("compostBox", TileEntityCompBox.class); + String name; + Class tile; + + private basicMachine(String name, Class tile) + { + this.name = name; + this.tile = tile; + } + + } + + public BlockBasicMachine(String name, int blockID, Material material) + { + super(name, blockID, material); + // TODO Auto-generated constructor stub + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IconRegister iconReg) + { + super.registerIcons(iconReg); + //this.source = iconReg.registerIcon(DarkMain.getInstance().PREFIX + "infSource"); + } + + @Override + @SideOnly(Side.CLIENT) + public Icon getIcon(int side, int meta) + { + switch (meta) + { + default: + return this.blockIcon; + } + } + + @Override + public TileEntity createTileEntity(World world, int metadata) + { + if (metadata < basicMachine.values().length) + { + try + { + return basicMachine.values()[metadata].tile.newInstance(); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + return super.createTileEntity(world, metadata); + } + + @Override + public TileEntity createNewTileEntity(World world) + { + return null; + } + +} diff --git a/src/dark/farmtech/machines/TileEntityCompBox.java b/src/dark/farmtech/machines/TileEntityCompBox.java new file mode 100644 index 00000000..cac6c4b8 --- /dev/null +++ b/src/dark/farmtech/machines/TileEntityCompBox.java @@ -0,0 +1,6 @@ +package dark.farmtech.machines; + +public class TileEntityCompBox extends TileEntityFT +{ + +}