-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ash (Bagel)
committed
Dec 28, 2024
1 parent
e3a887a
commit e318a62
Showing
2 changed files
with
27 additions
and
38 deletions.
There are no files selected for viewing
41 changes: 17 additions & 24 deletions
41
src/main/java/dev/shadowsoffire/attributeslib/mixin/CombatRulesMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,25 @@ | ||
package dev.shadowsoffire.attributeslib.mixin; | ||
|
||
import dev.shadowsoffire.attributeslib.AttributesLib; | ||
import dev.shadowsoffire.attributeslib.api.ALCombatRules; | ||
import net.minecraft.world.damagesource.CombatRules; | ||
import net.minecraft.world.damagesource.DamageSource; | ||
import net.minecraft.world.entity.LivingEntity; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(value = CombatRules.class, priority = 1500) | ||
public class CombatRulesMixin { | ||
//TODO This is bad! Do not do this! | ||
/** | ||
* @see ALCombatRules#getDamageAfterProtection(net.minecraft.world.entity.LivingEntity, net.minecraft.world.damagesource.DamageSource, float, float) | ||
*/ | ||
@Inject(method ="getDamageAfterMagicAbsorb", at = @At("HEAD"), cancellable = true) | ||
private static void zenith_attributes$getDamageAfterMagicAbsorb(float damage, float protPoints, CallbackInfoReturnable<Float> cir) { | ||
cir.setReturnValue(damage * ALCombatRules.getProtDamageReduction(protPoints)); | ||
} | ||
|
||
/** | ||
* @see ALCombatRules#getDamageAfterArmor(LivingEntity, DamageSource, float, float, float) | ||
*/ | ||
@Inject(method ="getDamageAfterAbsorb", at = @At("HEAD"), cancellable = true) | ||
private static void zenith_attributes$getDamageAfterAbsorb(float damage, float totalArmor, float toughnessAttribute, CallbackInfoReturnable<Float> cir) { | ||
AttributesLib.LOGGER.trace("Invocation of CombatRules#getDamageAfterAbsorb is bypassing armor pen."); | ||
cir.setReturnValue(damage * ALCombatRules.getArmorDamageReduction(damage, totalArmor, toughnessAttribute)); | ||
} | ||
//TODO Update/redo combat changes | ||
// /** | ||
// * @see ALCombatRules#getDamageAfterProtection(net.minecraft.world.entity.LivingEntity, net.minecraft.world.damagesource.DamageSource, float, float) | ||
// */ | ||
// @Inject(method ="getDamageAfterMagicAbsorb", at = @At("HEAD"), cancellable = true) | ||
// private static void zenith_attributes$getDamageAfterMagicAbsorb(float damage, float protPoints, CallbackInfoReturnable<Float> cir) { | ||
// cir.setReturnValue(damage * ALCombatRules.getProtDamageReduction(protPoints)); | ||
// } | ||
// | ||
// /** | ||
// * @see ALCombatRules#getDamageAfterArmor(LivingEntity, DamageSource, float, float, float) | ||
// */ | ||
// @Inject(method ="getDamageAfterAbsorb", at = @At("HEAD"), cancellable = true) | ||
// private static void zenith_attributes$getDamageAfterAbsorb(float damage, float totalArmor, float toughnessAttribute, CallbackInfoReturnable<Float> cir) { | ||
// AttributesLib.LOGGER.trace("Invocation of CombatRules#getDamageAfterAbsorb is bypassing armor pen."); | ||
// cir.setReturnValue(damage * ALCombatRules.getArmorDamageReduction(damage, totalArmor, toughnessAttribute)); | ||
// } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters