API Surface (0) No public/protected methods detected (fields or constants only).
Code Graph: Dependencies (2) Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.
Full Source
ResourceProvider.java 33 lines · Minecraft 26.3 · verbatim Copy
1 package net.minecraft.server.packs.resources;
2
3 import java.io.BufferedReader;
4 import java.io.FileNotFoundException;
5 import java.io.IOException;
6 import java.io.InputStream;
7 import java.util.Map;
8 import java.util.Optional;
9 import net.minecraft.resources.Identifier;
10
11 @FunctionalInterface
12 public interface ResourceProvider {
13 ResourceProvider EMPTY = location -> Optional.empty();
14
15 Optional<Resource> getResource(Identifier location);
16
17 default Resource getResourceOrThrow(final Identifier location) throws FileNotFoundException {
18 return this.getResource(location).orElseThrow(() -> new FileNotFoundException(location.toString()));
19 }
20
21 default InputStream open(final Identifier location) throws IOException {
22 return this.getResourceOrThrow(location).open();
23 }
24
25 default BufferedReader openAsReader(final Identifier location) throws IOException {
26 return this.getResourceOrThrow(location).openAsReader();
27 }
28
29 static ResourceProvider fromMap(final Map<Identifier, Resource> map) {
30 return location -> Optional.ofNullable(map.get(location));
31 }
32 }
33
Decompiled Minecraft 26.3 source of ResourceProvider (net/minecraft/server/packs/resources/ResourceProvider.java) with Mojang official mappings, stored verbatim on the site.