mirror of
https://github.com/Oth3r/Sit.git
synced 2025-09-19 16:03:22 +02:00
remove BlockState parameter of getSittingHeight() method and retrieve inside
This commit is contained in:
parent
44183128a5
commit
9b7794dbb5
1 changed files with 4 additions and 3 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue