Search in sources :

Example 21 with StatusEffect

use of net.minecraft.entity.effect.StatusEffect in project meteor-client by MeteorDevelopment.

the class StatusEffectAmplifierMapSetting method load.

@Override
public Object2IntMap<StatusEffect> load(NbtCompound tag) {
    get().clear();
    NbtCompound valueTag = tag.getCompound("value");
    for (String key : valueTag.getKeys()) {
        StatusEffect statusEffect = Registry.STATUS_EFFECT.get(new Identifier(key));
        if (statusEffect != null)
            get().put(statusEffect, valueTag.getInt(key));
    }
    return get();
}
Also used : StatusEffect(net.minecraft.entity.effect.StatusEffect) Identifier(net.minecraft.util.Identifier) NbtCompound(net.minecraft.nbt.NbtCompound)

Example 22 with StatusEffect

use of net.minecraft.entity.effect.StatusEffect in project meteor-client by MeteorDevelopment.

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 23 with StatusEffect

use of net.minecraft.entity.effect.StatusEffect in project meteor-client by MeteorDevelopment.

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(meteordevelopment.meteorclient.gui.widgets.input.WIntEdit) ArrayList(java.util.ArrayList)

Example 24 with StatusEffect

use of net.minecraft.entity.effect.StatusEffect in project meteor-client by MeteorDevelopment.

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 25 with StatusEffect

use of net.minecraft.entity.effect.StatusEffect in project meteor-client by MeteorDevelopment.

the class Quiver method onActivate.

@Override
public void onActivate() {
    FindItemResult bow = InvUtils.findInHotbar(Items.BOW);
    if (!bow.isHotbar()) {
        error("No bow found... disabling.");
        toggle();
    }
    mc.options.useKey.setPressed(false);
    mc.interactionManager.stopUsingItem(mc.player);
    InvUtils.swap(bow.slot(), true);
    arrowSlots.clear();
    List<StatusEffect> usedEffects = new ArrayList<>();
    for (int i = mc.player.getInventory().size(); i > 0; i--) {
        if (i == mc.player.getInventory().selectedSlot)
            continue;
        ItemStack item = mc.player.getInventory().getStack(i);
        if (item.getItem() != Items.TIPPED_ARROW)
            continue;
        List<StatusEffectInstance> effects = PotionUtil.getPotionEffects(item);
        if (effects.isEmpty())
            continue;
        StatusEffect effect = effects.get(0).getEffectType();
        if (this.effects.get().contains(effect) && !usedEffects.contains(effect) && (!hasEffect(effect) || !checkEffects.get())) {
            usedEffects.add(effect);
            arrowSlots.add(i);
        }
    }
}
Also used : StatusEffect(net.minecraft.entity.effect.StatusEffect) StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance) FindItemResult(meteordevelopment.meteorclient.utils.player.FindItemResult) ArrayList(java.util.ArrayList) ItemStack(net.minecraft.item.ItemStack)

Aggregations

StatusEffect (net.minecraft.entity.effect.StatusEffect)33 StatusEffectInstance (net.minecraft.entity.effect.StatusEffectInstance)17 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 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 NbtElement (net.minecraft.nbt.NbtElement)2 NbtString (net.minecraft.nbt.NbtString)2 ServerPlayerEntity (net.minecraft.server.network.ServerPlayerEntity)2 SettingsManager (carpet.settings.SettingsManager)1 TeaType (com.hugman.culinaire.objects.item.tea.TeaType)1 CommandDispatcher (com.mojang.brigadier.CommandDispatcher)1 LiteralArgumentBuilder (com.mojang.brigadier.builder.LiteralArgumentBuilder)1