Some mod element files not removed after deleting mod element

Published by smmmadden on
Status
Fixed
Issue description

During the configuring of my next version of the mod, I had added a "test" advancement to see if I could add it during the crafting of certain blocks.  I later removed it since I want the base minecraft to control the advancements and it works fine.  So I removed the references, but everytime I started the server and then connect to a new world, I'd get the below exceptions.  

[09:40:09] [Server thread/ERROR] [FML]: Parsing error loading built-in advancement testenvironmentmod:test 
com.google.gson.JsonSyntaxException: Expected item to be an item, was unknown string 'testenvironmentmod:arsenicneurotoxinantidote'    
at net.minecraft.util.JsonUtils.getItem(JsonUtils.java:133) ~[JsonUtils.class:?]    
at net.minecraft.util.JsonUtils.getItem(JsonUtils.java:150) ~[JsonUtils.class:?]    
at net.minecraft.advancements.DisplayInfo.deserializeIcon(DisplayInfo.java:133) ~[DisplayInfo.class:?]    
at net.minecraft.advancements.DisplayInfo.deserialize(DisplayInfo.java:111) ~[DisplayInfo.class:?]    
at net.minecraft.advancements.Advancement$Builder.deserialize(Advancement.java:294) ~[Advancement$Builder.class:?]    
at net.minecraft.advancements.AdvancementManager$1.deserialize(AdvancementManager.java:50) ~[AdvancementManager$1.class:?]    
at net.minecraft.advancements.AdvancementManager$1.deserialize(AdvancementManager.java:46) ~[AdvancementManager$1.class:?]    
at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:69) ~[TreeTypeAdapter.class:?]    
at net.minecraft.util.JsonUtils.gsonDeserialize(JsonUtils.java:435) ~[JsonUtils.class:?]    
at net.minecraft.util.JsonUtils.fromJson(JsonUtils.java:485) ~[JsonUtils.class:?]    
at net.minecraftforge.common.ForgeHooks.lambda$loadAdvancements$0(ForgeHooks.java:1356) ~[ForgeHooks.class:?]    
at net.minecraftforge.common.crafting.CraftingHelper.findFiles(CraftingHelper.java:822) [CraftingHelper.class:?]    
at net.minecraftforge.common.ForgeHooks.loadAdvancements(ForgeHooks.java:1338) [ForgeHooks.class:?]    
at net.minecraftforge.common.ForgeHooks.loadAdvancements(ForgeHooks.java:1312) [ForgeHooks.class:?]    
at net.minecraft.advancements.AdvancementManager.reload(AdvancementManager.java:70) [AdvancementManager.class:?]    
at net.minecraft.advancements.AdvancementManager. (AdvancementManager.java:61) [AdvancementManager.class:?]    
at net.minecraft.world.WorldServer.init(WorldServer.java:162) [WorldServer.class:?]    
at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:123) [IntegratedServer.class:?]    
at net.minecraft.server.integrated.IntegratedServer.init(IntegratedServer.java:160) [IntegratedServer.class:?]    
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:552) [MinecraftServer.class:?]    
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_172] 
[09:40:09] [Server thread/ERROR] [FML]: Parsing error loading built-in advancement testenvironmentmod:cinnabarpowdermaker 
com.google.gson.JsonSyntaxException: Invalid criterion trigger: minecraft:cinnabarpowdermaker    
at net.minecraft.advancements.Criterion.criterionFromJson(Criterion.java:52) ~[Criterion.class:?]    
at net.minecraft.advancements.Criterion.criteriaFromJson(Criterion.java:82) ~[Criterion.class:?]    
at net.minecraft.advancements.Advancement$Builder.deserialize(Advancement.java:296) ~[Advancement$Builder.class:?]    
at net.minecraft.advancements.AdvancementManager$1.deserialize(AdvancementManager.java:50) ~[AdvancementManager$1.class:?]    
at net.minecraft.advancements.AdvancementManager$1.deserialize(AdvancementManager.java:46) ~[AdvancementManager$1.class:?]    
at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:69) ~[TreeTypeAdapter.class:?]    
at net.minecraft.util.JsonUtils.gsonDeserialize(JsonUtils.java:435) ~[JsonUtils.class:?]    
at net.minecraft.util.JsonUtils.fromJson(JsonUtils.java:485) ~[JsonUtils.class:?]    
at net.minecraftforge.common.ForgeHooks.lambda$loadAdvancements$0(ForgeHooks.java:1356) ~[ForgeHooks.class:?]    
at net.minecraftforge.common.crafting.CraftingHelper.findFiles(CraftingHelper.java:822) [CraftingHelper.class:?]    
at net.minecraftforge.common.ForgeHooks.loadAdvancements(ForgeHooks.java:1338) [ForgeHooks.class:?]    
at net.minecraftforge.common.ForgeHooks.loadAdvancements(ForgeHooks.java:1312) [ForgeHooks.class:?]    
at net.minecraft.advancements.AdvancementManager.reload(AdvancementManager.java:70) [AdvancementManager.class:?]    
at net.minecraft.advancements.AdvancementManager. (AdvancementManager.java:61) [AdvancementManager.class:?]    
at net.minecraft.world.WorldServer.init(WorldServer.java:162) [WorldServer.class:?]    
at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:123) [IntegratedServer.class:?]    
at net.minecraft.server.integrated.IntegratedServer.init(IntegratedServer.java:160) [IntegratedServer.class:?]    
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:552) [MinecraftServer.class:?]    
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_172]

So I went through each of the Java files and reformatted/saved them one-by-one.  Still, I got the same error when connecting to the world.  Since it had JSON in the error I thought, well maybe the app isn't cleaning up the older files and sure enough the two files still resided in the json folder and being picked by MCreator.  Once I removed them, the issue stopped.  So this bug is to make sure that if advancements are added and later removed, we also remove the files from the developers workstation.  If you need the JSON files, I have them saved.

screenshot of files

Issue comments

I can confirm this is happening. Some other files of some mod elements are not properly removed too. We will fix this bug.

I hope this will be in 1.8.4

This fix would make so much Space in Mod files, I always delete lot of mod elements I found bad

MCreator 1.8.3 will properly remove all associated files. It will keep textures and models however as they can be used by other elements and can be manually removed too. But advancement JSON files, block, and item JSON files and all these files will be properly removed.

I am closing this ticket now.

Files of mod elements that were removed already will not be automatically removed and need to be manually removed as MCreator does not have a track of removed files.