Files
TinkersConstruct/tconstruct/blocks/EquipBlock.java
T

132 lines
3.3 KiB
Java
Raw Normal View History

package tconstruct.blocks;
2013-08-18 19:58:36 -07:00
import java.util.*;
import cpw.mods.fml.relauncher.*;
import tconstruct.TConstruct;
import tconstruct.blocks.logic.FrypanLogic;
import tconstruct.client.block.FrypanRender;
import tconstruct.library.blocks.InventoryBlock;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
2013-08-18 19:58:36 -07:00
import net.minecraft.entity.*;
import net.minecraft.entity.player.EntityPlayer;
2013-08-18 19:58:36 -07:00
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
2013-08-18 19:58:36 -07:00
import net.minecraft.util.*;
import net.minecraft.world.*;
public class EquipBlock extends InventoryBlock
{
public EquipBlock(int id, Material material)
{
super(id, material);
this.setHardness(0.3f);
this.setBlockBounds(0, 0, 0, 1, 0.25f, 1);
//this.setCreativeTab(ToolConstruct.materialTab);
}
@Override
public String[] getTextureNames ()
{
return new String[] { "toolstation_top" };
}
public Icon getIcon (int side, int meta)
{
return Block.blockIron.getIcon(side, meta);
}
@SideOnly(Side.CLIENT)
public void registerIcons (IconRegister par1IconRegister)
{
//this.blockIcon = par1iconRegister.registerIcon(Block.blockIron.getUnlocalizedName());
}
@Override
public boolean renderAsNormalBlock ()
{
return false;
}
@Override
public boolean isOpaqueCube ()
{
return false;
}
@Override
public int getRenderType ()
{
return FrypanRender.frypanModelID;
}
@Override
public int idDropped (int par1, Random par2Random, int par3)
{
return 0;
}
@Override
public TileEntity createTileEntity (World world, int metadata)
{
return new FrypanLogic();
}
public void randomDisplayTick (World world, int x, int y, int z, Random random)
{
if (isActive(world, x, y, z))
{
float f = (float) x + 0.5F;
float f1 = (float) y + 0.25F + (random.nextFloat() * 6F) / 16F;
float f2 = (float) z + 0.5F;
float f4 = random.nextFloat() * 0.6F - 0.3F;
world.spawnParticle("smoke", f, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
world.spawnParticle("flame", f, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
}
}
2013-08-18 19:58:36 -07:00
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) {
super.onBlockPlacedBy(par1World, par2, par3, par4, par5EntityLivingBase, par6ItemStack);
int i3 = MathHelper.floor_double((par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
int newMeta = 0;
switch(i3){
case 3:
newMeta = 0;
break;
case 0:
newMeta = 3;
break;
case 1:
newMeta = 1;
break;
case 2:
newMeta = 2;
break;
}
par1World.setBlockMetadataWithNotify(par2, par3, par4, newMeta, 2);
}
public int getLightValue (IBlockAccess world, int x, int y, int z)
{
return !isActive(world, x, y, z) ? 0 : 9;
}
@Override
public Integer getGui (World world, int x, int y, int z, EntityPlayer entityplayer)
{
return TConstruct.proxy.frypanGuiID;
}
@Override
public Object getModInstance ()
{
return TConstruct.instance;
}
}