Skip to content

Commit

Permalink
feat: avoid replacing a not replaceable block temporary
Browse files Browse the repository at this point in the history
  • Loading branch information
smartcmd committed Jun 29, 2024
1 parent ccbcfa4 commit 6f9e753
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,11 @@ protected boolean tryPlaceBlockState(Dimension dimension, BlockState blockState,
if (player != null && DO_BLOCK_PLACING_CHECK && hasEntityCollision(dimension, placeBlockPos, blockState))
return false;

var oldBlockState = dimension.getBlockState(placeBlockPos);
// TODO: implement Block::isReplaceable()
if (oldBlockState.getBlockType() != BlockTypes.AIR_TYPE) {
return false;
}
var blockType = blockState.getBlockType();
var result = blockType.getBlockBehavior().place(dimension, blockState, placeBlockPos, placementInfo);
if (result) {
Expand Down

0 comments on commit 6f9e753

Please sign in to comment.