-
Notifications
You must be signed in to change notification settings - Fork 755
/
GlassBlock.java
77 lines (68 loc) · 2.08 KB
/
GlassBlock.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package tconstruct.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.util.Icon;
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" };
public GlassBlock(int id)
{
super(id, Material.glass, 3f, blockTextures);
}
public boolean isOpaqueCube ()
{
return false;
}
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{
int i1 = par1IBlockAccess.getBlockId(par2, par3, par4);
return i1 == this.blockID ? false : super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5);
}
@Override
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:
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:
return getExplosionResistance(entity);
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons (IconRegister iconRegister)
{
this.icons = new Icon[textureNames.length];
for (int i = 0; i < this.icons.length; ++i)
{
this.icons[i] = iconRegister.registerIcon("tinker:glass/" + textureNames[i]);
}
}
}