resonant-induction/common/dark/BasicUtilities/mechanical/BlockRod.java
Rseifert 28f62284a0 moved over from other repo
got around to moving this so Calc could help me with the clean up of it.
So far i havn't changed much but will soon. The main focus for the next
week on the mod will be just cleanup and bug fixing. I will also be
moving the motor from steam power to here. The mod has alos been renamed
since now it contains more than just pipes.
2012-11-14 13:16:22 -05:00

81 lines
2 KiB
Java

package dark.BasicUtilities.mechanical;
import net.minecraft.src.CreativeTabs;
import net.minecraft.src.EntityLiving;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.Material;
import net.minecraft.src.MathHelper;
import net.minecraft.src.TileEntity;
import net.minecraft.src.World;
import net.minecraftforge.common.ForgeDirection;
import dark.BasicUtilities.ItemRenderHelper;
public class BlockRod extends universalelectricity.prefab.BlockMachine {
public BlockRod(int par1) {
super("MechanicRod", par1, Material.iron);
this.setCreativeTab(CreativeTabs.tabRedstone);
}
@Override
public int damageDropped(int metadata)
{
return 0;
}
@Override
public void onBlockPlacedBy(World world,int i,int j,int k, EntityLiving player)
{
int angle= MathHelper.floor_double((player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
int meta = 0;
ForgeDirection idr;
int dZ = 0;
int dX = 0;
switch(angle)
{
case 0: meta = 2;dZ--;break;
case 1: meta = 5;dX--;break;
case 2: meta = 3;dZ++;break;
case 3: meta = 4;dX++;break;
}
world.setBlockAndMetadataWithUpdate(i, j, k,blockID, meta, true);
}
@Override
public boolean onUseWrench(World world, int x, int y, int z, EntityPlayer par5EntityPlayer)
{
int meta = world.getBlockMetadata(x, y, z);
if(meta >= 5)
{
world.setBlockMetadataWithNotify(x, y, z, 0);
}
else
{
world.setBlockMetadataWithNotify(x,y,z,meta+1);
}
return true;
}
@Override
public TileEntity createNewTileEntity(World var1)
{
return new TileEntityRod();
}
public boolean isOpaqueCube()
{
return false;
}
/**
* If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
*/
public boolean renderAsNormalBlock()
{
return false;
}
/**
* The type of render function that is called for this block
*/
public int getRenderType()
{
return ItemRenderHelper.renderID;
}
}