forked from virt-mirrors/Sit
better(ish) interaction detecting for server fix
This commit is contained in:
parent
6b51627875
commit
4894d720c8
1 changed files with 20 additions and 1 deletions
|
@ -171,7 +171,9 @@ public class Utl {
|
||||||
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
|
||||||
if (hit != null && blockState.onUse(player.getWorld(), player, hit).isAccepted()) return null;
|
if (hit != null && hasInteraction(blockState)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// only if custom is enabled
|
// only if custom is enabled
|
||||||
if (config.isCustomEnabled()) {
|
if (config.isCustomEnabled()) {
|
||||||
|
@ -201,6 +203,23 @@ public class Utl {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* checks if a block has an interaction
|
||||||
|
* @param blockState
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static boolean hasInteraction(BlockState blockState) {
|
||||||
|
// todo flush out
|
||||||
|
Block block = blockState.getBlock();
|
||||||
|
// most blocks with entity has an interaction, just block all of them
|
||||||
|
if (block instanceof BlockWithEntity) return true;
|
||||||
|
if (block instanceof BedBlock) return true;
|
||||||
|
if (block instanceof DoorBlock) return true;
|
||||||
|
if (block instanceof TrapdoorBlock) return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static class Entity {
|
public static class Entity {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue