Search in sources :

Example 6 with ImmutableDirectionalData

use of org.spongepowered.api.data.manipulator.immutable.block.ImmutableDirectionalData in project SpongeCommon by SpongePowered.

the class MixinBlockWallSign method getStateWithData.

@Override
public Optional<BlockState> getStateWithData(IBlockState blockState, ImmutableDataManipulator<?, ?> manipulator) {
    if (manipulator instanceof ImmutableDirectionalData) {
        final Direction direction = ((ImmutableDirectionalData) manipulator).direction().get();
        final EnumFacing facing = DirectionResolver.getFor(direction);
        return Optional.of((BlockState) blockState.withProperty(BlockWallSign.FACING, facing));
    }
    return super.getStateWithData(blockState, manipulator);
}
Also used : EnumFacing(net.minecraft.util.EnumFacing) Direction(org.spongepowered.api.util.Direction) ImmutableDirectionalData(org.spongepowered.api.data.manipulator.immutable.block.ImmutableDirectionalData)

Aggregations

ImmutableDirectionalData (org.spongepowered.api.data.manipulator.immutable.block.ImmutableDirectionalData)6 Direction (org.spongepowered.api.util.Direction)6 EnumFacing (net.minecraft.util.EnumFacing)3 ImmutableAxisData (org.spongepowered.api.data.manipulator.immutable.block.ImmutableAxisData)1 ImmutablePoweredData (org.spongepowered.api.data.manipulator.immutable.block.ImmutablePoweredData)1 Axis (org.spongepowered.api.util.Axis)1