From 08c921267a34481be9e7ac2950afffa904b735a7 Mon Sep 17 00:00:00 2001 From: asie Date: Thu, 31 Jan 2019 01:44:10 +0100 Subject: [PATCH] tie Fabric resource pack location with vanilla resource location, helps #79 --- .../fabric/mixin/resources/MixinMinecraftGame.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/fabricmc/fabric/mixin/resources/MixinMinecraftGame.java b/src/main/java/net/fabricmc/fabric/mixin/resources/MixinMinecraftGame.java index 21791a885..e1dff4d70 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/resources/MixinMinecraftGame.java +++ b/src/main/java/net/fabricmc/fabric/mixin/resources/MixinMinecraftGame.java @@ -16,8 +16,11 @@ package net.fabricmc.fabric.mixin.resources; +import com.google.common.collect.Lists; import net.fabricmc.fabric.impl.resources.ModResourcePackUtil; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.resource.DefaultClientResourcePack; +import net.minecraft.resource.DefaultResourcePack; import net.minecraft.resource.ReloadableResourceManager; import net.minecraft.resource.ResourcePack; import net.minecraft.resource.ResourceType; @@ -37,6 +40,15 @@ public class MixinMinecraftGame { @Inject(method = "reloadResources()V", at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/ReloadableResourceManager;reload(Ljava/util/List;)V", ordinal = 0), locals = LocalCapture.CAPTURE_FAILHARD) public void reloadResources(CallbackInfo info, List list) { - ModResourcePackUtil.appendModResourcePacks(list, ResourceType.ASSETS); + List oldList = Lists.newArrayList(list); + list.clear(); + for (int i = 0; i < oldList.size(); i++) { + ResourcePack pack = oldList.get(i); + list.add(pack); + + if (pack instanceof DefaultClientResourcePack) { + ModResourcePackUtil.appendModResourcePacks(list, ResourceType.ASSETS); + } + } } }