Search in sources :

Example 1 with StatusEffectInstanceAccessor

use of meteordevelopment.meteorclient.mixin.StatusEffectInstanceAccessor in project meteor-client by MeteorDevelopment.

the class PotionSpoof method onTick.

@EventHandler
private void onTick(TickEvent.Post event) {
    for (StatusEffect statusEffect : potions.get().keySet()) {
        int level = potions.get().getInt(statusEffect);
        if (level <= 0)
            continue;
        if (mc.player.hasStatusEffect(statusEffect)) {
            StatusEffectInstance instance = mc.player.getStatusEffect(statusEffect);
            ((StatusEffectInstanceAccessor) instance).setAmplifier(level - 1);
            if (instance.getDuration() < 20)
                ((StatusEffectInstanceAccessor) instance).setDuration(20);
        } else {
            mc.player.addStatusEffect(new StatusEffectInstance(statusEffect, 20, level - 1));
        }
    }
}
Also used : StatusEffect(net.minecraft.entity.effect.StatusEffect) StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance) StatusEffectInstanceAccessor(meteordevelopment.meteorclient.mixin.StatusEffectInstanceAccessor) EventHandler(meteordevelopment.orbit.EventHandler)

Example 2 with StatusEffectInstanceAccessor

use of meteordevelopment.meteorclient.mixin.StatusEffectInstanceAccessor in project meteor-client by MeteorDevelopment.

the class SpeedMine method onTick.

@EventHandler
private void onTick(TickEvent.Post event) {
    if (mode.get() == Mode.Normal)
        return;
    int amplifier = mode.get() == Mode.Haste2 ? 1 : 0;
    if (!mc.player.hasStatusEffect(HASTE)) {
        mc.player.addStatusEffect(new StatusEffectInstance(HASTE, 255, amplifier, false, false, false));
    }
    StatusEffectInstance effect = mc.player.getStatusEffect(HASTE);
    ((StatusEffectInstanceAccessor) effect).setAmplifier(amplifier);
    if (effect.getDuration() < 20)
        ((StatusEffectInstanceAccessor) effect).setDuration(20);
}
Also used : StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance) StatusEffectInstanceAccessor(meteordevelopment.meteorclient.mixin.StatusEffectInstanceAccessor) EventHandler(meteordevelopment.orbit.EventHandler)

Aggregations

StatusEffectInstanceAccessor (meteordevelopment.meteorclient.mixin.StatusEffectInstanceAccessor)2 EventHandler (meteordevelopment.orbit.EventHandler)2 StatusEffectInstance (net.minecraft.entity.effect.StatusEffectInstance)2 StatusEffect (net.minecraft.entity.effect.StatusEffect)1