fix: reset knocked state when activating Totem of Undying
This commit is contained in:
parent
4968a7ca7f
commit
a3471e7a39
2 changed files with 13 additions and 1 deletions
|
@ -2,8 +2,12 @@ package ru.octol1ttle.knockdowns.common.mixin;
|
||||||
|
|
||||||
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
import net.minecraft.entity.damage.DamageSource;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
import ru.octol1ttle.knockdowns.common.KnockdownsUtils;
|
||||||
import ru.octol1ttle.knockdowns.common.api.IKnockableDown;
|
import ru.octol1ttle.knockdowns.common.api.IKnockableDown;
|
||||||
|
|
||||||
@Mixin(LivingEntity.class)
|
@Mixin(LivingEntity.class)
|
||||||
|
@ -12,4 +16,12 @@ public abstract class LivingEntityMixin {
|
||||||
private boolean dontTargetKnockedPlayers(boolean original, LivingEntity target) {
|
private boolean dontTargetKnockedPlayers(boolean original, LivingEntity target) {
|
||||||
return original && !(target instanceof IKnockableDown knockable && knockable.is_KnockedDown());
|
return original && !(target instanceof IKnockableDown knockable && knockable.is_KnockedDown());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject(method = "tryUseTotem", at = @At("RETURN"))
|
||||||
|
private void resetKnockedDownOnTotemUse(DamageSource source, CallbackInfoReturnable<Boolean> cir) {
|
||||||
|
LivingEntity $this = (LivingEntity) (Object) this;
|
||||||
|
if (cir.getReturnValue() && $this instanceof IKnockableDown knockable && knockable.is_KnockedDown()) {
|
||||||
|
KnockdownsUtils.resetKnockedState(knockable);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ minecraft_version=1.20.1
|
||||||
enabled_platforms=fabric,forge
|
enabled_platforms=fabric,forge
|
||||||
|
|
||||||
archives_base_name=knockdowns
|
archives_base_name=knockdowns
|
||||||
mod_version=2.2.0
|
mod_version=2.2.1
|
||||||
maven_group=ru.octol1ttle.knockdowns
|
maven_group=ru.octol1ttle.knockdowns
|
||||||
|
|
||||||
architectury_version=9.1.12
|
architectury_version=9.1.12
|
||||||
|
|
Loading…
Reference in a new issue