diff --git a/src/main/java/com/nomiceu/nomilabs/groovy/GroovyHelpers.java b/src/main/java/com/nomiceu/nomilabs/groovy/GroovyHelpers.java index 36c3bb7..c1bb241 100644 --- a/src/main/java/com/nomiceu/nomilabs/groovy/GroovyHelpers.java +++ b/src/main/java/com/nomiceu/nomilabs/groovy/GroovyHelpers.java @@ -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)); } @@ -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); @@ -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();