BiomesOPlenty/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBOPFlower.java

80 lines
2.4 KiB
Java
Raw Normal View History

2013-04-13 22:16:42 +00:00
package tdwp_ftw.biomesop.blocks;
import java.util.List;
import net.minecraft.block.Block;
2013-04-13 22:16:42 +00:00
import net.minecraft.block.BlockFlower;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess;
2013-04-14 00:23:46 +00:00
import net.minecraft.world.World;
2013-04-13 22:16:42 +00:00
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockBOPFlower extends BlockFlower
{
private static final String[] plants = new String[] {"swampflower", "deadbloom", "glowflower", "hydrangea", "orangeflower", "pinkflower", "purpleflower", "violet", "whiteflower"};
@SideOnly(Side.CLIENT)
private Icon[] textures;
protected BlockBOPFlower(int blockID, Material material)
{
super(blockID, material);
this.setTickRandomly(true);
float var4 = 0.2F;
this.setBlockBounds(0.5F - var4, 0.0F, 0.5F - var4, 0.5F + var4, var4 * 3.0F, 0.5F + var4);
this.setCreativeTab(mod_BiomesOPlenty.tabBiomesOPlenty);
}
public BlockBOPFlower(int blockID)
{
this(blockID, Material.plants);
}
@Override
2013-04-14 00:23:46 +00:00
@SideOnly(Side.CLIENT)
2013-04-13 22:16:42 +00:00
public void registerIcons(IconRegister iconRegister)
{
textures = new Icon[plants.length];
for (int i = 0; i < plants.length; ++i)
textures[i] = iconRegister.registerIcon("BiomesOPlenty:" + plants[i]);
}
@Override
@SideOnly(Side.CLIENT)
public Icon getBlockTextureFromSideAndMetadata(int side, int meta)
{
if (meta < 0 || meta >= textures.length)
meta = 0;
return textures[meta];
}
public int getLightValue(IBlockAccess world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
if (meta == 2)
return 9;
else
return 0;
}
2013-04-13 22:16:42 +00:00
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(int blockID, CreativeTabs creativeTabs, List list) {
for (int i = 0; i < plants.length; ++i)
list.add(new ItemStack(blockID, 1, i));
}
@Override
public int damageDropped(int meta)
{
return meta;
}
}