From e83abed439bcb8d827e7bd938cc35dad543a8c4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ales=CC=8C=20Fabia=CC=81nek?= Date: Wed, 12 Jul 2023 10:02:17 +0200 Subject: [PATCH] Corrected code --- .../faboslav/friendsandfoes/entity/CopperGolemEntity.java | 6 ++++-- .../com/faboslav/friendsandfoes/entity/TuffGolemEntity.java | 6 ++++-- .../com/faboslav/friendsandfoes/entity/WildfireEntity.java | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/common/src/main/java/com/faboslav/friendsandfoes/entity/CopperGolemEntity.java b/common/src/main/java/com/faboslav/friendsandfoes/entity/CopperGolemEntity.java index 59a7424d5..9b3227111 100644 --- a/common/src/main/java/com/faboslav/friendsandfoes/entity/CopperGolemEntity.java +++ b/common/src/main/java/com/faboslav/friendsandfoes/entity/CopperGolemEntity.java @@ -282,9 +282,11 @@ public boolean damage( DamageSource source, float amount ) { + Entity attacker = source.getAttacker(); + if ( - source.getAttacker() == null - || source.getAttacker() instanceof LightningEntity + attacker == null + || attacker instanceof LightningEntity || source == DamageSource.SWEET_BERRY_BUSH ) { return false; diff --git a/common/src/main/java/com/faboslav/friendsandfoes/entity/TuffGolemEntity.java b/common/src/main/java/com/faboslav/friendsandfoes/entity/TuffGolemEntity.java index a61ac94cb..7b5c150e0 100644 --- a/common/src/main/java/com/faboslav/friendsandfoes/entity/TuffGolemEntity.java +++ b/common/src/main/java/com/faboslav/friendsandfoes/entity/TuffGolemEntity.java @@ -696,9 +696,11 @@ public boolean damage( DamageSource source, float amount ) { + Entity attacker = source.getAttacker(); + if ( - source.getAttacker() == null - || source.getAttacker() instanceof LightningEntity + attacker == null + || attacker instanceof LightningEntity || source == DamageSource.SWEET_BERRY_BUSH ) { return false; diff --git a/common/src/main/java/com/faboslav/friendsandfoes/entity/WildfireEntity.java b/common/src/main/java/com/faboslav/friendsandfoes/entity/WildfireEntity.java index b2aa28fc2..116341ba9 100644 --- a/common/src/main/java/com/faboslav/friendsandfoes/entity/WildfireEntity.java +++ b/common/src/main/java/com/faboslav/friendsandfoes/entity/WildfireEntity.java @@ -267,7 +267,7 @@ public boolean damage( return false; } - if (this.hasActiveShields() && source.getAttacker() != null) { + if (this.hasActiveShields()) { this.damageAmountCounter += amount; float shieldBreakDamageThreshold = (float) this.getAttributeValue(EntityAttributes.GENERIC_MAX_HEALTH) * 0.25F;