Skip to content

Commit

Permalink
card deck now requires a full block face to be placed on
Browse files Browse the repository at this point in the history
(totally not because im too lazy to render the bottom of the card deck)
  • Loading branch information
awakaxis committed Nov 19, 2024
1 parent e71b5fb commit ffe6e8e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/main/java/net/awakaxis/uno/block/CardDeckBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,16 @@ public CardDeckBlock(BlockBehaviour.Properties properties) {
return DEFAULT_COLLISION;
}

@Override
public BlockState updateShape(BlockState blockState, Direction direction, BlockState blockState2, LevelAccessor levelAccessor, BlockPos blockPos, BlockPos blockPos2) {
return !this.canSurvive(blockState, levelAccessor, blockPos)
? Blocks.AIR.defaultBlockState()
: super.updateShape(blockState, direction, blockState2, levelAccessor, blockPos, blockPos2);
}

@Override
public boolean canSurvive(BlockState blockState, LevelReader levelReader, BlockPos blockPos) {
return !levelReader.isEmptyBlock(blockPos.below());
return levelReader.getBlockState(blockPos.below()).isFaceSturdy(levelReader, blockPos.below(), Direction.UP);
}

@Override
Expand Down

0 comments on commit ffe6e8e

Please sign in to comment.