BiomesOPlenty/src/minecraft/biomesoplenty/blocks/BlockBOPGeneric.java

185 lines
3.7 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;
2013-06-09 00:39:12 +00:00
import net.minecraft.item.ItemStack;
2013-05-03 13:00:44 +00:00
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
{
ASH_STONE, HARD_SAND, HARD_DIRT, HARD_ICE, HOLY_STONE, BAMBOO_THATCHING, DRIED_DIRT, CRAG_ROCK, MUD_BRICK, HOLY_DIRT, CRYSTAL;
}
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 BAMBOO_THATCHING:
2013-06-09 00:39:12 +00:00
setHardness(1.0F).setResistance(5.0F).setStepSound(Block.soundWoodFootstep);
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 HOLY_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 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()
{
return super.getUnlocalizedName() + "." + type.toString().toLowerCase();
}
2013-05-31 10:34:02 +00:00
@Override
public void registerIcons(IconRegister iconRegister)
{
switch (type)
{
case ASH_STONE:
texture = iconRegister.registerIcon("BiomesOPlenty:ashstone");
break;
case BAMBOO_THATCHING:
texture = iconRegister.registerIcon("BiomesOPlenty:bamboothatching");
break;
case CRAG_ROCK:
texture = iconRegister.registerIcon("BiomesOPlenty:cragrock");
break;
case DRIED_DIRT:
texture = iconRegister.registerIcon("BiomesOPlenty:drieddirt");
break;
case HARD_DIRT:
texture = iconRegister.registerIcon("BiomesOPlenty:harddirt");
break;
case HARD_ICE:
texture = iconRegister.registerIcon("BiomesOPlenty:hardice");
break;
case HARD_SAND:
texture = iconRegister.registerIcon("BiomesOPlenty:hardsand");
break;
case HOLY_STONE:
texture = iconRegister.registerIcon("BiomesOPlenty:holystone");
break;
case MUD_BRICK:
texture = iconRegister.registerIcon("BiomesOPlenty:mudbrick");
break;
case HOLY_DIRT:
texture = iconRegister.registerIcon("BiomesOPlenty:holydirt");
break;
case CRYSTAL:
texture = iconRegister.registerIcon("BiomesOPlenty:crystal");
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
}