Files
TinkersConstruct/src/main/java/tconstruct/blocks/GlassBlock.java
T

78 lines
2.1 KiB
Java
Raw Normal View History

package tconstruct.blocks;
2014-01-07 13:50:35 -05:00
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
2013-12-31 11:26:08 -05:00
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
2013-12-31 11:26:08 -05:00
import net.minecraft.util.IIcon;
2014-02-05 10:28:54 -05:00
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class GlassBlock extends TConstructBlock
{
static String blockTextures[] = { "glass_clear", "soulglass", "soulglass_clear" };
2013-12-31 11:26:08 -05:00
public GlassBlock()
{
2014-02-05 08:28:53 -05:00
super(Material.glass, 3f, blockTextures);
}
public boolean isOpaqueCube ()
{
return false;
}
@SideOnly(Side.CLIENT)
2014-02-05 08:28:53 -05:00
public boolean shouldSideBeRendered (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{
2014-02-05 08:28:53 -05:00
Block i1 = par1IBlockAccess.getBlock(par2, par3, par4);
return i1 == (Block) this ? false : super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5);
}
@Override
2014-02-05 08:28:53 -05:00
public float getBlockHardness (World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
switch (meta)
{
case 0:
return 0.3F;
case 1:
return 50.0F;
case 2:
return 50.0F;
default:
2014-02-05 08:28:53 -05:00
return blockHardness;
}
}
public float getExplosionResistance (Entity entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ)
{
int meta = world.getBlockMetadata(x, y, z);
switch (meta)
{
case 0:
return 1.5F;
case 1:
return 2000F;
case 2:
return 2000F;
default:
2014-02-05 08:28:53 -05:00
return getExplosionResistance(entity);
}
}
@Override
@SideOnly(Side.CLIENT)
2014-02-05 08:28:53 -05:00
public void registerBlockIcons (IIconRegister iconRegister)
{
2013-12-31 11:26:08 -05:00
this.icons = new IIcon[textureNames.length];
for (int i = 0; i < this.icons.length; ++i)
{
this.icons[i] = iconRegister.registerIcon("tinker:glass/" + textureNames[i]);
}
}
}