diff --git a/api/src/main/java/org/geysermc/geyser/api/pack/PackCodec.java b/api/src/main/java/org/geysermc/geyser/api/pack/PackCodec.java index ba062535d..7c123b624 100644 --- a/api/src/main/java/org/geysermc/geyser/api/pack/PackCodec.java +++ b/api/src/main/java/org/geysermc/geyser/api/pack/PackCodec.java @@ -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. diff --git a/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java b/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java index bf87f1c87..ca8c6cd11 100644 --- a/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java @@ -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)); diff --git a/core/src/main/java/org/geysermc/geyser/pack/path/GeyserPathPackCodec.java b/core/src/main/java/org/geysermc/geyser/pack/path/GeyserPathPackCodec.java index 13d07c800..84067600f 100644 --- a/core/src/main/java/org/geysermc/geyser/pack/path/GeyserPathPackCodec.java +++ b/core/src/main/java/org/geysermc/geyser/pack/path/GeyserPathPackCodec.java @@ -84,7 +84,7 @@ public class GeyserPathPackCodec extends PathPackCodec { } @Override - public @NonNull ResourcePack create() { + protected @NonNull ResourcePack create() { return ResourcePackLoader.readPack(this.path); } diff --git a/core/src/main/java/org/geysermc/geyser/registry/loader/ResourcePackLoader.java b/core/src/main/java/org/geysermc/geyser/registry/loader/ResourcePackLoader.java index 50783e77f..a790c3c6e 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/loader/ResourcePackLoader.java +++ b/core/src/main/java/org/geysermc/geyser/registry/loader/ResourcePackLoader.java @@ -212,19 +212,20 @@ public class ResourcePackLoader implements RegistryLoader 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 remotePackUrls = GeyserImpl.getInstance().getConfig().getResourcePackUrls(); + List remotePackUrls = instance.getConfig().getResourcePackUrls(); Map packMap = new Object2ObjectOpenHashMap<>(); for (String url : remotePackUrls) { @@ -233,8 +234,8 @@ public class ResourcePackLoader implements RegistryLoader