2013-07-26 21:18:53 -07:00
|
|
|
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;
|
2013-07-26 21:18:53 -07:00
|
|
|
import net.minecraft.entity.Entity;
|
2013-12-31 15:30:34 -05:00
|
|
|
import net.minecraft.init.Blocks;
|
2013-07-26 21:18:53 -07:00
|
|
|
import net.minecraft.util.AxisAlignedBB;
|
2013-12-31 11:26:08 -05:00
|
|
|
import net.minecraft.util.IIcon;
|
2013-07-26 21:18:53 -07: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 MultiBrickFancy extends TConstructBlock
|
|
|
|
|
{
|
|
|
|
|
static String blockTextures[] = { "fancybrick_obsidian", "fancybrick_sandstone", "fancybrick_netherrack", "fancybrick_stone_refined", "fancybrick_iron", "fancybrick_gold", "fancybrick_lapis",
|
|
|
|
|
"fancybrick_diamond", "fancybrick_redstone", "fancybrick_bone", "fancybrick_slime", "fancybrick_blueslime", "fancybrick_endstone", "fancybrick_obsidian_ingot", "fancybrick_stone",
|
|
|
|
|
"road_stone" };
|
|
|
|
|
|
2013-12-31 15:30:34 -05:00
|
|
|
public MultiBrickFancy()
|
2013-07-26 21:18:53 -07:00
|
|
|
{
|
2013-12-31 15:30:34 -05:00
|
|
|
super(material.rock, 3f, blockTextures);
|
2013-07-26 21:18:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public float getBlockHardness (World world, int x, int y, int z)
|
|
|
|
|
{
|
|
|
|
|
int meta = world.getBlockMetadata(x, y, z);
|
|
|
|
|
switch (meta)
|
|
|
|
|
{
|
|
|
|
|
case 0:
|
2013-12-31 15:30:34 -05:00
|
|
|
return Blocks.obsidian.getBlockHardness(world, x, y, z);
|
2013-07-26 21:18:53 -07:00
|
|
|
case 1:
|
2013-12-31 15:30:34 -05:00
|
|
|
return Blocks.sandstone.getBlockHardness(world, x, y, z);
|
2013-07-26 21:18:53 -07:00
|
|
|
case 2:
|
2013-12-31 15:30:34 -05:00
|
|
|
return Blocks.netherrack.getBlockHardness(world, x, y, z);
|
2013-07-26 21:18:53 -07:00
|
|
|
case 4:
|
2013-12-31 15:30:34 -05:00
|
|
|
return Blocks.iron_block.getBlockHardness(world, x, y, z);
|
2013-07-26 21:18:53 -07:00
|
|
|
case 5:
|
2013-12-31 15:30:34 -05:00
|
|
|
return Blocks.gold_block.getBlockHardness(world, x, y, z);
|
2013-07-26 21:18:53 -07:00
|
|
|
case 6:
|
2013-12-31 15:30:34 -05:00
|
|
|
return Blocks.lapis_block.getBlockHardness(world, x, y, z);
|
2013-07-26 21:18:53 -07:00
|
|
|
case 7:
|
2013-12-31 15:30:34 -05:00
|
|
|
return Blocks.diamond_block.getBlockHardness(world, x, y, z);
|
2013-07-26 21:18:53 -07:00
|
|
|
case 8:
|
2013-12-31 15:30:34 -05:00
|
|
|
return Blocks.redstone_block.getBlockHardness(world, x, y, z);
|
2013-07-26 21:18:53 -07:00
|
|
|
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.getBlockHardness(world, x, y, z);
|
2013-07-26 21:18:53 -07:00
|
|
|
case 13:
|
2013-12-31 15:30:34 -05:00
|
|
|
return Blocks.obsidian.getBlockHardness(world, x, y, z);
|
2013-07-26 21:18:53 -07:00
|
|
|
case 3:
|
|
|
|
|
case 14:
|
|
|
|
|
case 15:
|
2013-12-31 15:30:34 -05:00
|
|
|
return Blocks.stone.getBlockHardness(world, x, y, z);
|
2013-07-26 21:18:53 -07:00
|
|
|
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:
|
2013-12-31 15:30:34 -05:00
|
|
|
return Blocks.obsidian.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
2013-07-26 21:18:53 -07:00
|
|
|
case 1:
|
2013-12-31 15:30:34 -05:00
|
|
|
return Blocks.sandstone.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
2013-07-26 21:18:53 -07:00
|
|
|
case 2:
|
2013-12-31 15:30:34 -05:00
|
|
|
return Blocks.netherrack.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
2013-07-26 21:18:53 -07:00
|
|
|
case 4:
|
2013-12-31 15:30:34 -05:00
|
|
|
return Blocks.iron_block.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
2013-07-26 21:18:53 -07:00
|
|
|
case 5:
|
2013-12-31 15:30:34 -05:00
|
|
|
return Blocks.gold_block.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
2013-07-26 21:18:53 -07:00
|
|
|
case 6:
|
2013-12-31 15:30:34 -05:00
|
|
|
return Blocks.lapis_block.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
2013-07-26 21:18:53 -07:00
|
|
|
case 7:
|
2013-12-31 15:30:34 -05:00
|
|
|
return Blocks.diamond_block.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
2013-07-26 21:18:53 -07:00
|
|
|
case 8:
|
2013-12-31 15:30:34 -05:00
|
|
|
return Blocks.redstone_block.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
2013-07-26 21:18:53 -07:00
|
|
|
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);
|
2013-07-26 21:18:53 -07:00
|
|
|
case 13:
|
2013-12-31 15:30:34 -05:00
|
|
|
return Blocks.obsidian.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
2013-07-26 21:18:53 -07:00
|
|
|
case 3:
|
|
|
|
|
case 14:
|
|
|
|
|
case 15:
|
2013-12-31 15:30:34 -05:00
|
|
|
return Blocks.stone.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
2013-07-26 21:18:53 -07:00
|
|
|
default:
|
2013-12-31 15:30:34 -05:00
|
|
|
return getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
|
2013-07-26 21:18:53 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onEntityCollidedWithBlock (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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public AxisAlignedBB getCollisionBoundingBoxFromPool (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);
|
|
|
|
|
return super.getCollisionBoundingBoxFromPool(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
|
|
|
|
|
public boolean canProvidePower ()
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int isProvidingWeakPower (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)
|
2013-12-31 15:30:34 -05:00
|
|
|
public void registerIcons (IIconRegister iconRegister)
|
2013-07-26 21:18:53 -07:00
|
|
|
{
|
2013-12-31 15:30:34 -05:00
|
|
|
this.icons = new IIcon[textureNames.length];
|
2013-07-26 21:18:53 -07:00
|
|
|
|
|
|
|
|
for (int i = 0; i < this.icons.length; ++i)
|
|
|
|
|
{
|
|
|
|
|
this.icons[i] = iconRegister.registerIcon("tinker:bricks/" + textureNames[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|