better(ish) interaction detecting for server fix

This commit is contained in:
Oth3r 2024-08-13 13:02:39 -05:00
commit 4894d720c8

View file

@ -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 {
/** /**