Darkhax-Minecraft / Open-Loader

An open source resource and data loader for Minecraft.
GNU Lesser General Public License v2.1
19 stars 7 forks source link

[1.16.3] Datapack and Resource Pack may not have same name #4

Closed kindlich closed 4 years ago

kindlich commented 4 years ago

The issue

This issue happened for Folder Packs. When a resource pack and a data pack folder (and therefore the resource packs) have the same name, either overrides the other. Which one is overridden is arbitrary and can vary between pack restarts.

Example:

openloader
    | -> data
    |    | -> contenttweaker
    | -> resources
    |    | -> contenttweaker

In this example, either the resources are present ingame, or the data (in my case, loot tables), but not both.

Workaround as user

Rename either of the packs.

Technical Remarks

Inside ResourcePackList (Vanilla Class), the pack finders for data packs and resource packs are registered and stored in a HashSet. Since OpenLoaderPackFinder does not override .hashCode the position of these loaders in the Set is arbitrary, which explains why it is not constant which pack is overridden by the other.

As both PackFinders only use the pack folder's name, the data pack and the resource pack will end up with the same name. Since the ResourcePackList will use the found packs' name to put them in a Map<String, ResourcePackInfo> the 2nd pack will override the first one.

Darkhax commented 4 years ago

This should be fixed now.