Search in sources :

Example 26 with NbtElement

use of net.minecraft.nbt.NbtElement in project Client by MatHax.

the class Settings method fromTag.

@Override
public Settings fromTag(NbtCompound tag) {
    NbtList groupsTag = tag.getList("groups", 10);
    for (NbtElement t : groupsTag) {
        NbtCompound groupTag = (NbtCompound) t;
        SettingGroup sg = getGroup(groupTag.getString("name"));
        if (sg != null)
            sg.fromTag(groupTag);
    }
    return this;
}
Also used : NbtCompound(net.minecraft.nbt.NbtCompound) NbtList(net.minecraft.nbt.NbtList) NbtElement(net.minecraft.nbt.NbtElement)

Example 27 with NbtElement

use of net.minecraft.nbt.NbtElement in project Client by MatHax.

the class Marker method fromTag.

@Override
public Module fromTag(NbtCompound tag) {
    markers.clear();
    NbtList list = tag.getList("markers", 10);
    for (NbtElement tagII : list) {
        NbtCompound tagI = (NbtCompound) tagII;
        String type = tagI.getString("type");
        BaseMarker marker = factory.createMarker(type);
        if (marker != null) {
            NbtCompound markerTag = (NbtCompound) tagI.get("marker");
            if (markerTag != null)
                marker.fromTag(markerTag);
            markers.add(marker);
        }
    }
    return this;
}
Also used : NbtCompound(net.minecraft.nbt.NbtCompound) NbtList(net.minecraft.nbt.NbtList) NbtElement(net.minecraft.nbt.NbtElement)

Example 28 with NbtElement

use of net.minecraft.nbt.NbtElement in project Client by MatHax.

the class Profile method fromTag.

@Override
public Profile fromTag(NbtCompound tag) {
    name = tag.getString("name");
    accounts = tag.contains("accounts") && tag.getBoolean("accounts");
    config = tag.contains("config") && tag.getBoolean("config");
    friends = tag.contains("friends") && tag.getBoolean("friends");
    macros = tag.contains("macros") && tag.getBoolean("macros");
    modules = tag.contains("modules") && tag.getBoolean("modules");
    waypoints = tag.contains("waypoints") && tag.getBoolean("waypoints");
    hud = tag.contains("hud") && tag.getBoolean("hud");
    onLaunch = tag.contains("onLaunch") && tag.getBoolean("onLaunch");
    saveOnLeave = tag.contains("saveOnLeave") && tag.getBoolean("saveOnLeave");
    saveOnInterval = tag.contains("saveOnInterval") && tag.getBoolean("saveOnInterval");
    saveInterval = tag.contains("saveInterval") ? tag.getInt("saveInterval") : 60;
    loadOnJoinIps.clear();
    if (tag.contains("loadOnJoinIps")) {
        NbtList ipsTag = tag.getList("loadOnJoinIps", 8);
        for (NbtElement ip : ipsTag) loadOnJoinIps.add(ip.asString());
    }
    return this;
}
Also used : NbtList(net.minecraft.nbt.NbtList) NbtElement(net.minecraft.nbt.NbtElement)

Example 29 with NbtElement

use of net.minecraft.nbt.NbtElement in project KiwiClient by TangyKiwi.

the class Utils method removeEnchantment.

public static void removeEnchantment(ItemStack itemStack, Enchantment enchantment) {
    NbtCompound nbt = itemStack.getNbt();
    if (nbt == null)
        return;
    if (!nbt.contains("Enchantments", 9))
        return;
    NbtList list = nbt.getList("Enchantments", 10);
    String enchId = Registry.ENCHANTMENT.getId(enchantment).toString();
    for (Iterator<NbtElement> it = list.iterator(); it.hasNext(); ) {
        NbtCompound ench = (NbtCompound) it.next();
        if (ench.getString("id").equals(enchId)) {
            it.remove();
            break;
        }
    }
}
Also used : NbtCompound(net.minecraft.nbt.NbtCompound) NbtList(net.minecraft.nbt.NbtList) NbtElement(net.minecraft.nbt.NbtElement)

Example 30 with NbtElement

use of net.minecraft.nbt.NbtElement in project meteor-client by MeteorDevelopment.

the class SoundEventListSetting method load.

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

Aggregations

NbtElement (net.minecraft.nbt.NbtElement)51 NbtList (net.minecraft.nbt.NbtList)44 NbtCompound (net.minecraft.nbt.NbtCompound)22 Identifier (net.minecraft.util.Identifier)20 ItemStack (net.minecraft.item.ItemStack)6 Field (java.lang.reflect.Field)2 Block (net.minecraft.block.Block)2 Enchantment (net.minecraft.enchantment.Enchantment)2 StatusEffect (net.minecraft.entity.effect.StatusEffect)2 Item (net.minecraft.item.Item)2 SoundEvent (net.minecraft.sound.SoundEvent)2 DyeColor (net.minecraft.util.DyeColor)2 RecipePair (top.theillusivec4.polymorph.api.common.base.RecipePair)2 RecipePairImpl (top.theillusivec4.polymorph.common.impl.RecipePairImpl)2 ArrayList (java.util.ArrayList)1 Comparator (java.util.Comparator)1 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 Module (mathax.client.systems.modules.Module)1 Module (meteordevelopment.meteorclient.systems.modules.Module)1