Search in sources :

Example 1 with BlockHorizontal

use of net.minecraft.block.BlockHorizontal in project minecolonies by Minecolonies.

the class EntityCitizen method getRenderOffsetX.

public float getRenderOffsetX() {
    if (!isAsleep()) {
        return 0;
    }
    final IBlockState state = this.world.isBlockLoaded(getBedLocation()) ? this.world.getBlockState(getBedLocation()) : null;
    final boolean isBed = state != null && state.getBlock().isBed(state, this.world, getBedLocation(), this);
    final EnumFacing enumfacing = isBed && state.getBlock() instanceof BlockHorizontal ? state.getValue(BlockHorizontal.FACING) : null;
    if (enumfacing == null) {
        return 0;
    }
    return SLEEPING_RENDER_OFFSET * (float) enumfacing.getFrontOffsetX();
}
Also used : BlockHorizontal(net.minecraft.block.BlockHorizontal) IBlockState(net.minecraft.block.state.IBlockState)

Example 2 with BlockHorizontal

use of net.minecraft.block.BlockHorizontal in project minecolonies by Minecolonies.

the class EntityCitizen method getRenderOffsetZ.

public float getRenderOffsetZ() {
    if (!isAsleep()) {
        return 0;
    }
    final IBlockState state = this.world.isBlockLoaded(getBedLocation()) ? this.world.getBlockState(getBedLocation()) : null;
    final boolean isBed = state != null && state.getBlock().isBed(state, this.world, getBedLocation(), this);
    final EnumFacing enumfacing = isBed && state.getBlock() instanceof BlockHorizontal ? state.getValue(BlockHorizontal.FACING) : null;
    if (enumfacing == null) {
        return 0;
    }
    return SLEEPING_RENDER_OFFSET * (float) enumfacing.getFrontOffsetZ();
}
Also used : BlockHorizontal(net.minecraft.block.BlockHorizontal) IBlockState(net.minecraft.block.state.IBlockState)

Aggregations

BlockHorizontal (net.minecraft.block.BlockHorizontal)2 IBlockState (net.minecraft.block.state.IBlockState)2