Search in sources :

Example 16 with NbtList

use of net.minecraft.nbt.NbtList in project bewitchment by MoriyaShiine.

the class DemonEntity method readCustomDataFromNbt.

@Override
public void readCustomDataFromNbt(NbtCompound nbt) {
    super.readCustomDataFromNbt(nbt);
    dataTracker.set(MALE, nbt.getBoolean("Male"));
    if (nbt.contains("Offers")) {
        offers.clear();
        NbtList offersList = nbt.getList("Offers", NbtType.COMPOUND);
        for (NbtElement offerTag : offersList) {
            offers.add(new DemonTradeOffer((NbtCompound) offerTag));
        }
    }
    tradeResetTimer = nbt.getInt("TradeResetTimer");
}
Also used : NbtCompound(net.minecraft.nbt.NbtCompound) NbtList(net.minecraft.nbt.NbtList) NbtElement(net.minecraft.nbt.NbtElement)

Example 17 with NbtList

use of net.minecraft.nbt.NbtList in project bewitchment by MoriyaShiine.

the class CursesComponent method toNbtCurse.

@SuppressWarnings("ConstantConditions")
public NbtList toNbtCurse() {
    NbtList cursesList = new NbtList();
    for (Curse.Instance instance : getCurses()) {
        NbtCompound curseCompound = new NbtCompound();
        curseCompound.putString("Curse", BWRegistries.CURSES.getId(instance.curse).toString());
        curseCompound.putInt("Duration", instance.duration);
        cursesList.add(curseCompound);
    }
    return cursesList;
}
Also used : NbtCompound(net.minecraft.nbt.NbtCompound) Curse(moriyashiine.bewitchment.api.registry.Curse) NbtList(net.minecraft.nbt.NbtList)

Example 18 with NbtList

use of net.minecraft.nbt.NbtList in project EdenClient by HahaOO7.

the class ChestShopLoader method save.

public NbtList save(Object value) {
    ChestShopMap map = cast(value);
    NbtList list = new NbtList();
    map.values().stream().flatMap(Collection::stream).map(ChestShopEntry::toTag).forEach(list::add);
    return list;
}
Also used : NbtList(net.minecraft.nbt.NbtList) Collection(java.util.Collection)

Example 19 with NbtList

use of net.minecraft.nbt.NbtList in project EdenClient by HahaOO7.

the class ItemListLoader method save.

public NbtList save(Object value) {
    ItemList list = cast(value);
    NbtList tag = new NbtList();
    list.forEach(item -> tag.add(PerWorldConfig.get().toNbt(item)));
    return tag;
}
Also used : ItemList(at.haha007.edenclient.utils.config.wrappers.ItemList) NbtList(net.minecraft.nbt.NbtList)

Example 20 with NbtList

use of net.minecraft.nbt.NbtList in project EdenClient by HahaOO7.

the class BlockEntityTypeSetLoader method save.

public NbtList save(Object value) {
    BlockEntityTypeSet list = cast(value);
    NbtList nbt = new NbtList();
    for (BlockEntityType<?> item : list) {
        nbt.add(PerWorldConfig.get().toNbt(item));
    }
    return nbt;
}
Also used : BlockEntityTypeSet(at.haha007.edenclient.utils.config.wrappers.BlockEntityTypeSet) NbtList(net.minecraft.nbt.NbtList)

Aggregations

NbtList (net.minecraft.nbt.NbtList)161 NbtCompound (net.minecraft.nbt.NbtCompound)92 NbtElement (net.minecraft.nbt.NbtElement)46 Identifier (net.minecraft.util.Identifier)38 ItemStack (net.minecraft.item.ItemStack)28 NbtString (net.minecraft.nbt.NbtString)17 LiteralText (net.minecraft.text.LiteralText)12 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 Items (net.minecraft.item.Items)6 NbtIo (net.minecraft.nbt.NbtIo)6 StatusEffect (net.minecraft.entity.effect.StatusEffect)5 Text (net.minecraft.text.Text)5 ArrayList (java.util.ArrayList)4 Comparator (java.util.Comparator)4 Blocks (net.minecraft.block.Blocks)4