2013-10-26 20:42:11 +00:00
|
|
|
package biomesoplenty.blocks;
|
|
|
|
|
2013-10-29 20:52:51 +00:00
|
|
|
import java.util.List;
|
2013-10-29 23:17:37 +00:00
|
|
|
import java.util.Random;
|
2013-10-29 20:52:51 +00:00
|
|
|
|
2013-10-26 20:42:11 +00:00
|
|
|
import net.minecraft.block.Block;
|
|
|
|
import net.minecraft.block.material.Material;
|
|
|
|
import net.minecraft.client.renderer.texture.IconRegister;
|
2013-10-29 20:52:51 +00:00
|
|
|
import net.minecraft.creativetab.CreativeTabs;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.util.Icon;
|
2013-10-26 20:42:11 +00:00
|
|
|
import net.minecraft.world.IBlockAccess;
|
|
|
|
import net.minecraft.world.World;
|
2013-10-29 20:52:51 +00:00
|
|
|
import net.minecraftforge.common.ForgeDirection;
|
2013-10-26 20:42:11 +00:00
|
|
|
import biomesoplenty.BiomesOPlenty;
|
2013-10-29 23:17:37 +00:00
|
|
|
import biomesoplenty.entities.EntityWasp;
|
2013-10-26 20:42:11 +00:00
|
|
|
|
|
|
|
public class BlockHive extends Block
|
|
|
|
{
|
2013-10-30 18:56:32 +00:00
|
|
|
private static final String[] hiveTypes = new String[] {"honeycomb", "hive", "honeycombempty"};
|
2013-10-29 20:52:51 +00:00
|
|
|
private Icon[] textures;
|
|
|
|
|
2013-10-26 20:42:11 +00:00
|
|
|
public BlockHive(int par1)
|
|
|
|
{
|
|
|
|
super(par1, Material.wood);
|
|
|
|
this.setCreativeTab(BiomesOPlenty.tabBiomesOPlenty);
|
|
|
|
}
|
2013-10-29 20:52:51 +00:00
|
|
|
|
2013-10-29 23:17:37 +00:00
|
|
|
@Override
|
|
|
|
public void breakBlock(World world, int x, int y, int z, int par5, int par6)
|
2013-10-29 20:52:51 +00:00
|
|
|
{
|
2013-10-30 04:21:12 +00:00
|
|
|
if (world.getBlockMetadata(x, y, z) == 2)
|
2013-10-29 23:17:37 +00:00
|
|
|
{
|
|
|
|
EntityWasp wasp = new EntityWasp(world);
|
2013-10-30 06:16:50 +00:00
|
|
|
wasp.setLocationAndAngles((double)x + 0.6, (double)y, (double)z + 0.3, 0.0F, 0.0F);
|
2013-10-29 23:17:37 +00:00
|
|
|
world.spawnEntityInWorld(wasp);
|
|
|
|
}
|
2013-10-29 20:52:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void registerIcons(IconRegister iconRegister)
|
|
|
|
{
|
|
|
|
textures = new Icon[hiveTypes.length];
|
|
|
|
|
|
|
|
for (int i = 0; i < hiveTypes.length; ++i) {
|
|
|
|
textures[i] = iconRegister.registerIcon("biomesoplenty:"+hiveTypes[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Icon getIcon(int side, int meta)
|
|
|
|
{
|
|
|
|
return textures[meta];
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void getSubBlocks(int blockID, CreativeTabs creativeTabs, List list)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < hiveTypes.length; ++i) {
|
|
|
|
list.add(new ItemStack(blockID, 1, i));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getFlammability(IBlockAccess world, int x, int y, int z, int metadata, ForgeDirection face)
|
|
|
|
{
|
2013-10-30 02:36:14 +00:00
|
|
|
super.setBurnProperties(blockID, 1, 30);
|
2013-10-29 20:52:51 +00:00
|
|
|
return blockFlammability[blockID];
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getFireSpreadSpeed(World world, int x, int y, int z, int metadata, ForgeDirection face)
|
|
|
|
{
|
|
|
|
return blockFireSpreadSpeed[blockID];
|
|
|
|
}
|
2013-10-26 20:42:11 +00:00
|
|
|
|
|
|
|
@Override
|
2013-10-29 20:52:51 +00:00
|
|
|
public boolean isFlammable(IBlockAccess world, int x, int y, int z, int metadata, ForgeDirection face)
|
2013-10-26 20:42:11 +00:00
|
|
|
{
|
2013-10-29 20:52:51 +00:00
|
|
|
return getFlammability(world, x, y, z, metadata, face) > 0;
|
2013-10-26 20:42:11 +00:00
|
|
|
}
|
|
|
|
}
|