Class NBTPathAccessor

java.lang.Object
com.gtnewhorizons.horizonqa.api.NBTPathAccessor

public final class NBTPathAccessor extends Object
Traverses NBTTagCompound structures using dotted-path notation.

Paths are dot-separated keys; numeric segments index into NBTTagList entries. Escape a literal dot in a key with \\..

Examples:

  • "mInventory.0.id" — first element of the "mInventory" list, then its "id" tag
  • "CustomName" — top-level string tag
  • "ForgeCaps.mymod:cap\\.subkey" key containing a literal dot
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    exists(net.minecraft.nbt.NBTTagCompound root, String path)
    Check whether a path exists in the given compound.
    static net.minecraft.nbt.NBTBase
    resolve(net.minecraft.nbt.NBTTagCompound root, String path)
    Resolve a dotted path against a root compound, returning the terminal NBTBase or null if any segment is missing.
    static String
    resolveAsString(net.minecraft.nbt.NBTTagCompound root, String path)
    Resolve a dotted path and return the tag's SNBT serialization, or null if missing.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • resolve

      public static net.minecraft.nbt.NBTBase resolve(net.minecraft.nbt.NBTTagCompound root, String path)
      Resolve a dotted path against a root compound, returning the terminal NBTBase or null if any segment is missing.
    • resolveAsString

      public static String resolveAsString(net.minecraft.nbt.NBTTagCompound root, String path)
      Resolve a dotted path and return the tag's SNBT serialization, or null if missing. Format is type-specific: strings quoted ("\"foo\""), longs suffixed ("5L"), ints bare.
    • exists

      public static boolean exists(net.minecraft.nbt.NBTTagCompound root, String path)
      Check whether a path exists in the given compound.