3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-19 14:30:17 +01:00
Dieser Commit ist enthalten in:
onebeastchris 2024-06-20 12:05:17 +02:00
Ursprung 6053b7dae8
Commit 2683b59406
4 geänderte Dateien mit 10 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -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.

Datei anzeigen

@ -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));

Datei anzeigen

@ -84,7 +84,7 @@ public class GeyserPathPackCodec extends PathPackCodec {
}
@Override
public @NonNull ResourcePack create() {
protected @NonNull ResourcePack create() {
return ResourcePackLoader.readPack(this.path);
}

Datei anzeigen

@ -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();
}
}