diff --git a/src/main/java/com/nomiceu/nomilabs/remap/datafixer/LabsFixes.java b/src/main/java/com/nomiceu/nomilabs/remap/datafixer/LabsFixes.java index 86e305a7..6169568c 100644 --- a/src/main/java/com/nomiceu/nomilabs/remap/datafixer/LabsFixes.java +++ b/src/main/java/com/nomiceu/nomilabs/remap/datafixer/LabsFixes.java @@ -144,6 +144,9 @@ public static void init() { */ itemFixes = new ObjectArrayList<>(); + // Must be first Dark Red Coal Remap and Custom Capacitor NBT Removal, then Deprecated Item Remap, then CT General Remap, + // because only one fix is applied. + itemFixes.add( new DataFix.ItemFix("Dark Red Coal Remap", "Correctly remaps Content Tweaker Dark Red Coal to XU2 Red Coal.", @@ -155,6 +158,20 @@ public static void init() { .setMeta((short) 4)) // Red Coal ); + if (Loader.isModLoaded(LabsValues.ENDER_IO_MODID)) + itemFixes.add( + new DataFix.ItemFix("Custom Capacitor NBT Removal", + "Removes NBT from Custom Capacitors.", + false, + (version) -> version <= PRE_CAPACITOR_REMAPPING, + (modList) -> true, + (stack) -> (stack.rl.getNamespace().equals(LABS_MODID) || + stack.rl.getNamespace().equals(CONTENTTWEAKER_MODID)) && + capacitorSpecificationRemap.containsKey(stack.rl.getPath()) && + capacitorSpecificationRemap.get(stack.rl.getPath()).needChange(stack.tag), + (stack) -> stack.setTag(capacitorSpecificationRemap.get(stack.rl.getPath()).remove(stack.tag))) + ); + itemFixes.add( new DataFix.ItemFix("Deprecated Item Remap", "Remaps Deprecated Items to their Modern Counterparts.", @@ -197,7 +214,7 @@ public static void init() { (stack) -> { var tag = Objects.requireNonNull(stack.tag); tag.removeTag("Freq"); - stack.setTag(tag.isEmpty() ? null : tag); + stack.setTag(tag); }) ); @@ -247,20 +264,6 @@ public static void init() { .setRl(LabsNames.makeLabsName(stack.rl.getPath()))) ); - if (Loader.isModLoaded(LabsValues.ENDER_IO_MODID)) - itemFixes.add( - new DataFix.ItemFix("Custom Capacitor NBT Removal", - "Removes NBT from Custom Capacitors.", - false, - (version) -> version <= PRE_CAPACITOR_REMAPPING, - (modList) -> true, - (stack) -> (stack.rl.getNamespace().equals(LABS_MODID) || - stack.rl.getNamespace().equals(CONTENTTWEAKER_MODID)) && - capacitorSpecificationRemap.containsKey(stack.rl.getPath()) && - capacitorSpecificationRemap.get(stack.rl.getPath()).needChange(stack.tag), - (stack) -> stack.setTag(capacitorSpecificationRemap.get(stack.rl.getPath()).remove(stack.tag))) - ); - /* * Block Fixes. * Note that this is not applied on any new blocks, placed or generated. @@ -496,7 +499,7 @@ public NBTTagCompound remove(@Nullable NBTTagCompound compound) { if (compound == null || compound.isEmpty()) return null; removeEIO(compound); removeDisplay(compound); - return compound.isEmpty() ? null : compound; + return compound; } private void removeEIO(NBTTagCompound compound) { diff --git a/src/main/java/com/nomiceu/nomilabs/remap/datafixer/storage/ItemStackLike.java b/src/main/java/com/nomiceu/nomilabs/remap/datafixer/storage/ItemStackLike.java index a987f718..1d5487cd 100644 --- a/src/main/java/com/nomiceu/nomilabs/remap/datafixer/storage/ItemStackLike.java +++ b/src/main/java/com/nomiceu/nomilabs/remap/datafixer/storage/ItemStackLike.java @@ -49,7 +49,7 @@ public ItemStackLike setMeta(short newMeta) { } public ItemStackLike setTag(@Nullable NBTTagCompound newTag) { - tag = newTag; + tag = newTag == null || newTag.isEmpty() ? null : newTag; return this; } } diff --git a/src/main/resources/assets/nomilabs/lang/en_us.lang b/src/main/resources/assets/nomilabs/lang/en_us.lang index fb4672b5..485842b1 100644 --- a/src/main/resources/assets/nomilabs/lang/en_us.lang +++ b/src/main/resources/assets/nomilabs/lang/en_us.lang @@ -90,7 +90,7 @@ fluid.moltendarksoularium=Molten Dark Soularium nomilabs.fixer.intro.1=This world must be remapped. nomilabs.fixer.intro.2=§lA Backup will be made.§r nomilabs.fixer.intro.3=Pressing 'No' will cancel world loading. -nomilabs.fixer.intro.4=§cNote that after the world is loaded with this, you CANNOT undo this!.§r +nomilabs.fixer.intro.4=§cNote that after the world is loaded with this, you §nCANNOT§r§c undo this!.§r nomilabs.fixer.intro.5=You §nWILL§r have to load from the backup in order to load in a previous version! nomilabs.fixer.intro.6=§7The changes that must be made via Data Fixers have been printed to your log.§r