More Machines!!!!
This commit is contained in:
parent
a05b0d01bf
commit
2f9b8a074c
4 changed files with 420 additions and 22 deletions
131
src/main/java/techreborn/blocks/BlockGrinder.java
Normal file
131
src/main/java/techreborn/blocks/BlockGrinder.java
Normal file
|
@ -0,0 +1,131 @@
|
|||
package techreborn.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockGrinder extends BlockContainer{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconFront;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBottom;
|
||||
|
||||
public BlockGrinder(Material material)
|
||||
{
|
||||
super(material);
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setBlockName("techreborn.grinder");
|
||||
setHardness(2F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister icon)
|
||||
{
|
||||
this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
|
||||
this.iconFront = icon.registerIcon("techreborn:machine/grinder_front");
|
||||
this.iconTop = icon.registerIcon("techreborn:machine/grinder_top");
|
||||
this.iconBottom = icon.registerIcon("techreborn:machine/machine_side");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
|
||||
return metadata == 0 && side == 3 ? this.iconFront
|
||||
: side == 1 ? this.iconTop : (side == 0 ? this.iconTop
|
||||
: (side == metadata ? this.iconFront : this.blockIcon));
|
||||
|
||||
}
|
||||
|
||||
public void onBlockAdded(World world, int x, int y, int z)
|
||||
{
|
||||
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
this.setDefaultDirection(world, x, y, z);
|
||||
|
||||
}
|
||||
|
||||
private void setDefaultDirection(World world, int x, int y, int z)
|
||||
{
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
Block block1 = world.getBlock(x, y, z - 1);
|
||||
Block block2 = world.getBlock(x, y, z + 1);
|
||||
Block block3 = world.getBlock(x - 1, y, z);
|
||||
Block block4 = world.getBlock(x + 1, y, z);
|
||||
|
||||
byte b = 3;
|
||||
|
||||
if (block1.func_149730_j() && !block2.func_149730_j())
|
||||
{
|
||||
b = 3;
|
||||
}
|
||||
if (block2.func_149730_j() && !block1.func_149730_j())
|
||||
{
|
||||
b = 2;
|
||||
}
|
||||
if (block3.func_149730_j() && !block4.func_149730_j())
|
||||
{
|
||||
b = 5;
|
||||
}
|
||||
if (block4.func_149730_j() && !block3.func_149730_j())
|
||||
{
|
||||
b = 4;
|
||||
}
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, b, 2);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z,
|
||||
EntityLivingBase player, ItemStack itemstack)
|
||||
{
|
||||
|
||||
int l = MathHelper
|
||||
.floor_double((double) (player.rotationYaw * 4.0F / 360F) + 0.5D) & 3;
|
||||
|
||||
if (l == 0)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
}
|
||||
if (l == 1)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
||||
}
|
||||
if (l == 2)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
}
|
||||
if (l == 3)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
131
src/main/java/techreborn/blocks/BlockImplosionCompressor.java
Normal file
131
src/main/java/techreborn/blocks/BlockImplosionCompressor.java
Normal file
|
@ -0,0 +1,131 @@
|
|||
package techreborn.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockImplosionCompressor extends BlockContainer{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconFront;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBottom;
|
||||
|
||||
public BlockImplosionCompressor(Material material)
|
||||
{
|
||||
super(material);
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setBlockName("techreborn.implosioncompressor");
|
||||
setHardness(2F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister icon)
|
||||
{
|
||||
this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
|
||||
this.iconFront = icon.registerIcon("techreborn:machine/implosioncompressor_front_off");
|
||||
this.iconTop = icon.registerIcon("techreborn:machine/implosioncompressor_top");
|
||||
this.iconBottom = icon.registerIcon("techreborn:machine/machine_side");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
|
||||
return metadata == 0 && side == 3 ? this.iconFront
|
||||
: side == 1 ? this.iconTop : (side == 0 ? this.iconTop
|
||||
: (side == metadata ? this.iconFront : this.blockIcon));
|
||||
|
||||
}
|
||||
|
||||
public void onBlockAdded(World world, int x, int y, int z)
|
||||
{
|
||||
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
this.setDefaultDirection(world, x, y, z);
|
||||
|
||||
}
|
||||
|
||||
private void setDefaultDirection(World world, int x, int y, int z)
|
||||
{
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
Block block1 = world.getBlock(x, y, z - 1);
|
||||
Block block2 = world.getBlock(x, y, z + 1);
|
||||
Block block3 = world.getBlock(x - 1, y, z);
|
||||
Block block4 = world.getBlock(x + 1, y, z);
|
||||
|
||||
byte b = 3;
|
||||
|
||||
if (block1.func_149730_j() && !block2.func_149730_j())
|
||||
{
|
||||
b = 3;
|
||||
}
|
||||
if (block2.func_149730_j() && !block1.func_149730_j())
|
||||
{
|
||||
b = 2;
|
||||
}
|
||||
if (block3.func_149730_j() && !block4.func_149730_j())
|
||||
{
|
||||
b = 5;
|
||||
}
|
||||
if (block4.func_149730_j() && !block3.func_149730_j())
|
||||
{
|
||||
b = 4;
|
||||
}
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, b, 2);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z,
|
||||
EntityLivingBase player, ItemStack itemstack)
|
||||
{
|
||||
|
||||
int l = MathHelper
|
||||
.floor_double((double) (player.rotationYaw * 4.0F / 360F) + 0.5D) & 3;
|
||||
|
||||
if (l == 0)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
}
|
||||
if (l == 1)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
||||
}
|
||||
if (l == 2)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
}
|
||||
if (l == 3)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
131
src/main/java/techreborn/blocks/BlockMatterFabricator.java
Normal file
131
src/main/java/techreborn/blocks/BlockMatterFabricator.java
Normal file
|
@ -0,0 +1,131 @@
|
|||
package techreborn.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockMatterFabricator extends BlockContainer{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconFront;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBottom;
|
||||
|
||||
public BlockMatterFabricator(Material material)
|
||||
{
|
||||
super(material);
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setBlockName("techreborn.matterfabricator");
|
||||
setHardness(2F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister icon)
|
||||
{
|
||||
this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
|
||||
this.iconFront = icon.registerIcon("techreborn:machine/matterfabricator_front_off");
|
||||
this.iconTop = icon.registerIcon("techreborn:machine/matterfabricator_top");
|
||||
this.iconBottom = icon.registerIcon("techreborn:machine/machine_side");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
|
||||
return metadata == 0 && side == 3 ? this.iconFront
|
||||
: side == 1 ? this.iconTop : (side == 0 ? this.iconTop
|
||||
: (side == metadata ? this.iconFront : this.blockIcon));
|
||||
|
||||
}
|
||||
|
||||
public void onBlockAdded(World world, int x, int y, int z)
|
||||
{
|
||||
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
this.setDefaultDirection(world, x, y, z);
|
||||
|
||||
}
|
||||
|
||||
private void setDefaultDirection(World world, int x, int y, int z)
|
||||
{
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
Block block1 = world.getBlock(x, y, z - 1);
|
||||
Block block2 = world.getBlock(x, y, z + 1);
|
||||
Block block3 = world.getBlock(x - 1, y, z);
|
||||
Block block4 = world.getBlock(x + 1, y, z);
|
||||
|
||||
byte b = 3;
|
||||
|
||||
if (block1.func_149730_j() && !block2.func_149730_j())
|
||||
{
|
||||
b = 3;
|
||||
}
|
||||
if (block2.func_149730_j() && !block1.func_149730_j())
|
||||
{
|
||||
b = 2;
|
||||
}
|
||||
if (block3.func_149730_j() && !block4.func_149730_j())
|
||||
{
|
||||
b = 5;
|
||||
}
|
||||
if (block4.func_149730_j() && !block3.func_149730_j())
|
||||
{
|
||||
b = 4;
|
||||
}
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, b, 2);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z,
|
||||
EntityLivingBase player, ItemStack itemstack)
|
||||
{
|
||||
|
||||
int l = MathHelper
|
||||
.floor_double((double) (player.rotationYaw * 4.0F / 360F) + 0.5D) & 3;
|
||||
|
||||
if (l == 0)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
}
|
||||
if (l == 1)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
||||
}
|
||||
if (l == 2)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
}
|
||||
if (l == 3)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -7,7 +7,10 @@ import net.minecraftforge.oredict.OreDictionary;
|
|||
import techreborn.blocks.BlockAlloySmelter;
|
||||
import techreborn.blocks.BlockBlastFurnace;
|
||||
import techreborn.blocks.BlockCentrifuge;
|
||||
import techreborn.blocks.BlockGrinder;
|
||||
import techreborn.blocks.BlockImplosionCompressor;
|
||||
import techreborn.blocks.BlockMachineCasing;
|
||||
import techreborn.blocks.BlockMatterFabricator;
|
||||
import techreborn.blocks.BlockOre;
|
||||
import techreborn.blocks.BlockQuantumChest;
|
||||
import techreborn.blocks.BlockQuantumTank;
|
||||
|
@ -41,6 +44,9 @@ public class ModBlocks {
|
|||
public static Block MachineCasing;
|
||||
public static Block BlastFurnace;
|
||||
public static Block AlloySmelter;
|
||||
public static Block Grinder;
|
||||
public static Block ImplosionCompressor;
|
||||
public static Block MatterFabricator;
|
||||
|
||||
public static Block ore;
|
||||
public static Block storage;
|
||||
|
@ -51,63 +57,62 @@ public class ModBlocks {
|
|||
.setBlockName("techreborn.thermalGenerator")
|
||||
.setBlockTextureName("techreborn:ThermalGenerator_other")
|
||||
.setCreativeTab(TechRebornCreativeTab.instance);
|
||||
GameRegistry.registerBlock(thermalGenerator,
|
||||
"techreborn.thermalGenerator");
|
||||
GameRegistry.registerTileEntity(TileThermalGenerator.class,
|
||||
"TileThermalGenerator");
|
||||
GameRegistry.registerBlock(thermalGenerator, "techreborn.thermalGenerator");
|
||||
GameRegistry.registerTileEntity(TileThermalGenerator.class, "TileThermalGenerator");
|
||||
|
||||
quantumTank = new BlockQuantumTank()
|
||||
.setBlockName("techreborn.quantumTank")
|
||||
.setBlockTextureName("techreborn:quantumTank")
|
||||
.setCreativeTab(TechRebornCreativeTab.instance);
|
||||
GameRegistry.registerBlock(quantumTank, ItemBlockQuantumTank.class,
|
||||
"techreborn.quantumTank");
|
||||
GameRegistry.registerTileEntity(TileQuantumTank.class,
|
||||
"TileQuantumTank");
|
||||
GameRegistry.registerBlock(quantumTank, ItemBlockQuantumTank.class, "techreborn.quantumTank");
|
||||
GameRegistry.registerTileEntity(TileQuantumTank.class, "TileQuantumTank");
|
||||
|
||||
quantumChest = new BlockQuantumChest()
|
||||
.setBlockName("techreborn.quantumChest")
|
||||
.setBlockTextureName("techreborn:quantumChest")
|
||||
.setCreativeTab(TechRebornCreativeTab.instance);
|
||||
GameRegistry.registerBlock(quantumChest, ItemBlockQuantumChest.class,
|
||||
"techreborn.quantumChest");
|
||||
GameRegistry.registerTileEntity(TileQuantumChest.class,
|
||||
"TileQuantumChest");
|
||||
GameRegistry.registerBlock(quantumChest, ItemBlockQuantumChest.class, "techreborn.quantumChest");
|
||||
GameRegistry.registerTileEntity(TileQuantumChest.class, "TileQuantumChest");
|
||||
|
||||
centrifuge = new BlockCentrifuge()
|
||||
.setBlockName("techreborn.centrifuge")
|
||||
.setBlockTextureName("techreborn:centrifuge")
|
||||
.setCreativeTab(TechRebornCreativeTab.instance);
|
||||
|
||||
GameRegistry.registerBlock(centrifuge, "techreborn.centrifuge");
|
||||
GameRegistry.registerTileEntity(TileCentrifuge.class, "TileCentrifuge");
|
||||
|
||||
RollingMachine = new BlockRollingMachine(Material.piston);
|
||||
GameRegistry.registerBlock(RollingMachine, "rollingmachine");
|
||||
GameRegistry.registerTileEntity(TileRollingMachine.class,
|
||||
"TileRollingMachine");
|
||||
GameRegistry.registerTileEntity(TileRollingMachine.class, "TileRollingMachine");
|
||||
|
||||
BlastFurnace = new BlockBlastFurnace(Material.piston);
|
||||
GameRegistry.registerBlock(BlastFurnace, "blastFurnace");
|
||||
GameRegistry.registerTileEntity(TileBlastFurnace.class,
|
||||
"TileBlastFurnace");
|
||||
GameRegistry.registerTileEntity(TileBlastFurnace.class, "TileBlastFurnace");
|
||||
|
||||
AlloySmelter = new BlockAlloySmelter(Material.piston);
|
||||
GameRegistry.registerBlock(AlloySmelter, "alloySmelter");
|
||||
GameRegistry.registerTileEntity(TileAlloySmelter.class, "TileAlloySmalter");
|
||||
|
||||
Grinder = new BlockGrinder(Material.piston);
|
||||
GameRegistry.registerBlock(Grinder, "grinder");
|
||||
|
||||
ImplosionCompressor = new BlockImplosionCompressor(Material.piston);
|
||||
GameRegistry.registerBlock(ImplosionCompressor, "implosioncompressor");
|
||||
|
||||
MatterFabricator = new BlockMatterFabricator(Material.piston);
|
||||
GameRegistry.registerBlock(MatterFabricator, "matterfabricator");
|
||||
|
||||
MachineCasing = new BlockMachineCasing(Material.piston);
|
||||
GameRegistry.registerBlock(MachineCasing, ItemBlockMachineCasing.class,
|
||||
"machinecasing");
|
||||
GameRegistry.registerTileEntity(TileMachineCasing.class,
|
||||
"TileMachineCasing");
|
||||
GameRegistry.registerBlock(MachineCasing, ItemBlockMachineCasing.class, "machinecasing");
|
||||
GameRegistry.registerTileEntity(TileMachineCasing.class, "TileMachineCasing");
|
||||
|
||||
ore = new BlockOre(Material.rock);
|
||||
GameRegistry.registerBlock(ore, ItemBlockOre.class, "techreborn.ore");
|
||||
LogHelper.info("TechReborns Blocks Loaded");
|
||||
|
||||
storage = new BlockStorage(Material.rock);
|
||||
GameRegistry.registerBlock(storage, ItemBlockStorage.class,
|
||||
"techreborn.storage");
|
||||
GameRegistry.registerBlock(storage, ItemBlockStorage.class, "techreborn.storage");
|
||||
LogHelper.info("TechReborns Blocks Loaded");
|
||||
|
||||
registerOreDict();
|
||||
|
|
Loading…
Reference in a new issue