Search in sources :

Example 61 with NbtList

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

the class StorageBlockListSetting method load.

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

Example 62 with NbtList

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

the class StringListSetting method load.

@Override
public List<String> load(NbtCompound tag) {
    get().clear();
    NbtList valueTag = tag.getList("value", 8);
    for (NbtElement tagI : valueTag) {
        get().add(tagI.asString());
    }
    return get();
}
Also used : NbtList(net.minecraft.nbt.NbtList) NbtElement(net.minecraft.nbt.NbtElement)

Example 63 with NbtList

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

the class ItemListSetting method save.

@Override
public NbtCompound save(NbtCompound tag) {
    NbtList valueTag = new NbtList();
    for (Item item : get()) {
        if (bypassFilterWhenSavingAndLoading || (filter == null || filter.test(item)))
            valueTag.add(NbtString.of(Registry.ITEM.getId(item).toString()));
    }
    tag.put("value", valueTag);
    return tag;
}
Also used : Item(net.minecraft.item.Item) NbtList(net.minecraft.nbt.NbtList)

Example 64 with NbtList

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

the class ItemListSetting method load.

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

Example 65 with NbtList

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

the class ModuleListSetting method save.

@Override
public NbtCompound save(NbtCompound tag) {
    NbtList modulesTag = new NbtList();
    for (Module module : get()) modulesTag.add(NbtString.of(module.name));
    tag.put("modules", modulesTag);
    return tag;
}
Also used : NbtList(net.minecraft.nbt.NbtList) Module(mathax.client.systems.modules.Module)

Aggregations

NbtList (net.minecraft.nbt.NbtList)171 NbtCompound (net.minecraft.nbt.NbtCompound)100 NbtElement (net.minecraft.nbt.NbtElement)48 Identifier (net.minecraft.util.Identifier)39 ItemStack (net.minecraft.item.ItemStack)30 NbtString (net.minecraft.nbt.NbtString)18 LiteralText (net.minecraft.text.LiteralText)13 BlockPos (net.minecraft.util.math.BlockPos)11 Block (net.minecraft.block.Block)9 IOException (java.io.IOException)8 List (java.util.List)8 Item (net.minecraft.item.Item)7 Inject (org.spongepowered.asm.mixin.injection.Inject)7 ArrayList (java.util.ArrayList)6 Items (net.minecraft.item.Items)6 NbtIo (net.minecraft.nbt.NbtIo)6 Text (net.minecraft.text.Text)5 Comparator (java.util.Comparator)4 Blocks (net.minecraft.block.Blocks)4 EntityType (net.minecraft.entity.EntityType)4