Search in sources :

Example 26 with NbtList

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

the class Marker method toTag.

@Override
public NbtCompound toTag() {
    NbtCompound tag = super.toTag();
    NbtList list = new NbtList();
    for (BaseMarker marker : markers) {
        NbtCompound mTag = new NbtCompound();
        mTag.putString("type", marker.getTypeName());
        mTag.put("marker", marker.toTag());
        list.add(mTag);
    }
    tag.put("markers", list);
    return tag;
}
Also used : NbtCompound(net.minecraft.nbt.NbtCompound) NbtList(net.minecraft.nbt.NbtList)

Example 27 with NbtList

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

the class Marker method fromTag.

@Override
public Module fromTag(NbtCompound tag) {
    super.fromTag(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 NbtList

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

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 29 with NbtList

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

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(meteordevelopment.meteorclient.systems.modules.Module)

Example 30 with NbtList

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

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(meteordevelopment.meteorclient.systems.modules.Module)

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