Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-19 14:30:17 +01:00
Minor cleanup
Dieser Commit ist enthalten in:
Ursprung
6053b7dae8
Commit
2683b59406
@ -68,7 +68,7 @@ public abstract class PackCodec {
|
||||
* @return the new resource pack
|
||||
*/
|
||||
@NonNull
|
||||
public abstract ResourcePack create();
|
||||
protected abstract ResourcePack create();
|
||||
|
||||
/**
|
||||
* Creates a new pack provider from the given path.
|
||||
|
@ -235,10 +235,12 @@ public class UpstreamPacketHandler extends LoggingPacketHandler {
|
||||
stackPacket.setExperimentsPreviouslyToggled(false);
|
||||
stackPacket.setForcedToAccept(false); // Leaving this as false allows the player to choose to download or not
|
||||
stackPacket.setGameVersion(session.getClientData().getGameVersion());
|
||||
|
||||
for (ResourcePack pack : this.resourcePackLoadEvent.resourcePacks()) {
|
||||
ResourcePackManifest.Header header = pack.manifest().header();
|
||||
stackPacket.getResourcePacks().add(new ResourcePackStackPacket.Entry(header.uuid().toString(), header.version().toString(), ""));
|
||||
}
|
||||
|
||||
if (GeyserImpl.getInstance().getConfig().isAddNonBedrockItems()) {
|
||||
// Allow custom items to work
|
||||
stackPacket.getExperiments().add(new ExperimentData("data_driven_items", true));
|
||||
|
@ -84,7 +84,7 @@ public class GeyserPathPackCodec extends PathPackCodec {
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull ResourcePack create() {
|
||||
protected @NonNull ResourcePack create() {
|
||||
return ResourcePackLoader.readPack(this.path);
|
||||
}
|
||||
|
||||
|
@ -212,19 +212,20 @@ public class ResourcePackLoader implements RegistryLoader<Path, Map<String, Reso
|
||||
}
|
||||
|
||||
private Map<String, ResourcePack> loadRemotePacks() {
|
||||
GeyserImpl instance = GeyserImpl.getInstance();
|
||||
// Unable to make this a static variable, as the test would fail
|
||||
final Path cachedCdnPacksDirectory = GeyserImpl.getInstance().getBootstrap().getConfigFolder().resolve("cache").resolve("remote_packs");
|
||||
final Path cachedCdnPacksDirectory = instance.getBootstrap().getConfigFolder().resolve("cache").resolve("remote_packs");
|
||||
|
||||
if (!Files.exists(cachedCdnPacksDirectory)) {
|
||||
try {
|
||||
Files.createDirectories(cachedCdnPacksDirectory);
|
||||
} catch (IOException e) {
|
||||
GeyserImpl.getInstance().getLogger().error("Could not create remote pack cache directory", e);
|
||||
instance.getLogger().error("Could not create remote pack cache directory", e);
|
||||
return new Object2ObjectOpenHashMap<>();
|
||||
}
|
||||
}
|
||||
|
||||
List<String> remotePackUrls = GeyserImpl.getInstance().getConfig().getResourcePackUrls();
|
||||
List<String> remotePackUrls = instance.getConfig().getResourcePackUrls();
|
||||
Map<String, ResourcePack> packMap = new Object2ObjectOpenHashMap<>();
|
||||
|
||||
for (String url : remotePackUrls) {
|
||||
@ -233,8 +234,8 @@ public class ResourcePackLoader implements RegistryLoader<Path, Map<String, Reso
|
||||
ResourcePack pack = codec.create();
|
||||
packMap.put(pack.manifest().header().uuid().toString(), pack);
|
||||
} catch (Exception e) {
|
||||
GeyserImpl.getInstance().getLogger().error(GeyserLocale.getLocaleStringLog("geyser.resource_pack.broken", url));
|
||||
if (GeyserImpl.getInstance().getLogger().isDebug()) {
|
||||
instance.getLogger().error(GeyserLocale.getLocaleStringLog("geyser.resource_pack.broken", url));
|
||||
if (instance.getLogger().isDebug()) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren