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

154 lines
5.7 KiB
Java
Raw Normal View History

package tconstruct.blocks;
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 15:30:34 -05:00
import net.minecraft.init.Blocks;
import net.minecraft.util.AxisAlignedBB;
2013-12-31 11:26:08 -05:00
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class MultiBrick extends TConstructBlock
{
static String blockTextures[] = { "brick_obsidian", "brick_sandstone", "brick_netherrack", "brick_stone_refined", "brick_iron", "brick_gold", "brick_lapis", "brick_diamond", "brick_redstone",
"brick_bone", "brick_slime", "brick_blueslime", "brick_endstone", "brick_obsidian_ingot" };
2014-01-06 00:03:05 -05:00
public MultiBrick()
{
2014-01-06 00:03:05 -05:00
super(Material.field_151576_e, 3f, blockTextures);
}
@Override
2014-01-01 15:39:46 -05:00
public float func_149712_f (World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
switch (meta)
{
case 0:
2014-01-01 15:39:46 -05:00
return Blocks.obsidian.func_149712_f(world, x, y, z);
case 1:
2014-01-01 15:39:46 -05:00
return Blocks.sandstone.func_149712_f(world, x, y, z);
case 2:
2014-01-01 15:39:46 -05:00
return Blocks.netherrack.func_149712_f(world, x, y, z);
case 3:
2014-01-01 15:39:46 -05:00
return Blocks.stone.func_149712_f(world, x, y, z);
case 4:
2014-01-01 15:39:46 -05:00
return Blocks.iron_block.func_149712_f(world, x, y, z);
case 5:
2014-01-01 15:39:46 -05:00
return Blocks.gold_block.func_149712_f(world, x, y, z);
case 6:
2014-01-01 15:39:46 -05:00
return Blocks.lapis_block.func_149712_f(world, x, y, z);
case 7:
2014-01-01 15:39:46 -05:00
return Blocks.diamond_block.func_149712_f(world, x, y, z);
case 8:
2014-01-01 15:39:46 -05:00
return Blocks.redstone_block.func_149712_f(world, x, y, z);
case 9:
return 1.0F;
case 10:
return 1.5F;
case 11:
return 1.5F;
case 12:
2014-01-01 15:39:46 -05:00
return Blocks.end_stone.func_149712_f(world, x, y, z);
case 13:
2014-01-01 15:39:46 -05:00
return Blocks.obsidian.func_149712_f(world, x, y, z);
default:
2014-01-06 00:03:05 -05:00
return field_149782_v;
}
}
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:
2013-12-31 15:30:34 -05:00
return Blocks.obsidian.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 1:
2013-12-31 15:30:34 -05:00
return Blocks.sandstone.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 2:
2013-12-31 15:30:34 -05:00
return Blocks.netherrack.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 3:
2013-12-31 15:30:34 -05:00
return Blocks.stone.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 4:
2013-12-31 15:30:34 -05:00
return Blocks.iron_block.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 5:
2013-12-31 15:30:34 -05:00
return Blocks.gold_block.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 6:
2013-12-31 15:30:34 -05:00
return Blocks.lapis_block.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 7:
2013-12-31 15:30:34 -05:00
return Blocks.diamond_block.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 8:
2013-12-31 15:30:34 -05:00
return Blocks.redstone_block.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 9:
return 1.0F;
case 10:
return 1.5F;
case 11:
return 1.5F;
case 12:
2013-12-31 15:30:34 -05:00
return Blocks.end_stone.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 13:
2013-12-31 15:30:34 -05:00
return Blocks.obsidian.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
default:
2013-12-31 15:30:34 -05:00
return getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
}
}
@Override
2014-01-06 00:03:05 -05:00
public void func_149670_a (World world, int x, int y, int z, Entity entity)
{
int meta = world.getBlockMetadata(x, y, z);
if (meta == 10 || meta == 11)
{
if (entity.motionY < 0)
entity.motionY *= -1.2F;
entity.fallDistance = 0;
}
}
2014-01-06 00:03:05 -05:00
//TODO getCollisionBoundingBoxFromPool
@Override
2014-01-06 00:03:05 -05:00
public AxisAlignedBB func_149668_a (World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
if (meta == 10 || meta == 11)
return AxisAlignedBB.getBoundingBox(x, y, z, (double) x + 1.0D, (double) y + 0.625D, (double) z + 1.0D);
2014-01-06 00:03:05 -05:00
return super.func_149668_a(world, x, y, z);
}
/*@Override
public int getRenderType ()
{
return BrickRender.model;
}*/
@Override
public boolean isBlockNormalCube (World world, int x, int y, int z)
{
return world.getBlockMetadata(x, y, z) != 8;
}
@Override
2014-01-06 00:03:05 -05:00
public int func_149709_b (IBlockAccess world, int x, int y, int z, int side)
{
if (world.getBlockMetadata(x, y, z) == 8)
return 4;
return 0;
}
@Override
@SideOnly(Side.CLIENT)
2014-01-18 02:52:49 -05:00
public void func_149651_a (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:bricks/" + textureNames[i]);
}
}
}