Jump to content

Intentionally remapping blocks / removing entities as part of uninstalled mod cleanup


SteffanDonal

Recommended Posts

Hey there!

A bit of background on me first - I'm a software engineer by trade, and I'm comfortable getting my hands dirty. I've done as much research as possible on this topic and would like to put the feelers out while I start experimenting with this little task. That said, I do want to be pragmatic here. I'd prefer not to write my own mod to fix the issue if I can use some elbow grease and clean things up by hand.

I've got a 1.19.2 world running on Forge 43.1.65 that currently has the mod "Darker Depths" installed. Unfortunately... it just wasn't worth it. I'd thought it would be an excellent complement for the new world generation, but it's just taken over the underground and made caving unfun. Furthermore, it's closed-source and has zero configuration available. So, I want to remove it.

I've already done a trial run of removing the mod, and I saw the "expected" results of all of its blocks/entities going poof and being replaced with "placeholder air". After removing the mod, the caves in already generated chunks were a complete mess. Fortunately, even though the mod adds custom biomes, I've confirmed that removing it doesn't affect land/cave generation for new chunks. If I can replace existing blocks from the mod with other blocks, we'll be set! (Touch wood)
As far as I can tell, the mod only has one entity, the rest is all items and blocks, and none of the blocks seem to be "special".

Today I've been looking into solutions to mass find-and-replace blocks in a world, and I've got a solution that'll likely work well. First, I've got a list of the block ids in the mod and manually made a set of replacements. Next, I'll use MCA Selector to replace those blocks and invalidate lighting. If everything goes to plan with that approach, after doing so, I shouldn't see many errors in the console about missing entries, and we'll be happy.

While researching this, I came across Forge's MissingMappings event and the "REMAP" response, so I figured I'd check that out and see if anyone's tried to do the same thing. It seems that it's mostly mod owners that have used it, though, and almost every regular player "deals with" missing blocks or starts a new world.
My understanding right now (a lot of reading between the lines, and I haven't yet tested) is that if a mod were to handle the event and respond with "REMAP", Forge would store that remapping in `level.dat` under the `overrides` or `aliases` paths in each of the registries. (And, presumably, my "remove it and see what happens" experiment probably created entries under `dummied`)
From reading other posts, I understand that the data within the chunks will continue to reference the original IDs unless those blocks are updated or changed.

I have several questions, and I'd love some insight or pointers to learn more about this system!

  1. If I do my "replace all the blocks using a world editor" approach and delete the mod, should I care about cleaning anything else up, provided it works?
    (IE. Is it worth my time to fiddle around with anything else here, or should I keep my life simple?)
     
  2. Is it expected that removing a mod with biomes doesn't necessarily impact new chunks negatively?
    (Just double-checking, it seems too good to be true from my experience with Minecraft world generation)
     
  3. When the MissingMappings event is handled, does Forge store/cache the result, or will it fire every time?
    In either case, is this expected to cause (significant) extra server load?
     
  4. If the event result is stored, where is it, and what does it look like?
    (IE. How can I manually create entries so that Forge runs as error-free as it can in this situation?)
     

Thanks for reading!
I'm gonna go prod and poke the registry aliases/overrides/dummied objects, see if I can't learn something.

Link to comment
Share on other sites

18 hours ago, SteffanDonal said:

If I do my "replace all the blocks using a world editor" approach and delete the mod, should I care about cleaning anything else up, provided it works?

Missing worldgen information does have the potential of corrupting the save file, but it typically only happens for removing dimensions. Those bugs might be fixed though in recent versions.

18 hours ago, SteffanDonal said:

Is it expected that removing a mod with biomes doesn't necessarily impact new chunks negatively?

Yesish. There may be some issues when generating the heightmap when connected to biomes that have been removed and had their blocks replaced with air due to smooth, but other than that it should just generate as normal since it's lazy when determining how the chunk will generate.

18 hours ago, SteffanDonal said:

When the MissingMappings event is handled, does Forge store/cache the result, or will it fire every time?
In either case, is this expected to cause (significant) extra server load?

The missing event is fired every time the world is loaded. As for missing entries, I believe once they get remapped, they do not get remapped again. Only missing mappings have the event fired.

18 hours ago, SteffanDonal said:

If the event result is stored, where is it, and what does it look like?

Depends on the result. Ignore, warn, and fail will not store anything but just continue, notify, or fail the world loading. Remap, as you gathered, will be added as an alias and stored in the level.dat as the registry snapshot.

Link to comment
Share on other sites

On 1/2/2023 at 3:30 PM, ChampionAsh5357 said:

Missing worldgen information does have the potential of corrupting the save file, but it typically only happens for removing dimensions. Those bugs might be fixed though in recent versions.

Yesish. There may be some issues when generating the heightmap when connected to biomes that have been removed and had their blocks replaced with air due to smooth, but other than that it should just generate as normal since it's lazy when determining how the chunk will generate.

The missing event is fired every time the world is loaded. As for missing entries, I believe once they get remapped, they do not get remapped again. Only missing mappings have the event fired.

Depends on the result. Ignore, warn, and fail will not store anything but just continue, notify, or fail the world loading. Remap, as you gathered, will be added as an alias and stored in the level.dat as the registry snapshot.

Thank you for your response!

I've since done some investigation and it does seem that either I'm missing something or it's not possible to define these aliases/overrides by hand. The collections are overwritten/regenerated when Forge loads, seemingly regardless of when I attempt to do it (before mod removal or after)
That was a little disappointing but I imagine there's a good reason it's done this way. I'd hoped that this would be a graceful way to handle removing a mod and its content - maybe all it needs to be a viable solution is for a mod to be created that can be configured to handle remapping for some other mod in preparation for it being removed.

Given that I hoped not to write a mod just to do some cleanup I've instead opted to go the long "do a big find and replace" method on the world, which after a bit of chunk trimming, isn't taking too long.

Thanks again for the help; I think this one is effectively solved.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.