Skip to content

Commit

Permalink
NBTApi - don't create a new compound when another tag of another type…
Browse files Browse the repository at this point in the history
… is already set

- Ref #326
  • Loading branch information
ShaneBeee committed Jan 26, 2023
1 parent dccf2a9 commit afb4407
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/java/com/shanebeestudios/skbee/api/nbt/NBTApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,13 @@ public static Object getTag(String tag, NBTCompound compound, NBTCustomType type
return null;
}
case NBTTagCompound -> {
return compound.getOrCreateCompound(tag);
if (compound.hasTag(tag)) {
if (compound.getType(tag) == NBTType.NBTTagCompound) {
return compound.getCompound(tag);
}
} else {
return compound.getOrCreateCompound(tag);
}
}
case NBTTagCompoundList -> {
return new ArrayList<>(compound.getCompoundList(tag));
Expand Down

0 comments on commit afb4407

Please sign in to comment.