Skip to content

Commit 54517ad

Browse files
committed
Pathfind Option checks that the path is not blocked above
1 parent 1efd3f1 commit 54517ad

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/main/java/adhdmc/nerffarms/listener/MobDamageListener.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,8 @@ private boolean checkSurroundings(EntityDamageByEntityEvent event, Entity entity
416416
double entityHeight = entity.getHeight();
417417
Location entityLocation;
418418
if (entityHeight > 1) {
419-
entityLocation = entity.getLocation().add(0, (entityHeight - 1), 0);
419+
int addToLoc = (int) Math.round(entityHeight - 1);
420+
entityLocation = entity.getLocation().add(0, addToLoc, 0);
420421
} else {
421422
entityLocation = entity.getLocation();
422423
}

src/main/java/adhdmc/nerffarms/util/CheckUtils.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ public static LivingEntity getRealDamager(EntityDamageByEntityEvent event){
4242
public static Material getBlockAbove(Location location, Entity entity){
4343
double entityHeight = entity.getHeight();
4444
if (entityHeight > 1) {
45-
location = location.add(0, (entityHeight - 1), 0);
45+
int addToLoc = (int) Math.round(entityHeight - 1);
46+
location = location.add(0, addToLoc, 0);
4647
}
4748
NerfFarms.debugLvl3("getBlockAbove: MaterialType " + location.getBlock().getType() + "\nLocation: " + location);
4849
return location.getBlock().getType();

0 commit comments

Comments
 (0)