Search in sources :

Example 11 with StatusEffect

use of net.minecraft.entity.effect.StatusEffect in project Client by MatHax.

the class StatusEffectListSetting method parseImpl.

@Override
protected List<StatusEffect> parseImpl(String str) {
    String[] values = str.split(",");
    List<StatusEffect> effects = new ArrayList<>(values.length);
    try {
        for (String value : values) {
            StatusEffect effect = parseId(Registry.STATUS_EFFECT, value);
            if (effect != null)
                effects.add(effect);
        }
    } catch (Exception ignored) {
    }
    return effects;
}
Also used : StatusEffect(net.minecraft.entity.effect.StatusEffect) ArrayList(java.util.ArrayList) NbtString(net.minecraft.nbt.NbtString)

Example 12 with StatusEffect

use of net.minecraft.entity.effect.StatusEffect in project Client by MatHax.

the class StatusEffectAmplifierMapSetting method save.

@Override
public NbtCompound save(NbtCompound tag) {
    NbtCompound valueTag = new NbtCompound();
    for (StatusEffect statusEffect : get().keySet()) {
        Identifier id = Registry.STATUS_EFFECT.getId(statusEffect);
        if (id != null)
            valueTag.putInt(id.toString(), get().getInt(statusEffect));
    }
    tag.put("value", valueTag);
    return tag;
}
Also used : StatusEffect(net.minecraft.entity.effect.StatusEffect) Identifier(net.minecraft.util.Identifier) NbtCompound(net.minecraft.nbt.NbtCompound)

Example 13 with StatusEffect

use of net.minecraft.entity.effect.StatusEffect in project Client by MatHax.

the class PotionTimersHud method render.

@Override
public void render(HudRenderer renderer) {
    double x = box.getX();
    double y = box.getY();
    if (isInEditor()) {
        renderer.text("Potion Timers 0:00", x, y, color);
        return;
    }
    int i = 0;
    for (StatusEffectInstance statusEffectInstance : mc.player.getStatusEffects()) {
        StatusEffect statusEffect = statusEffectInstance.getEffectType();
        int c = statusEffect.getColor();
        color.r = Color.toRGBAR(c);
        color.g = Color.toRGBAG(c);
        color.b = Color.toRGBAB(c);
        String text = getString(statusEffectInstance);
        renderer.text(text, x + box.alignX(renderer.textWidth(text)), y, color);
        color.r = color.g = color.b = 255;
        y += renderer.textHeight();
        if (i > 0)
            y += 2;
        i++;
    }
}
Also used : StatusEffect(net.minecraft.entity.effect.StatusEffect) StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance)

Example 14 with StatusEffect

use of net.minecraft.entity.effect.StatusEffect in project Client by MatHax.

the class StatusEffectAmplifierMapSettingScreen method initTable.

private void initTable() {
    List<StatusEffect> statusEffects = new ArrayList<>(setting.get().keySet());
    statusEffects.sort(Comparator.comparing(Names::get));
    for (StatusEffect statusEffect : statusEffects) {
        String name = Names.get(statusEffect);
        if (!StringUtils.containsIgnoreCase(name, filterText))
            continue;
        table.add(theme.label(name)).expandCellX();
        WIntEdit level = theme.intEdit(setting.get().getInt(statusEffect), 0, Integer.MAX_VALUE, true);
        level.action = () -> {
            setting.get().put(statusEffect, level.get());
            setting.onChanged();
        };
        table.add(level).minWidth(50);
        table.row();
    }
}
Also used : StatusEffect(net.minecraft.entity.effect.StatusEffect) WIntEdit(mathax.client.gui.widgets.input.WIntEdit) ArrayList(java.util.ArrayList)

Example 15 with StatusEffect

use of net.minecraft.entity.effect.StatusEffect in project Client by MatHax.

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(mathax.client.mixin.StatusEffectInstanceAccessor) EventHandler(mathax.client.eventbus.EventHandler)

Aggregations

StatusEffect (net.minecraft.entity.effect.StatusEffect)37 StatusEffectInstance (net.minecraft.entity.effect.StatusEffectInstance)18 Identifier (net.minecraft.util.Identifier)9 ArrayList (java.util.ArrayList)6 Sprite (net.minecraft.client.texture.Sprite)4 StatusEffectSpriteManager (net.minecraft.client.texture.StatusEffectSpriteManager)4 ItemStack (net.minecraft.item.ItemStack)4 NbtCompound (net.minecraft.nbt.NbtCompound)4 NbtList (net.minecraft.nbt.NbtList)4 ImmutableMap (com.google.common.collect.ImmutableMap)2 Map (java.util.Map)2 TextRenderer (net.minecraft.client.font.TextRenderer)2 InGameHud (net.minecraft.client.gui.hud.InGameHud)2 LivingEntity (net.minecraft.entity.LivingEntity)2 PlayerEntity (net.minecraft.entity.player.PlayerEntity)2 ArmorMaterial (net.minecraft.item.ArmorMaterial)2 NbtElement (net.minecraft.nbt.NbtElement)2 NbtString (net.minecraft.nbt.NbtString)2 ServerPlayerEntity (net.minecraft.server.network.ServerPlayerEntity)2 SettingsManager (carpet.settings.SettingsManager)1