"/data remove" always traverses the NBT path to the end
The bug
Unlike the other NBT operations that may stop traversing the NBT path early when the current parent NBTs are empty, /data remove always traverses the NBT path to the end.
Code analysis
net/minecraft/commands/arguments/NbtPathArgument.java
public static class NbtPath { ... public int remove(Tag target) { var parents = Collections.singletonList(target); for(var i = 0; i < nodes.length - 1; ++i) { parents = nodes[i].get(parents); // If `parents` is empty, we could return 0 here. } return apply(parents, nodes[nodes.length - 1]::removeTag); } ... }
2022-02-23, 01:28 AM
2022-02-23, 10:10 AM
2022-02-23, 08:03 AM
0
3
-