BiomesOPlenty/common/biomesoplenty/blocks/BlockBOPGeneric.java

168 lines
3.2 KiB
Java
Raw Normal View History

2013-05-03 13:00:44 +00:00
package biomesoplenty.blocks;
import java.util.Random;
2013-05-03 13:00:44 +00:00
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.util.Icon;
import biomesoplenty.BiomesOPlenty;
import biomesoplenty.api.Items;
2013-05-03 13:00:44 +00:00
public class BlockBOPGeneric extends Block
{
2013-05-31 10:34:02 +00:00
public enum BlockType
{
2013-06-09 05:47:52 +00:00
ASH_STONE, HARD_SAND, HARD_DIRT, HARD_ICE, DRIED_DIRT, CRAG_ROCK, MUD_BRICK, HOLY_DIRT, CRYSTAL;
2013-05-31 10:34:02 +00:00
}
private Icon texture;
private BlockType type;
public BlockBOPGeneric(int id, Material material, BlockType type)
{
super(id, material);
this.type = type;
this.setCreativeTab(BiomesOPlenty.tabBiomesOPlenty);
switch (type)
{
case ASH_STONE:
2013-06-09 00:39:12 +00:00
setHardness(1.0F).setStepSound(Block.soundStoneFootstep);
2013-05-31 10:34:02 +00:00
break;
case CRAG_ROCK:
2013-06-09 00:39:12 +00:00
setHardness(1.0F).setStepSound(Block.soundGravelFootstep);
2013-05-31 10:34:02 +00:00
break;
case DRIED_DIRT:
2013-06-09 00:39:12 +00:00
setHardness(0.1F).setStepSound(Block.soundStoneFootstep);
2013-05-31 10:34:02 +00:00
break;
case HARD_DIRT:
2013-06-09 00:39:12 +00:00
setHardness(0.9F).setStepSound(Block.soundStoneFootstep);
2013-05-31 10:34:02 +00:00
break;
case HARD_ICE:
2013-06-09 00:39:12 +00:00
setHardness(0.75F).setStepSound(Block.soundStoneFootstep);
2013-05-31 10:34:02 +00:00
break;
case HARD_SAND:
2013-06-09 00:39:12 +00:00
setHardness(0.7F).setStepSound(Block.soundSandFootstep);
2013-05-31 10:34:02 +00:00
break;
case MUD_BRICK:
2013-06-09 00:39:12 +00:00
setHardness(1.0F).setResistance(2.0F).setStepSound(Block.soundStoneFootstep);
2013-05-31 10:34:02 +00:00
break;
case HOLY_DIRT:
2013-06-09 00:39:12 +00:00
setHardness(0.6F).setStepSound(Block.soundGravelFootstep);
2013-05-31 10:34:02 +00:00
break;
case CRYSTAL:
2013-06-09 00:39:12 +00:00
setHardness(0.15F).setResistance(5.0F).setLightValue(1.0F).setStepSound(Block.soundGlassFootstep);
2013-05-31 10:34:02 +00:00
break;
default:
break;
}
}
2013-06-09 00:39:12 +00:00
@Override
public String getUnlocalizedName()
{
2013-06-09 05:47:52 +00:00
return "tile.bop.generic" + "." + type.toString().toLowerCase();
2013-06-09 00:39:12 +00:00
}
2013-05-31 10:34:02 +00:00
@Override
public void registerIcons(IconRegister iconRegister)
{
switch (type)
{
case ASH_STONE:
texture = iconRegister.registerIcon("biomesoplenty:ashstone");
2013-05-31 10:34:02 +00:00
break;
case CRAG_ROCK:
texture = iconRegister.registerIcon("biomesoplenty:cragrock");
2013-05-31 10:34:02 +00:00
break;
case DRIED_DIRT:
texture = iconRegister.registerIcon("biomesoplenty:drieddirt");
2013-05-31 10:34:02 +00:00
break;
case HARD_DIRT:
texture = iconRegister.registerIcon("biomesoplenty:harddirt");
2013-05-31 10:34:02 +00:00
break;
case HARD_ICE:
texture = iconRegister.registerIcon("biomesoplenty:hardice");
2013-05-31 10:34:02 +00:00
break;
case HARD_SAND:
texture = iconRegister.registerIcon("biomesoplenty:hardsand");
2013-05-31 10:34:02 +00:00
break;
case MUD_BRICK:
texture = iconRegister.registerIcon("biomesoplenty:mudbrick");
2013-05-31 10:34:02 +00:00
break;
case HOLY_DIRT:
texture = iconRegister.registerIcon("biomesoplenty:holydirt");
2013-05-31 10:34:02 +00:00
break;
case CRYSTAL:
texture = iconRegister.registerIcon("biomesoplenty:crystal");
2013-05-31 10:34:02 +00:00
break;
default:
break;
}
}
@Override
2013-05-31 10:34:02 +00:00
public int idDropped(int par1, Random par2Random, int par3)
{
switch (type)
{
case CRYSTAL:
return Items.miscItems.get().itemID;
default:
return blockID;
}
}
@Override
public int damageDropped(int meta)
{
switch (type)
{
case CRYSTAL:
return 4;
default:
return meta;
}
}
@Override
public int quantityDropped(int meta, int fortune, Random random)
{
switch (type)
{
case CRYSTAL:
return 4;
default:
return 1;
}
}
@Override
2013-05-31 10:34:02 +00:00
public Icon getIcon(int side, int meta)
{
return texture;
}
2013-05-03 13:00:44 +00:00
}