Closed domanhthang2110 closed 3 years ago
That is a horrific config, but I'll do a test in a bit to see if I can reproduce the bug and figure out what's wrong
I just tested some more and it has something to do with the max damage blocked setting, when i set to 10 the bug cause me to take 10 dmg, and the config above is 100 so basically insta-kill This video is an example when setting that to 20 dmg
I think I fixed it XD, all I do is adding a check in the damage calculation part whether if the returned damage is >= 0 or not to prevent negative value. Not sure though, try doing it on your side
@ModifyVariable(method = "damage", at = @At(value = "INVOKE",
target = "Lnet/minecraft/entity/damage/DamageSource;isProjectile()Z"
), ordinal = 0)
public float modifyShieldDamageProtection(float amount, DamageSource source) {
if((damageAmount - CombatTweaks.getConfig().shields.maxDamageBlocked) < 0)
return 0;
else
return damageAmount - CombatTweaks.getConfig().shields.maxDamageBlocked;
}
Actually, that's partly the problem (same could be achieved like this):
@ModifyVariable(method = "damage", at = @At(value = "INVOKE",
target = "Lnet/minecraft/entity/damage/DamageSource;isProjectile()Z"
), ordinal = 0)
public float modifyShieldDamageProtection(float amount, DamageSource source) {
return Math.max(0, damageAmount - CombatTweaks.getConfig().shields.maxDamageBlocked);
}
But there's another problem: the shield maxes out at a 180 degree arc because I'm dumb and bad at math, but I know how to fix it, so it'll be fixed sometime in the next release
When blocking with shield, especially with many mobs attacking you. Sometimes a mob will hit from the side and for whatever reason it insta-kill the player no matter the HP This is my shield config (I messed with it a bit to see if it fix the problem but it doesn't)