NBT 경로


When working with complex NBT tags, you can quickly require complex operator chains for reading deeply nested NBT values. In order to simplify this task, String-based NBT Path expressions can be used to determine the path within an NBT tag.

The simplest NBT Path expression is made up of a chain of field selectors, such as .fieldName or [”fieldName”].

For example, applying the expression ”.root.child1.child2” on the NBT tag { root: { child1: { child2: ”some value” }}} will output ”some value”.

필드 이름 배열 또는 와일드카드를 제공하여 여러 필드를 선택할 수 있습니다(예: [fieldA,fieldB] 또는 *).

For example, applying the expression ”.a[b1,b2]*” on the NBT tag { a: { b1: { c: ”some value” }}} will output ”some value”.

NBT 목록으로 작업할 때 [1]과 같은 인덱스를 지정하여 특정 항목을 선택할 수 있습니다.

예를 들어 ”.a[1]” 표현식을 NBT 태그 { a: [10,20] }에 적용하면 ”20”이 출력됩니다.

슬라이스 연산자 [start:end:step]을 사용하여 여러 목록 인덱스를 선택할 수 있습니다. (시작만 필요하고 다른 요소는 생략 가능)

예를 들어 ”.a[1:4:2]” 표현식을 NBT 태그 { a: [0,1,2,3,4,5] }에 적용하면 [1,3]이 출력됩니다. .

[?(@.childName < 10)](@은 현재 태그, ..는 상위 태그, $는 루트 태그를 나타냄)와 같은 필터 구문을 사용하여 고급 필터 표현식을 사용할 수도 있습니다.

예를 들어 ”$.a[?(@ == 3)]” 표현식을 NBT 태그 { a: [0,1,2,3,4,5] }에 적용하면 [3 ].

Expressions can be combined using ”§§” (and), ”||” (or), and ”!” (not).

For example, applying the expression ”$.a[?(@ == 3 || (@ == 5))]” on the NBT tag { a: [0,1,2,3,4,5] } will output [3,5].

연산자
첫번째로 일치하는 NBT 경로NBT.path_match_first주어진 NBT 값에 주어진 NBT 경로 표현식을 적용하고 첫번째로 일치하는 것을 반환합니다.
  • String
  • NBT
  • NBT
Global name: stringNbtPathMatchFirst(StringNBT) → NBTMethod name: String.nbtPathMatchFirst(NBT) → NBT
연산자
모든 일치하는 NBT 경로NBT.path_match_all주어진 NBT 값에 주어진 NBT 경로 표현식을 적용하고 일치하는 모든 것을 리스트로 반환합니다.
  • String
  • NBT
  • List
Global name: stringNbtPathMatchAll(StringNBT) → ListMethod name: String.nbtPathMatchAll(NBT) → List
연산자
NBT 경로 테스트NBT.path_test주어진 NBT 경로 표현식이 주어진 NBT 값과 일치하는지 테스트합니다.
  • String
  • NBT
  • Boolean
Global name: stringNbtPathTest(StringNBT) → BooleanMethod name: String.nbtPathTest(NBT) → Boolean