Prevent large Object[] allocations in command list translation

This commit is contained in:
Camotoy 2022-10-30 12:28:48 -04:00
parent cc82f4b871
commit 90c9d5b9c4
No known key found for this signature in database
GPG key ID: 7EEFB66FE798081F

View file

@ -137,7 +137,7 @@ public class JavaCommandsTranslator extends PacketTranslator<ClientboundCommands
// Get and update the commandArgs list with the found arguments
if (node.getChildIndices().length >= 1) {
for (int childIndex : node.getChildIndices()) {
commandArgs.computeIfAbsent(nodeIndex, ArrayList::new).add(nodes[childIndex]);
commandArgs.computeIfAbsent(nodeIndex, ($) -> new ArrayList<>()).add(nodes[childIndex]);
}
}