check the block below if occupied

This commit is contained in:
Oth3r 2024-11-16 15:26:55 -06:00
commit 012778ba2b
2 changed files with 8 additions and 8 deletions

View file

@ -129,14 +129,17 @@ public class Logic {
// get the entity's block pos
BlockPos pos = Utl.Entity.getBlockPos(entity);
// get the poses to check above the block
BlockPos pos1 = new BlockPos(pos).add(0,1,0), pos2 = new BlockPos(pos).add(0,2,0);
BlockPos pos1 = new BlockPos(pos).add(0,1,0), pos2 = new BlockPos(pos).add(0,2,0), posBelow = new BlockPos(pos);
// doesn't check 2 blocks above if not sitting above .80 of the block
if (pos.getY() > entity.getY() - .80) pos2 = pos2.add(0,-1,0);
if (pos.getY() > entity.getY() - .80) {
pos2 = pos2.add(0,-1,0);
posBelow = posBelow.add(0,-1,0);
}
// check if both poses are obstructed or not
return Utl.isNotObstructed(entity.getWorld(),pos1) && Utl.isNotObstructed(entity.getWorld(),pos2)
// also check if occupied
&& Utl.isNotOccupied(pos1) && Utl.isNotOccupied(pos2);
// also check if occupied, checking below to make sure you cant sit directly on top of another sit entity
&& Utl.isNotOccupied(pos) && Utl.isNotOccupied(pos1) && Utl.isNotOccupied(pos2) && Utl.isNotOccupied(posBelow);
}
/**