Thanks again! But there still seems to be an issue... None of the interractions with the entity work.
Here is the current chair block code :
public class Phoerite_Chair extends Block {
public static PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL);
public Phoerite_Chair(Material materialIn) {
super(materialIn);
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
super.setBlockBounds( 0.0F, 0F, 0.0F, 1.0F, 1.35F, 1.0F);
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public EnumWorldBlockLayer getBlockLayer() {
return EnumWorldBlockLayer.CUTOUT;
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
if (!worldIn.isRemote)
{
WorldServer worldserver = (WorldServer) worldIn;
worldIn.spawnEntityInWorld(worldserver.getEntityFromUuid(TileEntityChair.ChairUUID));
}
super.onBlockPlacedBy(worldIn, pos, state, placer, stack);
}
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,EnumFacing side, float hitX, float hitY, float hitZ) {
if (!worldIn.isRemote)
{
WorldServer worldserver = (WorldServer) worldIn;
playerIn.mountEntity(worldserver.getEntityFromUuid(TileEntityChair.ChairUUID));
}
return super.onBlockActivated(worldIn, pos, state, playerIn, side, hitX, hitY, hitZ);
}
@Override
public void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, IBlockState state) {
if (!worldIn.isRemote)
{
WorldServer worldserver = (WorldServer) worldIn;
worldserver.getEntityFromUuid(TileEntityChair.ChairUUID).setDead();
}
super.onBlockDestroyedByPlayer(worldIn, pos, state);
}
@Override
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
IBlockState state = super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer);
return state.withProperty(FACING, placer.getHorizontalFacing());
}
@Override
public int getMetaFromState(IBlockState state) {
return ((EnumFacing) state.getValue(FACING)).getHorizontalIndex();
}
@Override
public IBlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(FACING, EnumFacing.getHorizontal(meta));
}
@Override
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] {FACING});
}
}