Skip to content

Use forge load order.#746

Open
Acuadragon100 wants to merge 1 commit intoKiltMC:version/1.20.1from
Acuadragon100:version/1.20.1-use-forge-order
Open

Use forge load order.#746
Acuadragon100 wants to merge 1 commit intoKiltMC:version/1.20.1from
Acuadragon100:version/1.20.1-use-forge-order

Conversation

@Acuadragon100
Copy link
Copy Markdown
Contributor

Some Forge mods unfortunately rely on the default load order without explicitly declaring their dependencies.

On Forge, this order depends on the order of keys in a hash map, but at the very least it's always the same for a given modpack. On Kilt, the order is effectively random and changes every startup, which means it sometimes works and sometimes doesn't.

This patch changes that to make Kilt consistent with how Forge sorts the mods. Note that this won't mean that mods will be placed in the exact same order as they will on Forge every time. In fact, the main mod combination which motivated this change (Deep Aether + Lost Aether Content) doesn't work when only those mods are loaded in isolation because the hash map is a lot smaller with only those mods compared to how big it is without any other mods on Forge. However, it does work if you add more forge mods.

@BluSpring
Copy link
Copy Markdown
Member

In theory, wouldn't sorting by hash code return a similar sort, or am I wrong on this?

@Acuadragon100
Copy link
Copy Markdown
Contributor Author

Acuadragon100 commented Apr 28, 2026

I did try that at first, and in the case of Deep Aether + Lost Aether Content it actually worked better.
Thing is, the hash key might be larger than the highest index used by the internal array in the hash map. So it needs to convert it to an index within the array, which means the actual order depends on the size of the map.

So basically, sorting by hash keys directly might work in general, but there will probably be edge cases where it won't work. That's technically true with this implementation as well, but it also gives users the ability to add or remove unrelated mods to get around the issue, which is what they would have to do on Forge if this issue were to appear there.

@BluSpring
Copy link
Copy Markdown
Member

Personally slightly unsure with this approach, especially considering potential drawbacks. Should probably find a way to directly replicate Forge's load order without directly copying the way they load mods, especially considering the edge case you mentioned of loading mods in isolation, which some users very well could be doing.

@Acuadragon100
Copy link
Copy Markdown
Contributor Author

Acuadragon100 commented Apr 28, 2026

Thing is, I'm not sure how else to do it. Ultimately the main reason the order isn't the same when the mods are loaded in isolation comes from the fact that Kilt has fewer builtin mods. Without this patch the order will be different every time the game starts, which is not ideal for modpacks. Using hash keys to sort the list isn't ideal either because it might get the order wrong in some edge cases and then users won't be able to change it the order. I guess using hash keys to sort it could be fine if we just add some config that users can use to manually override the load order?

Ignore my previous message btw, I misunderstood your message (sorry about that).

@BluSpring
Copy link
Copy Markdown
Member

Honestly considering Kilt now actually has a config people can use, it could be viable to have config-based mod load order, but then comes the problem of "how do we trust that users aren't going to screw this up?"

@Acuadragon100
Copy link
Copy Markdown
Contributor Author

Acuadragon100 commented Apr 29, 2026

Thinking about it, Kilt could probably benefit from something like Dependency Overrides. I'm thinking a configurable load order would fit into that quite nicely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants