fix: fixed crash caused by placing racks vertically
@@ -131,11 +131,15 @@ public class RackBlock extends TetraWaterloggedBlock {
@Nullable
public BlockState getStateForPlacement(BlockItemUseContext context) {
+ if (Direction.Axis.Y != context.getFace().getAxis()) {
return Optional.of(getDefaultState().with(facingProp, context.getFace()))
.filter(blockState -> blockState.isValidPosition(context.getWorld(), context.getPos()))
.orElse(null);
}
+ return null;
+ }
+
@Override
public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) {
return worldIn.getBlockState(pos.offset(state.get(facingProp).getOpposite())).getMaterial().isSolid();
