Class NbtFieldAccessor

java.lang.Object
net.xun.lib.common.internal.nbt.NbtFieldAccessor

@Internal public class NbtFieldAccessor extends Object
Runtime field accessor for PersistentNbt annotated fields.

Wraps reflection operations with MethodHandles for better performance and integrates with the INbtAdapter system.

  • Constructor Details

    • NbtFieldAccessor

      public NbtFieldAccessor(Field field)
  • Method Details

    • write

      public void write(Object instance, net.minecraft.nbt.CompoundTag tag)
      Writes a field's value to NBT using its configured adapter
      Parameters:
      instance - Containing object instance
      tag - Target compound tag
    • load

      public void load(Object instance, net.minecraft.nbt.CompoundTag tag)
      Reads a field's value from NBT using its configured adapter
      Parameters:
      instance - Target object to modify
      tag - Source compound tag
    • getField

      public Field getField()
    • getGetter

      public MethodHandle getGetter()
    • getSetter

      public MethodHandle getSetter()
    • getAdapter

      public INbtAdapter<Object> getAdapter()