package net.geforcemods.securitycraft.blocks; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class BlockFrame extends BlockOwnable { public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); public BlockFrame(Material par1Material){ super(par1Material); setSoundType(SoundType.STONE); } @Override public boolean isNormalCube(IBlockState state){ return false; } @Override public EnumBlockRenderType getRenderType(IBlockState state) { return EnumBlockRenderType.MODEL; } @Override public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer){ return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()); } /* TODO: no clue about this @SideOnly(Side.CLIENT) public IBlockState getStateForEntityRender(IBlockState state){ return this.getDefaultState().withProperty(FACING, EnumFacing.SOUTH); }*/ @Override public IBlockState getStateFromMeta(int meta){ EnumFacing enumfacing = EnumFacing.getFront(meta); if(enumfacing.getAxis() == EnumFacing.Axis.Y){ enumfacing = EnumFacing.NORTH; } return this.getDefaultState().withProperty(FACING, enumfacing); } @Override public int getMetaFromState(IBlockState state){ return state.getValue(FACING).getIndex(); } @Override protected BlockStateContainer createBlockState(){ return new BlockStateContainer(this, new IProperty[] {FACING}); } }