remove BlockState parameter of getSittingHeight() method and retrieve inside

This commit is contained in:
Oth3r 2025-03-10 10:04:24 -05:00
commit 9b7794dbb5

View file

@ -153,14 +153,15 @@ public class Utl {
/** /**
* gets the sitting height for the provided blockstate, via memory loaded config from Data * gets the sitting height for the provided blockstate, via memory loaded config from Data
* @param blockState the state of the block
* @param player the player to * @param player the player to
* @param blockPos the pos of the block * @param blockPos the pos of the block
* @param hit nullable, for the player interaction check * @param hit nullable, for the player interaction check
* @return null if not a valid block * @return null if not a valid block
*/ */
public static Double getSittingHeight(BlockState blockState, ServerPlayerEntity player, BlockPos blockPos, @Nullable BlockHitResult hit) { public static Double getSittingHeight(ServerPlayerEntity player, BlockPos blockPos, @Nullable BlockHitResult hit) {
ServerWorld serverWorld = player.getServerWorld();
ServerConfig config = FileData.getServerConfig(); ServerConfig config = FileData.getServerConfig();
BlockState blockState = serverWorld.getBlockState(blockPos);
Block block = blockState.getBlock(); Block block = blockState.getBlock();
// make sure that the block that is being sit on has no interaction when hand sitting // make sure that the block that is being sit on has no interaction when hand sitting
@ -218,7 +219,7 @@ public class Utl {
// get the blockstate // get the blockstate
BlockState blockState = player.getWorld().getBlockState(blockPos); BlockState blockState = player.getWorld().getBlockState(blockPos);
// check if the block is still there & the block is a valid sit block (by checking if there is a sit height for the block) // check if the block is still there & the block is a valid sit block (by checking if there is a sit height for the block)
return !blockState.isAir() && getSittingHeight(blockState,player,blockPos,null) != null; return !blockState.isAir() && getSittingHeight(player,blockPos,null) != null;
} }
/** /**