package com.mrcrayfish.furniture.blocks;
import java.util.List;
import com.mrcrayfish.furniture.init.FurnitureItems;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public abstract class BlockFirePit extends Block {
public static final PropertyInteger STAGE = PropertyInteger.create("stage", 0, 3);
public BlockFirePit(Material materialIn)
{
super(materialIn);
this.setStepSound(Block.soundTypeWood);
this.setHardness(1.0F);
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean isFullCube()
{
return false;
}
@Override
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
return worldIn.isSideSolid(pos.down(), EnumFacing.UP);
}
@Override
public void setBlockBoundsBasedOnState(IBlockAccess blockAccess, BlockPos pos)
{
setBlockBounds(0F, 0F, 0F, 1F, 0.1875F, 1F);
}
@Override
public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity)
{
setBlockBounds(0F, 0F, 0F, 1F, 0.1875F, 1F);
super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity);
}
@Override
public int getMetaFromState(IBlockState state)
{
return isBurning() ? 0 : (Integer) state.getValue(STAGE);
}
@Override
public IBlockState getStateFromMeta(int meta)
{
return isBurning() ? this.getDefaultState() : this.getDefaultState().withProperty(STAGE, meta);
}
@Override
protected BlockState createBlockState()
{
return isBurning() ? super.createBlockState() : new BlockState(this, new IProperty[] { STAGE });
}
@SideOnly(Side.CLIENT)
public EnumWorldBlockLayer getBlockLayer()
{
return EnumWorldBlockLayer.CUTOUT;
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos)
{
return new ItemStack(FurnitureItems.itemLog);
}
public abstract boolean isBurning();
}