simplify code
This commit is contained in:
parent
2328cd75b6
commit
71e83874c0
@ -35,19 +35,7 @@ public abstract class BlockMatteryRotatable extends BlockMattery {
|
|||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public BlockState getStateForPlacement(BlockPlaceContext context) {
|
public BlockState getStateForPlacement(BlockPlaceContext context) {
|
||||||
Direction find_first = null;
|
return this.defaultBlockState().setValue(FACING, faceToPlayer(context) ? context.getHorizontalDirection().getOpposite() : context.getHorizontalDirection());
|
||||||
|
|
||||||
for (Direction direction : context.getNearestLookingDirections()) {
|
|
||||||
if (FACING.getPossibleValues().contains(direction)) {
|
|
||||||
find_first = direction;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (find_first == null)
|
|
||||||
return this.defaultBlockState();
|
|
||||||
|
|
||||||
return this.defaultBlockState().setValue(FACING, faceToPlayer(context) ? find_first.getOpposite() : find_first);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean faceToPlayer(BlockPlaceContext context) {
|
public boolean faceToPlayer(BlockPlaceContext context) {
|
||||||
|
Loading…
Reference in New Issue
Block a user