Traveler's Backpack

Traveler's Backpack

32M Downloads

[Suggestion] Backpack can deploy on snow on death

Catomax262 opened this issue ยท 2 comments

commented

Is your feature request related to a problem? Please describe.
It is. I died in a illager-high snowy zone (a tundra more specifically), and it got deployed in an air spot REALLY far from the death point.

Describe the solution you'd like
For it to deploy on top of snow, as it is very very common.

Describe alternatives you've considered
none

Additional context
n/a

commented

Yoho! I gave this a pass, but was unable to fix the issue. I think I idenfed the issue (isTopSolid) and outlined the basic code:

public static boolean isTopSolid(Level level, Player player, BlockPos pos) 
{
    BlockState blockState = level.getBlockState(pos.below());
    Block block = blockState.getBlock();

    List<Block> exceptions = Arrays.asList(Blocks.SNOW, Blocks.SNOW_BLOCK);

    // Check if the block below is solid or in the exceptions list
    if (blockState.isSolid() || exceptions.contains(block)) 
    {
        return blockState.entityCanStandOn(level, pos.below(), player);
    }

    return false; // Return false if the block is not top solid
  }

However, the above fails to compile. Gonna leave this here for anyone that wants to further look into this issue.