Skip to content

Commit

Permalink
Fixed Line of Sight Check
Browse files Browse the repository at this point in the history
This thing returned TRUE instead of FALSE, causing all checks to cease after this.

Caused us to consider a new solution for these return values, see #13

We still need MORE DEBUG MESSAGES, and a better way to deal with the debug messages tbh...
  • Loading branch information
Peashooter101 committed Oct 9, 2022
1 parent 3d07700 commit 1231773
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,10 @@ private boolean checkForStandingInBlacklistedBlock(Entity entity, PersistentData

private boolean checkForBlockedLineOfSight(EntityDamageByEntityEvent event, Entity entity, PersistentDataContainer mobPDC, double damageAmount) {
if (!(entity instanceof LivingEntity)) return false;
if (!configToggles.get(ConfigParser.ConfigToggles.REQUIRE_LINE_OF_SIGHT)) return true;
if (!configToggles.get(ConfigParser.ConfigToggles.REQUIRE_LINE_OF_SIGHT)) return false;
Entity damager = event.getDamager();
boolean lineofsight = ((LivingEntity) entity).hasLineOfSight(damager);
if (!lineofsight) {
boolean lineOfSight = ((LivingEntity) entity).hasLineOfSight(damager);
if (!lineOfSight) {
NerfFarms.debugMessage("Adding " + damageAmount + " to " + entity.getName() + "'s PDC because they do not have a valid line of sight to the damager"
+ "\nCurrent PDC amount is: " + mobPDC.getOrDefault(blacklistedDamage, PersistentDataType.DOUBLE, 0.0));
addPDCDamage(mobPDC, damageAmount);
Expand Down Expand Up @@ -223,6 +223,8 @@ private boolean checkIfMobCanMoveToward(EntityDamageByEntityEvent event, Entity
private boolean checkForProjectileDamage(EntityDamageByEntityEvent event, Entity entity, PersistentDataContainer mobPDC, double hitDamage){
if (!(event.getDamager() instanceof Projectile projectile)) return false;

NerfFarms.debugMessage("Performing checkForProjectileDamage on " + entity.getName());

if (!configToggles.get(ConfigParser.ConfigToggles.ALLOW_PROJECTILE_DAMAGE)){
NerfFarms.debugMessage("Arrow damage is not allowed");
addPDCDamage(mobPDC, hitDamage);
Expand Down

0 comments on commit 1231773

Please sign in to comment.