Skip to content

Commit

Permalink
Merge pull request #965 from RealBauHD/main/4
Browse files Browse the repository at this point in the history
feat(nbt): expose size in CompoundBinaryTag
  • Loading branch information
zml2008 committed Aug 28, 2023
2 parents 9393d09 + 7f3d10c commit 5d4aef3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ public interface CompoundBinaryTag extends BinaryTag, CompoundTagSetter<Compound
*/
@Nullable BinaryTag get(final String key);

/**
* Gets the number of elements in the compound.
*
* @return the number of elements in the compound
* @since 4.15.0
*/
int size();

/**
* Gets a boolean.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ public boolean contains(final @NotNull String key, final @NotNull BinaryTagType<
return this.tags.get(key);
}

@Override
public int size() {
return this.tags.size();
}

@Override
public @NotNull CompoundBinaryTag put(final @NotNull String key, final @NotNull BinaryTag tag) {
return this.edit(map -> map.put(key, tag));
Expand Down

0 comments on commit 5d4aef3

Please sign in to comment.