2014-06-04 21:44:48 -08:00
|
|
|
package tconstruct.smeltery.blocks;
|
2013-07-26 21:18:53 -07:00
|
|
|
|
2014-01-07 13:50:35 -05:00
|
|
|
import net.minecraft.block.Block;
|
2013-07-26 21:18:53 -07:00
|
|
|
import net.minecraft.block.material.Material;
|
2013-12-31 11:26:08 -05:00
|
|
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
2013-07-26 21:18:53 -07:00
|
|
|
import net.minecraft.entity.Entity;
|
2013-12-31 11:26:08 -05:00
|
|
|
import net.minecraft.util.IIcon;
|
2023-09-24 22:57:55 +02:00
|
|
|
import net.minecraft.world.IBlockAccess;
|
|
|
|
|
import net.minecraft.world.World;
|
2023-01-28 18:04:28 -08:00
|
|
|
|
2023-09-25 00:17:50 +02:00
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
2023-05-15 15:07:18 +09:00
|
|
|
import tconstruct.blocks.TConstructBlock;
|
2013-07-26 21:18:53 -07:00
|
|
|
|
2022-09-22 19:51:23 +01:00
|
|
|
public class GlassBlock extends TConstructBlock {
|
2023-01-28 18:04:28 -08:00
|
|
|
|
2023-01-25 21:05:22 +01:00
|
|
|
static String[] blockTextures = { "glass_clear", "soulglass", "soulglass_clear" };
|
2013-07-26 21:18:53 -07:00
|
|
|
|
2022-09-22 19:51:23 +01:00
|
|
|
public GlassBlock() {
|
2014-02-05 08:28:53 -05:00
|
|
|
super(Material.glass, 3f, blockTextures);
|
2013-07-26 21:18:53 -07:00
|
|
|
}
|
|
|
|
|
|
2014-02-17 00:31:43 -05:00
|
|
|
@Override
|
2022-09-22 19:51:23 +01:00
|
|
|
public boolean isOpaqueCube() {
|
2013-07-26 21:18:53 -07:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-17 00:31:43 -05:00
|
|
|
@Override
|
2013-07-26 21:18:53 -07:00
|
|
|
@SideOnly(Side.CLIENT)
|
2022-09-22 19:51:23 +01: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);
|
2023-01-26 01:32:56 +01:00
|
|
|
return i1 != this && super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5);
|
2013-07-26 21:18:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2022-09-22 19:51:23 +01:00
|
|
|
public float getBlockHardness(World world, int x, int y, int z) {
|
2013-07-26 21:18:53 -07:00
|
|
|
int meta = world.getBlockMetadata(x, y, z);
|
2022-09-22 19:51:23 +01:00
|
|
|
switch (meta) {
|
|
|
|
|
case 0:
|
|
|
|
|
return 0.3F;
|
|
|
|
|
case 1:
|
|
|
|
|
case 2:
|
|
|
|
|
return 50.0F;
|
|
|
|
|
default:
|
|
|
|
|
return blockHardness;
|
2013-07-26 21:18:53 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-17 00:31:43 -05:00
|
|
|
@Override
|
2022-09-22 19:51:23 +01:00
|
|
|
public float getExplosionResistance(Entity entity, World world, int x, int y, int z, double explosionX,
|
|
|
|
|
double explosionY, double explosionZ) {
|
2013-07-26 21:18:53 -07:00
|
|
|
int meta = world.getBlockMetadata(x, y, z);
|
2022-09-22 19:51:23 +01:00
|
|
|
switch (meta) {
|
|
|
|
|
case 0:
|
|
|
|
|
return 1.5F;
|
|
|
|
|
case 1:
|
|
|
|
|
case 2:
|
|
|
|
|
return 2000F;
|
|
|
|
|
default:
|
|
|
|
|
return getExplosionResistance(entity);
|
2013-07-26 21:18:53 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
2022-09-22 19:51:23 +01:00
|
|
|
public void registerBlockIcons(IIconRegister iconRegister) {
|
2013-12-31 11:26:08 -05:00
|
|
|
this.icons = new IIcon[textureNames.length];
|
2013-07-26 21:18:53 -07:00
|
|
|
|
2022-09-22 19:51:23 +01:00
|
|
|
for (int i = 0; i < this.icons.length; ++i) {
|
2013-07-26 21:18:53 -07:00
|
|
|
this.icons[i] = iconRegister.registerIcon("tinker:glass/" + textureNames[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|