mirror of
https://github.com/FabricMC/fabric.git
synced 2025-04-11 22:45:38 -04:00
Fix group resource packs
This commit is contained in:
parent
e47f1c6de5
commit
ac75df34b9
6 changed files with 26 additions and 18 deletions
|
@ -5,3 +5,7 @@ dependencies {
|
|||
testmodImplementation project(path: ':fabric-lifecycle-events-v1', configuration: 'namedElements')
|
||||
testmodImplementation project(path: ':fabric-api-base', configuration: 'namedElements')
|
||||
}
|
||||
|
||||
loom {
|
||||
accessWidenerPath = file("src/main/resources/fabric-resource-loader-v0.accesswidener")
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@ import java.util.stream.Collectors;
|
|||
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||
|
||||
import net.minecraft.resource.Resource;
|
||||
import net.minecraft.resource.ResourceImpl;
|
||||
import net.minecraft.resource.NamespaceResourceManager;
|
||||
import net.minecraft.resource.NamespaceResourceManager.class_7083;
|
||||
import net.minecraft.resource.ResourceNotFoundException;
|
||||
import net.minecraft.resource.ResourcePack;
|
||||
import net.minecraft.resource.ResourceType;
|
||||
|
@ -118,7 +118,7 @@ public abstract class GroupResourcePack implements ResourcePack {
|
|||
return this.namespacedPacks.keySet();
|
||||
}
|
||||
|
||||
public void appendResources(NamespaceResourceManagerAccessor manager, Identifier id, List<Resource> resources) throws IOException {
|
||||
public void appendResources(NamespaceResourceManagerAccessor manager, Identifier id, List<class_7083> resources) throws IOException {
|
||||
List<ModResourcePack> packs = this.namespacedPacks.get(id.getNamespace());
|
||||
|
||||
if (packs == null) {
|
||||
|
@ -129,8 +129,7 @@ public abstract class GroupResourcePack implements ResourcePack {
|
|||
|
||||
for (ModResourcePack pack : packs) {
|
||||
if (pack.contains(manager.getType(), id)) {
|
||||
InputStream metadataInputStream = pack.contains(manager.getType(), metadataId) ? manager.fabric$accessor_open(metadataId, pack) : null;
|
||||
resources.add(new ResourceImpl(pack.getName(), id, manager.fabric$accessor_open(id, pack), metadataInputStream));
|
||||
resources.add(((NamespaceResourceManager) manager).new class_7083(id, metadataId, pack));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,8 +26,9 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
|||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
|
||||
import net.minecraft.class_7086;
|
||||
import net.minecraft.resource.NamespaceResourceManager;
|
||||
import net.minecraft.resource.Resource;
|
||||
import net.minecraft.resource.NamespaceResourceManager.class_7083;
|
||||
import net.minecraft.resource.ResourcePack;
|
||||
import net.minecraft.resource.ResourceType;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
@ -36,17 +37,17 @@ import net.fabricmc.fabric.impl.resource.loader.GroupResourcePack;
|
|||
|
||||
@Mixin(NamespaceResourceManager.class)
|
||||
public class NamespaceResourceManagerMixin {
|
||||
private final ThreadLocal<List<Resource>> fabric$getAllResources$resources = new ThreadLocal<>();
|
||||
private final ThreadLocal<List<class_7083>> fabric$getAllResources$resources = new ThreadLocal<>();
|
||||
|
||||
@Inject(
|
||||
method = "getAllResources",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/resource/NamespaceResourceManager;getMetadataPath(Lnet/minecraft/util/Identifier;)Lnet/minecraft/util/Identifier;"
|
||||
),
|
||||
),
|
||||
locals = LocalCapture.CAPTURE_FAILHARD
|
||||
)
|
||||
private void onGetAllResources(Identifier id, CallbackInfoReturnable<List<Resource>> cir, List<Resource> resources) {
|
||||
)
|
||||
private void onGetAllResources(Identifier id, CallbackInfoReturnable<List<class_7086>> cir, List<class_7083> resources) {
|
||||
this.fabric$getAllResources$resources.set(resources);
|
||||
}
|
||||
|
||||
|
@ -55,8 +56,8 @@ public class NamespaceResourceManagerMixin {
|
|||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/resource/ResourcePack;contains(Lnet/minecraft/resource/ResourceType;Lnet/minecraft/util/Identifier;)Z"
|
||||
)
|
||||
)
|
||||
)
|
||||
private boolean onResourceAdd(ResourcePack pack, ResourceType type, Identifier id) throws IOException {
|
||||
if (pack instanceof GroupResourcePack) {
|
||||
((GroupResourcePack) pack).appendResources((NamespaceResourceManagerAccessor) this, id, this.fabric$getAllResources$resources.get());
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
accessWidener v2 named
|
||||
|
||||
accessible method net/minecraft/resource/NamespaceResourceManager$class_7083 <init> (Lnet/minecraft/resource/NamespaceResourceManager;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/resource/ResourcePack;)V
|
|
@ -22,6 +22,7 @@
|
|||
"mixins": [
|
||||
"fabric-resource-loader-v0.mixins.json"
|
||||
],
|
||||
"accessWidener": "fabric-resource-loader-v0.accesswidener",
|
||||
"custom": {
|
||||
"fabric-api:module-lifecycle": "stable"
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
org.gradle.jvmargs=-Xmx2560M
|
||||
|
||||
version=0.49.0
|
||||
version=0.49.1
|
||||
minecraft_version=22w11a
|
||||
yarn_version=+build.2
|
||||
loader_version=0.13.3
|
||||
|
@ -15,7 +15,7 @@ fabric-blockrenderlayer-v1-version=1.1.12
|
|||
fabric-command-api-v1-version=1.1.10
|
||||
fabric-commands-v0-version=0.2.9
|
||||
fabric-containers-v0-version=0.1.21
|
||||
fabric-content-registries-v0-version=3.0.3
|
||||
fabric-content-registries-v0-version=3.0.4
|
||||
fabric-crash-report-info-v1-version=0.1.11
|
||||
fabric-data-generation-api-v1-version=2.0.8
|
||||
fabric-dimensions-v1-version=2.1.17
|
||||
|
@ -23,18 +23,18 @@ fabric-entity-events-v1-version=1.4.8
|
|||
fabric-events-interaction-v0-version=0.4.20
|
||||
fabric-events-lifecycle-v0-version=0.2.13
|
||||
fabric-game-rule-api-v1-version=1.0.13
|
||||
fabric-gametest-api-v1-version=1.0.16
|
||||
fabric-gametest-api-v1-version=1.0.17
|
||||
fabric-item-api-v1-version=1.3.3
|
||||
fabric-item-groups-v0-version=0.3.11
|
||||
fabric-item-groups-v0-version=0.3.12
|
||||
fabric-key-binding-api-v1-version=1.0.12
|
||||
fabric-keybindings-v0-version=0.2.10
|
||||
fabric-lifecycle-events-v1-version=2.0.2
|
||||
fabric-loot-tables-v1-version=1.0.11
|
||||
fabric-mining-level-api-v1-version=2.0.5
|
||||
fabric-mining-level-api-v1-version=2.0.6
|
||||
fabric-models-v0-version=0.3.6
|
||||
fabric-networking-api-v1-version=1.0.21
|
||||
fabric-networking-v0-version=0.3.8
|
||||
fabric-object-builder-api-v1-version=2.0.4
|
||||
fabric-object-builder-api-v1-version=2.0.5
|
||||
fabric-particles-v1-version=0.2.12
|
||||
fabric-registry-sync-v0-version=0.9.8
|
||||
fabric-renderer-api-v1-version=0.4.13
|
||||
|
@ -45,7 +45,7 @@ fabric-rendering-fluids-v1-version=2.0.2
|
|||
fabric-rendering-v0-version=1.1.13
|
||||
fabric-rendering-v1-version=1.10.7
|
||||
fabric-resource-conditions-api-v1-version=2.0.2
|
||||
fabric-resource-loader-v0-version=0.4.19
|
||||
fabric-resource-loader-v0-version=0.4.20
|
||||
fabric-screen-api-v1-version=1.0.11
|
||||
fabric-screen-handler-api-v1-version=1.1.14
|
||||
fabric-textures-v0-version=1.0.12
|
||||
|
|
Loading…
Add table
Reference in a new issue