Skip to content

Commit

Permalink
Update max placement height for scarecrows (#10571)
Browse files Browse the repository at this point in the history
Use level max build height rather than hardcoded 255
Fix identical issue in tree lookup for the forester
  • Loading branch information
Thodor12 authored Jan 5, 2025
1 parent ec6eccf commit ebe99bb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public BlockState getStateForPlacement(final BlockPlaceContext context)
{
@NotNull final Direction dir = (context.getPlayer() == null) ? Direction.NORTH : Direction.fromYRot(context.getPlayer().getYRot() + 180);

if (context.getClickedPos().getY() < 255 && context.getLevel().getBlockState(context.getClickedPos().above()).canBeReplaced(context))
if (context.getClickedPos().getY() < context.getLevel().getMaxBuildHeight() && context.getLevel().getBlockState(context.getClickedPos().above()).canBeReplaced(context))
{
return this.defaultBlockState().setValue(FACING, dir).setValue(HALF, DoubleBlockHalf.LOWER);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ public static List<ItemStack> getSaplingsForLeaf(ServerLevel world, BlockPos pos
private BlockPos getFirstLeaf(final LevelAccessor world)
{
// Find the closest leaf above, stay below max height
for (int i = 1; (i + topLog.getY()) < 255 && i < 10; i++)
for (int i = 1; (i + topLog.getY()) < world.getMaxBuildHeight() && i < 10; i++)
{
final BlockState blockState = world.getBlockState(topLog.offset(0, i, 0));
if (blockState.is(BlockTags.LEAVES) || blockState.is(ModTags.hugeMushroomBlocks))
Expand Down

0 comments on commit ebe99bb

Please sign in to comment.