Skip to content

Commit

Permalink
(pot.) Fix another strange Effect-Based error
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakllp committed Nov 23, 2024
1 parent ff6b974 commit 95d588e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import de.Keyle.MyPet.compat.v1_20_R4.entity.EntityMyFlyingPet;
import de.Keyle.MyPet.compat.v1_20_R4.entity.EntityMyPet;
import de.Keyle.MyPet.compat.v1_20_R4.entity.ai.navigation.MyAquaticPetPathNavigation;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.LivingEntity;
Expand Down Expand Up @@ -169,7 +170,7 @@ private void applyWalkSpeed() {
// make the pet faster when the player is has the SPEED effect
// TODO check if this canbe removed in later versions (again)
for(MobEffectInstance eff:owner.getActiveEffects()) {
if (eff.getEffect() == MobEffects.MOVEMENT_SPEED) {
if (eff.getEffect() instanceof MobEffect && eff.getEffect() == MobEffects.MOVEMENT_SPEED) {
walkSpeed += eff.getAmplifier() * 0.2 * walkSpeed;
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import de.Keyle.MyPet.compat.v1_21_R1.entity.EntityMyFlyingPet;
import de.Keyle.MyPet.compat.v1_21_R1.entity.EntityMyPet;
import de.Keyle.MyPet.compat.v1_21_R1.entity.ai.navigation.MyAquaticPetPathNavigation;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.LivingEntity;
Expand Down Expand Up @@ -168,8 +169,8 @@ private void applyWalkSpeed() {
} else if (owner.hasEffect(MobEffects.MOVEMENT_SPEED)) {
// make the pet faster when the player is has the SPEED effect
// TODO check if this canbe removed in later versions (again)
for(MobEffectInstance eff:owner.getActiveEffects()) {
if (eff.getEffect() == MobEffects.MOVEMENT_SPEED) {
for(MobEffectInstance eff : owner.getActiveEffects()) {
if (eff.getEffect() instanceof MobEffect && eff.getEffect() == MobEffects.MOVEMENT_SPEED) {
walkSpeed += eff.getAmplifier() * 0.2 * walkSpeed;
break;
}
Expand Down

0 comments on commit 95d588e

Please sign in to comment.