Search in sources :

Example 6 with StatusEffect

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

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

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

the class StatusEffectListSetting method load.

@Override
public List<StatusEffect> load(NbtCompound tag) {
    get().clear();
    NbtList valueTag = tag.getList("value", 8);
    for (NbtElement tagI : valueTag) {
        StatusEffect effect = Registry.STATUS_EFFECT.get(new Identifier(tagI.asString()));
        if (effect != null)
            get().add(effect);
    }
    return get();
}
Also used : StatusEffect(net.minecraft.entity.effect.StatusEffect) Identifier(net.minecraft.util.Identifier) NbtList(net.minecraft.nbt.NbtList) NbtElement(net.minecraft.nbt.NbtElement)

Example 8 with StatusEffect

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

the class StatusEffectListSetting method save.

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

Example 9 with StatusEffect

use of net.minecraft.entity.effect.StatusEffect in project alaskanativecraft by Platymemo.

the class SetAkutaqEffectsLootFunction method process.

@Override
public ItemStack process(ItemStack stack, LootContext context) {
    if (stack.isOf(AlaskaItems.AKUTAQ) && !this.effects.isEmpty()) {
        for (int i = 0; i < this.amountNumberProvider.nextInt(context); i++) {
            int selectedInt = context.getRandom().nextInt(this.effects.size());
            Entry<StatusEffect, LootNumberProvider> entry = Iterables.get(this.effects.entrySet(), selectedInt);
            StatusEffect statusEffect = entry.getKey();
            int duration = entry.getValue().nextInt(context);
            if (!statusEffect.isInstant()) {
                duration *= 20;
            }
            AkutaqRecipe.addEffectToAkutaq(stack, statusEffect, duration);
        }
    }
    return stack;
}
Also used : StatusEffect(net.minecraft.entity.effect.StatusEffect) ConstantLootNumberProvider(net.minecraft.loot.provider.number.ConstantLootNumberProvider) LootNumberProvider(net.minecraft.loot.provider.number.LootNumberProvider)

Example 10 with StatusEffect

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

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)

Aggregations

StatusEffect (net.minecraft.entity.effect.StatusEffect)32 StatusEffectInstance (net.minecraft.entity.effect.StatusEffectInstance)16 Identifier (net.minecraft.util.Identifier)8 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