Skip to content

Commit

Permalink
fix: immutable map ref
Browse files Browse the repository at this point in the history
  • Loading branch information
mworzala committed Jul 25, 2024
1 parent 1208975 commit 4f55e41
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,11 @@ public ListType getListUnchecked(final String key, final ListType dfl) {
final Object tag = this.map.get(key);
if (tag instanceof NBTListType l)
return l;
if (tag instanceof ListBinaryTag)
return new NBTListType((ListBinaryTag) tag);
if (tag instanceof ListBinaryTag) {
var map = new NBTListType((ListBinaryTag) tag);
this.map.put(key, map);
return map;
}
return dfl;
}

Expand All @@ -439,8 +442,11 @@ public MapType<String> getMap(final String key, final MapType dfl) {
final Object tag = this.map.get(key);
if (tag instanceof NBTMapType m)
return m;
if (tag instanceof CompoundBinaryTag)
return new NBTMapType((CompoundBinaryTag) tag);
if (tag instanceof CompoundBinaryTag) {
var map = new NBTMapType((CompoundBinaryTag) tag);
this.map.put(key, map);
return map;
}
return dfl;
}

Expand Down

0 comments on commit 4f55e41

Please sign in to comment.