Search in sources :

Example 41 with NbtElement

use of net.minecraft.nbt.NbtElement in project UniversalGraves by Patbox.

the class GraveManager method fromNbt.

public static PersistentState fromNbt(NbtCompound nbt) {
    GraveManager manager = new GraveManager();
    NbtList graves = nbt.getList("Graves", NbtElement.COMPOUND_TYPE);
    for (NbtElement graveNbt : graves) {
        GraveInfo graveInfo = new GraveInfo();
        graveInfo.readNbt((NbtCompound) graveNbt);
        if (!graveInfo.shouldBreak()) {
            manager.add(graveInfo);
        }
    }
    return manager;
}
Also used : NbtList(net.minecraft.nbt.NbtList) NbtElement(net.minecraft.nbt.NbtElement)

Example 42 with NbtElement

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

the class SettingGroup method fromTag.

@Override
public SettingGroup fromTag(NbtCompound tag) {
    sectionExpanded = tag.getBoolean("sectionExpanded");
    NbtList settingsTag = tag.getList("settings", 10);
    for (NbtElement t : settingsTag) {
        NbtCompound settingTag = (NbtCompound) t;
        Setting<?> setting = get(settingTag.getString("name"));
        if (setting != null)
            setting.fromTag(settingTag);
    }
    return this;
}
Also used : NbtCompound(net.minecraft.nbt.NbtCompound) NbtList(net.minecraft.nbt.NbtList) NbtElement(net.minecraft.nbt.NbtElement)

Example 43 with NbtElement

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

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)

Example 44 with NbtElement

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

the class BlockListSetting method load.

@Override
protected List<Block> load(NbtCompound tag) {
    get().clear();
    NbtList valueTag = tag.getList("value", 8);
    for (NbtElement tagI : valueTag) {
        Block block = Registry.BLOCK.get(new Identifier(tagI.asString()));
        if (filter == null || filter.test(block))
            get().add(block);
    }
    return get();
}
Also used : Identifier(net.minecraft.util.Identifier) NbtList(net.minecraft.nbt.NbtList) Block(net.minecraft.block.Block) NbtElement(net.minecraft.nbt.NbtElement)

Example 45 with NbtElement

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

the class ModuleListSetting method load.

@Override
public List<Module> load(NbtCompound tag) {
    get().clear();
    NbtList valueTag = tag.getList("modules", 8);
    for (NbtElement tagI : valueTag) {
        Module module = Modules.get().get(tagI.asString());
        if (module != null)
            get().add(module);
    }
    return get();
}
Also used : NbtList(net.minecraft.nbt.NbtList) NbtElement(net.minecraft.nbt.NbtElement) Module(mathax.client.systems.modules.Module)

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