Skip to content

Commit

Permalink
Fix Transferring of Empty Tags
Browse files Browse the repository at this point in the history
  • Loading branch information
IntegerLimit committed Oct 5, 2024
1 parent 342ad0e commit 786b44b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/com/nomiceu/nomilabs/groovy/GroovyHelpers.java
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ public static NBTTagCompound transferSubTags(ItemStack orig, @Nullable NBTTagCom

var tagCompound = existing == null ? new NBTTagCompound() : existing;
for (var key : keys) {
if (origCompound.hasKey(key))
if (origCompound.hasKey(key) && !origCompound.getTag(key).isEmpty())
tagCompound.setTag(key, origCompound.getTag(key));
}

Expand Down Expand Up @@ -579,7 +579,7 @@ public static NBTTagCompound transferTagAtPath(ItemStack orig, @Nullable NBTTagC
var linkedPath = new LinkedList<>(Arrays.asList(path));
NBTBase tag = findTagAtPath(origCompound, new LinkedList<>(linkedPath));

if (tag == null) return existing;
if (tag == null || tag.isEmpty()) return existing;
var compound = existing == null ? new NBTTagCompound() : existing;

addTagAtPath(compound, tag, linkedPath);
Expand All @@ -598,7 +598,7 @@ public static NBTTagCompound transferDrawerUpgradeData(ItemStack orig, @Nullable
var linkedPath = new LinkedList<>(Arrays.asList("tile", "Upgrades"));
NBTBase tag = findTagAtPath(origCompound, linkedPath);

if (!(tag instanceof NBTTagList)) return existing;
if (!(tag instanceof NBTTagList) || tag.isEmpty()) return existing;
var compound = existing == null ? new NBTTagCompound() : existing;

var storage = new NBTTagCompound();
Expand Down

0 comments on commit 786b44b

Please sign in to comment.