Move traversePathWrite call

Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
TheMode 2022-07-29 19:30:09 +02:00
parent 0e082634d5
commit 92b11eabbd

View File

@ -100,8 +100,8 @@ final class TagHandlerImpl implements TagHandler {
} }
private synchronized <T> T updateTag0(@NotNull Tag<T> tag, @NotNull UnaryOperator<T> value, boolean returnPrevious) { private synchronized <T> T updateTag0(@NotNull Tag<T> tag, @NotNull UnaryOperator<T> value, boolean returnPrevious) {
final Node node = traversePathWrite(root, tag, true);
if (tag.isView()) { if (tag.isView()) {
Node node = traversePathWrite(root, tag, true);
final T previousValue = tag.read(node.compound()); final T previousValue = tag.read(node.compound());
final T newValue = value.apply(previousValue); final T newValue = value.apply(previousValue);
node.updateContent((NBTCompoundLike) tag.entry.write(newValue)); node.updateContent((NBTCompoundLike) tag.entry.write(newValue));
@ -110,7 +110,6 @@ final class TagHandlerImpl implements TagHandler {
} }
final int tagIndex = tag.index; final int tagIndex = tag.index;
final Node node = traversePathWrite(root, tag, true);
StaticIntMap<Entry<?>> entries = node.entries; StaticIntMap<Entry<?>> entries = node.entries;
final Entry previousEntry = entries.get(tagIndex); final Entry previousEntry = entries.get(tagIndex);