Search in sources :

Example 71 with NbtList

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

the class SettingGroup method toTag.

@Override
public NbtCompound toTag() {
    NbtCompound tag = new NbtCompound();
    tag.putString("name", name);
    tag.putBoolean("sectionExpanded", sectionExpanded);
    NbtList settingsTag = new NbtList();
    for (Setting<?> setting : this) if (setting.wasChanged())
        settingsTag.add(setting.toTag());
    tag.put("settings", settingsTag);
    return tag;
}
Also used : NbtCompound(net.minecraft.nbt.NbtCompound) NbtList(net.minecraft.nbt.NbtList)

Example 72 with NbtList

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

the class Settings method fromTag.

@Override
public Settings fromTag(NbtCompound tag) {
    NbtList groupsTag = tag.getList("groups", 10);
    for (NbtElement t : groupsTag) {
        NbtCompound groupTag = (NbtCompound) t;
        SettingGroup sg = getGroup(groupTag.getString("name"));
        if (sg != null)
            sg.fromTag(groupTag);
    }
    return this;
}
Also used : NbtCompound(net.minecraft.nbt.NbtCompound) NbtList(net.minecraft.nbt.NbtList) NbtElement(net.minecraft.nbt.NbtElement)

Example 73 with NbtList

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

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

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

the class Marker method fromTag.

@Override
public Module fromTag(NbtCompound 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 75 with NbtList

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

the class Profile method fromTag.

@Override
public Profile fromTag(NbtCompound tag) {
    name = tag.getString("name");
    accounts = tag.contains("accounts") && tag.getBoolean("accounts");
    config = tag.contains("config") && tag.getBoolean("config");
    friends = tag.contains("friends") && tag.getBoolean("friends");
    macros = tag.contains("macros") && tag.getBoolean("macros");
    modules = tag.contains("modules") && tag.getBoolean("modules");
    waypoints = tag.contains("waypoints") && tag.getBoolean("waypoints");
    hud = tag.contains("hud") && tag.getBoolean("hud");
    onLaunch = tag.contains("onLaunch") && tag.getBoolean("onLaunch");
    saveOnLeave = tag.contains("saveOnLeave") && tag.getBoolean("saveOnLeave");
    saveOnInterval = tag.contains("saveOnInterval") && tag.getBoolean("saveOnInterval");
    saveInterval = tag.contains("saveInterval") ? tag.getInt("saveInterval") : 60;
    loadOnJoinIps.clear();
    if (tag.contains("loadOnJoinIps")) {
        NbtList ipsTag = tag.getList("loadOnJoinIps", 8);
        for (NbtElement ip : ipsTag) loadOnJoinIps.add(ip.asString());
    }
    return this;
}
Also used : 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