// no default value specified, returns Optional Optional value = nbt.getInt("value"); // not OptionalInt // default value specified, returns the default value when the field does not exist int value = nbt.getInt("value", 1000);