From 02d6473dc52558bea9811c2b3b3fe7a3571c1a8c Mon Sep 17 00:00:00 2001 From: onebeastchris Date: Tue, 10 Oct 2023 15:48:25 +0200 Subject: [PATCH] Small tweaks: record formatting/javadocs --- .../geyser/api/pack/ResourcePackCDNEntry.java | 13 +++++++++---- .../geyser/network/UpstreamPacketHandler.java | 17 +++++++++++++++-- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/api/src/main/java/org/geysermc/geyser/api/pack/ResourcePackCDNEntry.java b/api/src/main/java/org/geysermc/geyser/api/pack/ResourcePackCDNEntry.java index 81fa56bab..620147f85 100644 --- a/api/src/main/java/org/geysermc/geyser/api/pack/ResourcePackCDNEntry.java +++ b/api/src/main/java/org/geysermc/geyser/api/pack/ResourcePackCDNEntry.java @@ -27,9 +27,14 @@ package org.geysermc.geyser.api.pack; import java.util.UUID; -public record ResourcePackCDNEntry( - String url, - UUID uuid -) { +/** + * Represents a CDN entry for a resource pack. + * The URL must be a direct download link to a Bedrock edition resource pack. + * The UUID must be the UUID of the resource pack. + * + * @param url URL from which the pack should be downloaded + * @param uuid UUID of the pack + */ +public record ResourcePackCDNEntry(String url, UUID uuid) { } 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 2f5961c39..f11f938b4 100644 --- a/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java @@ -31,7 +31,20 @@ import org.cloudburstmc.protocol.bedrock.codec.BedrockCodec; import org.cloudburstmc.protocol.bedrock.data.ExperimentData; import org.cloudburstmc.protocol.bedrock.data.PacketCompressionAlgorithm; import org.cloudburstmc.protocol.bedrock.data.ResourcePackType; -import org.cloudburstmc.protocol.bedrock.packet.*; +import org.cloudburstmc.protocol.bedrock.packet.BedrockPacket; +import org.cloudburstmc.protocol.bedrock.packet.LoginPacket; +import org.cloudburstmc.protocol.bedrock.packet.ModalFormResponsePacket; +import org.cloudburstmc.protocol.bedrock.packet.MovePlayerPacket; +import org.cloudburstmc.protocol.bedrock.packet.NetworkSettingsPacket; +import org.cloudburstmc.protocol.bedrock.packet.PlayStatusPacket; +import org.cloudburstmc.protocol.bedrock.packet.RequestNetworkSettingsPacket; +import org.cloudburstmc.protocol.bedrock.packet.ResourcePackChunkDataPacket; +import org.cloudburstmc.protocol.bedrock.packet.ResourcePackChunkRequestPacket; +import org.cloudburstmc.protocol.bedrock.packet.ResourcePackClientResponsePacket; +import org.cloudburstmc.protocol.bedrock.packet.ResourcePackDataInfoPacket; +import org.cloudburstmc.protocol.bedrock.packet.ResourcePackStackPacket; +import org.cloudburstmc.protocol.bedrock.packet.ResourcePacksInfoPacket; +import org.cloudburstmc.protocol.bedrock.packet.SetTitlePacket; import org.cloudburstmc.protocol.common.PacketSignal; import org.geysermc.geyser.Constants; import org.geysermc.geyser.GeyserImpl; @@ -182,10 +195,10 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { // Add CDN entries if the client supports it if (!GameProtocol.isPre1_20_30(session)) { for (ResourcePackCDNEntry entry : this.resourcePackLoadEvent.cdnEntries()) { - GeyserImpl.getInstance().getLogger().error("Adding CDN entry: " + entry.url() + " for " + entry.uuid()); resourcePacksInfo.getCDNEntries().add(new ResourcePacksInfoPacket.CDNEntry(entry.uuid().toString(), entry.url())); } } + resourcePacksInfo.setForcedToAccept(GeyserImpl.getInstance().getConfig().isForceResourcePacks()); session.sendUpstreamPacket(resourcePacksInfo);