Skip to content

Commit

Permalink
v2.0 - other bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
DakotaPride committed Oct 5, 2024
1 parent c56c300 commit d2243b4
Showing 1 changed file with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,30 @@ public LivingEntityMixin(EntityType<?> entityType, Level level) {

@Inject(method = "getDamageAfterMagicAbsorb", at = @At("HEAD"))
private void applyThornsDamage$getDamageAfterMagicAbsorb(DamageSource source, float amount, CallbackInfoReturnable<Float> cir) {
if (source.getEntity() instanceof LivingEntity attacker) {
float j = amount / 2;
boolean f = j <= 3;
//boolean k = j < (attacker.getMaxHealth() / 2.25F);
MobEffect e = GarnishedEffects.THORNS;

if (source.getDirectEntity() instanceof LivingEntity attacker) {
if (entity.hasEffect(GarnishedEffects.THORNS) && entity.getEffect(GarnishedEffects.THORNS) != null) {
attacker.hurt(entity.damageSources().thorns(entity), 3.0F * Objects.requireNonNull(entity.getEffect(GarnishedEffects.THORNS)).getAmplifier());
if (f) {
j = 4;
}
}

if (entity.hasEffect(e) && !attacker.hasEffect(e)) {
attacker.hurt(source, j);

//CreateGarnished.LOGGER.info("Applied standard {} to {} from {}", j, attacker, entity);
} else if (j > (attacker.getMaxHealth() * 0.80F) && entity.hasEffect(e) && !attacker.hasEffect(e)) {
attacker.hurt(source, (attacker.getMaxHealth() * 0.80F));

//CreateGarnished.LOGGER.info("Applied maximum {} to {} from {}", (attacker.getMaxHealth() / 1.25F), attacker, entity);
}

// if (entity.hasEffect(GarnishedEffects.THORNS.get())) {
// attacker.hurt(entity.damageSources().thorns(entity), (amount / 3));
// }
}
}

@Inject(method = "hurt", at = @At("HEAD"), cancellable = true)
Expand Down

0 comments on commit d2243b4

Please sign in to comment.