Skip to content

Commit

Permalink
Fix client disconnect when opening large chests
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensworks committed Nov 22, 2024
1 parent 1f73c4b commit d6af405
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ protected int getTagSize(Tag tag) {
CompoundTag compound = (CompoundTag) tag;
int size = 0;
for (String key : compound.getAllKeys()) {
try {
size += key.getBytes("UTF-8").length;
} catch (UnsupportedEncodingException e) {}
size += getTagSize(compound.get(key));
}
return size;
Expand All @@ -228,7 +231,7 @@ protected int getTagSize(Tag tag) {
}
if (tag instanceof StringTag) {
try {
return ((StringTag) tag).getAsString().getBytes("UTF-8").length;
return ((StringTag) tag).getAsString().getBytes("UTF-8").length + 1;
} catch (UnsupportedEncodingException e) {}
}
return tag.toString().length();
Expand Down

0 comments on commit d6af405

Please sign in to comment.