Skip to content

Commit

Permalink
Fix loading from topmost resource pack
Browse files Browse the repository at this point in the history
  • Loading branch information
lukebemish committed Jan 4, 2024
1 parent 8723559 commit f817258
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,14 @@ static ResourceGenerationContext.ResourceSource of(PackType type, Supplier<Strea

@Override
public @Nullable IoSupplier<InputStream> getResource(@NonNull ResourceLocation location) {
IoSupplier<InputStream> found = null;
for (PackResources pack : packs.get()) {
IoSupplier<InputStream> resource = pack.getResource(type, location);
if (resource != null) {
return resource;
found = resource;
}
}
return null;
return found;
}

@Override
Expand All @@ -217,6 +218,7 @@ public List<IoSupplier<InputStream>> getResourceStack(@NonNull ResourceLocation
out.add(resource);
}
}
Collections.reverse(out);
return out;
}

Expand All @@ -227,9 +229,7 @@ public Map<ResourceLocation, IoSupplier<InputStream>> listResources(@NonNull Str
for (String namespace : pack.getNamespaces(type)) {
pack.listResources(type, namespace, path, (rl, s) -> {
if (filter.test(rl)) {
if (!resources.containsKey(rl)) {
resources.put(rl, s);
}
resources.put(rl, s);
}
});
}
Expand All @@ -250,6 +250,9 @@ public Map<ResourceLocation, List<IoSupplier<InputStream>>> listResourceStacks(@
});
}
}
for (var list : resources.values()) {
Collections.reverse(list);
}
return resources;
}

Expand Down

0 comments on commit f817258

Please sign in to comment.