Rework Resistance

Now grants increased armour/toughness
(WILL NOT protect from magic or repeated assault from Wardens/Creaking)
This commit is contained in:
patience 2026-08-09 00:34:42 +01:00
parent b6a648fddf
commit 7045c2f902
No known key found for this signature in database
3 changed files with 66 additions and 0 deletions

View file

@ -0,0 +1,22 @@
package xyz.nearmisses.patience.mc_rebalance.mixin;
import net.minecraft.core.Holder;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.LivingEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(LivingEntity.class)
public abstract class EraseVanillaResistance {
@Shadow
public abstract boolean hasEffect(Holder<MobEffect> holder);
@Redirect(method="getDamageAfterMagicAbsorb", at=@At(value="INVOKE", target="Lnet/minecraft/world/entity/LivingEntity;hasEffect(Lnet/minecraft/core/Holder;)Z"))
private boolean iDenyYourResistanceAndSubstituteMyOwn(LivingEntity instance, Holder<MobEffect> holder){
if(holder==MobEffects.DAMAGE_RESISTANCE){return false;}
return this.hasEffect(holder);
}
}

View file

@ -0,0 +1,42 @@
package xyz.nearmisses.patience.mc_rebalance.mixin;
import net.minecraft.core.Holder;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
import net.minecraft.world.entity.ai.attributes.Attributes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import java.util.Objects;
@Mixin(MobEffects.class)
public class ResistanceEffectRework {
@Shadow
private static Holder<MobEffect> register(String string, MobEffect mobEffect) {
throw new UnsupportedOperationException("Implemented via mixin");
}
@Redirect(method="<clinit>", at=@At(value="INVOKE", target = "Lnet/minecraft/world/effect/MobEffects;register(Ljava/lang/String;Lnet/minecraft/world/effect/MobEffect;)Lnet/minecraft/core/Holder;"))
private static Holder<MobEffect> resistanceGrantsArmor(String string, MobEffect mobEffect){
if(Objects.equals(string, "resistance")){
return register(string, mobEffect
.addAttributeModifier(Attributes.ARMOR,
ResourceLocation.withDefaultNamespace("effect.resistance"),
2.0F,
AttributeModifier.Operation.ADD_VALUE)
.addAttributeModifier(Attributes.ARMOR_TOUGHNESS,
ResourceLocation.withDefaultNamespace("effect.resistance"),
2.0F,
AttributeModifier.Operation.ADD_VALUE
)
);
}else{
return register(string, mobEffect);
}
}
}

View file

@ -3,12 +3,14 @@
"package": "xyz.nearmisses.patience.mc_rebalance.mixin",
"compatibilityLevel": "JAVA_21",
"mixins": [
"EraseVanillaResistance",
"ExperienceOrbRework",
"GrowRateTweak",
"LingeringCooldownTweak",
"PlayerTweaks",
"PotionThrowRework",
"PotionVisualsRework",
"ResistanceEffectRework",
"SplashCooldownTweak",
"mob.BlazeAIRework",
"mob.BlazeRework",