Search in sources :

Example 31 with NbtList

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

the class PacketListSetting method save.

@Override
public NbtCompound save(NbtCompound tag) {
    NbtList valueTag = new NbtList();
    for (Class<? extends Packet<?>> packet : get()) {
        valueTag.add(NbtString.of(PacketUtils.getName(packet)));
    }
    tag.put("value", valueTag);
    return tag;
}
Also used : NbtList(net.minecraft.nbt.NbtList)

Example 32 with NbtList

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

the class PacketListSetting method load.

@Override
public Set<Class<? extends Packet<?>>> load(NbtCompound tag) {
    get().clear();
    NbtElement valueTag = tag.get("value");
    if (valueTag instanceof NbtList) {
        for (NbtElement t : (NbtList) valueTag) {
            Class<? extends Packet<?>> packet = PacketUtils.getPacket(t.asString());
            if (packet != null && (filter == null || filter.test(packet)))
                get().add(packet);
        }
    }
    return get();
}
Also used : NbtList(net.minecraft.nbt.NbtList) NbtElement(net.minecraft.nbt.NbtElement)

Example 33 with NbtList

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

the class EnchantmentListSetting method save.

@Override
public NbtCompound save(NbtCompound tag) {
    NbtList valueTag = new NbtList();
    for (Enchantment ench : get()) {
        Identifier id = Registry.ENCHANTMENT.getId(ench);
        if (id != null)
            valueTag.add(NbtString.of(id.toString()));
    }
    tag.put("value", valueTag);
    return tag;
}
Also used : Identifier(net.minecraft.util.Identifier) NbtList(net.minecraft.nbt.NbtList) Enchantment(net.minecraft.enchantment.Enchantment)

Example 34 with NbtList

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

the class EnchantmentListSetting method load.

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

Example 35 with NbtList

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

the class EntityTypeListSetting method load.

@Override
public Object2BooleanMap<EntityType<?>> load(NbtCompound tag) {
    get().clear();
    NbtList valueTag = tag.getList("value", 8);
    for (NbtElement tagI : valueTag) {
        EntityType<?> type = Registry.ENTITY_TYPE.get(new Identifier(tagI.asString()));
        if (!onlyAttackable || EntityUtils.isAttackable(type))
            get().put(type, true);
    }
    return get();
}
Also used : Identifier(net.minecraft.util.Identifier) NbtList(net.minecraft.nbt.NbtList) NbtElement(net.minecraft.nbt.NbtElement)

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