From a91e48b70eaf1e6ff2674e046f483d63ef2d8408 Mon Sep 17 00:00:00 2001
From: Technici4n <13494793+Technici4n@users.noreply.github.com>
Date: Fri, 23 Dec 2022 17:00:37 +0100
Subject: [PATCH] Don't break the ordering of ResourcePackProviders (#2784)

Fixes #1671.
---
 .../mixin/resource/loader/ResourcePackManagerMixin.java      | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fabric-resource-loader-v0/src/main/java/net/fabricmc/fabric/mixin/resource/loader/ResourcePackManagerMixin.java b/fabric-resource-loader-v0/src/main/java/net/fabricmc/fabric/mixin/resource/loader/ResourcePackManagerMixin.java
index 181dc05f3..f6a0bd59e 100644
--- a/fabric-resource-loader-v0/src/main/java/net/fabricmc/fabric/mixin/resource/loader/ResourcePackManagerMixin.java
+++ b/fabric-resource-loader-v0/src/main/java/net/fabricmc/fabric/mixin/resource/loader/ResourcePackManagerMixin.java
@@ -16,7 +16,7 @@
 
 package net.fabricmc.fabric.mixin.resource.loader;
 
-import java.util.HashSet;
+import java.util.LinkedHashSet;
 import java.util.Set;
 
 import org.spongepowered.asm.mixin.Final;
@@ -45,7 +45,8 @@ public abstract class ResourcePackManagerMixin<T extends ResourcePackProfile> {
 
 	@Inject(method = "<init>", at = @At("RETURN"))
 	public void construct(ResourcePackProvider[] resourcePackProviders, CallbackInfo info) {
-		providers = new HashSet<>(providers);
+		// Use a LinkedHashSet to preserve ordering
+		providers = new LinkedHashSet<>(providers);
 
 		// Search resource pack providers to find any server-related pack provider.
 		boolean shouldAddServerProvider = false;