3030import org .cloudburstmc .protocol .bedrock .BedrockDisconnectReasons ;
3131import org .cloudburstmc .protocol .bedrock .codec .BedrockCodec ;
3232import org .cloudburstmc .protocol .bedrock .codec .compat .BedrockCompat ;
33- import org .cloudburstmc .protocol .bedrock .data .ExperimentData ;
3433import org .cloudburstmc .protocol .bedrock .data .PacketCompressionAlgorithm ;
3534import org .cloudburstmc .protocol .bedrock .data .ResourcePackType ;
3635import org .cloudburstmc .protocol .bedrock .netty .codec .compression .CompressionStrategy ;
@@ -237,14 +236,17 @@ public PacketSignal handle(LoginPacket loginPacket) {
237236 // Can happen if an error occurs in the resource pack event; that'll disconnect the player
238237 return PacketSignal .HANDLED ;
239238 }
239+ session .integratedPackActive (resourcePackLoadEvent .isIntegratedPackActive ());
240240
241241 ResourcePacksInfoPacket resourcePacksInfo = new ResourcePacksInfoPacket ();
242242 resourcePacksInfo .getResourcePackInfos ().addAll (this .resourcePackLoadEvent .infoPacketEntries ());
243243 resourcePacksInfo .setVibrantVisualsForceDisabled (!session .isAllowVibrantVisuals ());
244244
245- resourcePacksInfo .setForcedToAccept (GeyserImpl .getInstance ().config ().gameplay ().forceResourcePacks ());
245+ resourcePacksInfo .setForcedToAccept (GeyserImpl .getInstance ().config ().gameplay ().forceResourcePacks () ||
246+ resourcePackLoadEvent .isIntegratedPackActive ());
246247 resourcePacksInfo .setWorldTemplateId (UUID .randomUUID ());
247248 resourcePacksInfo .setWorldTemplateVersion ("*" );
249+
248250 session .sendUpstreamPacket (resourcePacksInfo );
249251
250252 GeyserLocale .loadGeyserLocale (session .locale ());
@@ -271,7 +273,8 @@ public PacketSignal handle(ResourcePackClientResponsePacket packet) {
271273 // We must spawn the white world
272274 session .connect ();
273275 }
274- geyser .getLogger ().info (GeyserLocale .getLocaleStringLog ("geyser.network.connect" , session .getAuthData ().name ()));
276+ geyser .getLogger ().info (GeyserLocale .getLocaleStringLog ("geyser.network.connect" , session .getAuthData ().name () +
277+ " (" + session .protocolVersion () + ")" ));
275278 }
276279 case SEND_PACKS -> {
277280 if (packet .getPackIds ().isEmpty ()) {
@@ -290,13 +293,9 @@ public PacketSignal handle(ResourcePackClientResponsePacket packet) {
290293 stackPacket .setGameVersion (session .getClientData ().getGameVersion ());
291294 stackPacket .getResourcePacks ().addAll (this .resourcePackLoadEvent .orderedPacks ());
292295
293- if (GameProtocol .is1_21_100 (session )) {
294- // Support copper age drop features (or some of them) in 1.21.100
295- stackPacket .getExperiments ().add (new ExperimentData ("y_2025_drop_3" , true ));
296- }
297-
298296 session .sendUpstreamPacket (stackPacket );
299297 }
298+ case REFUSED -> session .disconnect ("disconnectionScreen.resourcePack" );
300299 default -> {
301300 GeyserImpl .getInstance ().getLogger ().debug ("received unknown status packet: " + packet );
302301 session .disconnect ("disconnectionScreen.resourcePack" );
@@ -380,7 +379,7 @@ public void processNextChunk() {
380379 ResourcePackHolder holder = this .resourcePackLoadEvent .getPacks ().get (packet .getPackId ());
381380 if (holder == null ) {
382381 GeyserImpl .getInstance ().getLogger ().debug ("Client {0} tried to request pack id {1} not sent to it!" ,
383- session .bedrockUsername (), packet .getPackId ());
382+ session .bedrockUsername (), packet .getPackId ());
384383 chunkRequestQueue .clear ();
385384 session .disconnect ("disconnectionScreen.resourcePack" );
386385 return ;
@@ -426,7 +425,7 @@ public void processNextChunk() {
426425 // Also flushes packets
427426 // Avoids bursting slower / delayed clients
428427 session .sendUpstreamPacketImmediately (data );
429- GeyserImpl . getInstance (). getScheduledThread (). schedule (this ::processNextChunk , PACKET_SEND_DELAY , TimeUnit .MILLISECONDS );
428+ session . scheduleInEventLoop (this ::processNextChunk , PACKET_SEND_DELAY , TimeUnit .MILLISECONDS );
430429 } else {
431430 session .sendUpstreamPacket (data );
432431 }
@@ -437,13 +436,13 @@ public void processNextChunk() {
437436 }
438437 }
439438
440- protected void sendPackDataInfo (String id ) {
439+ private void sendPackDataInfo (String id ) {
441440 ResourcePackDataInfoPacket data = new ResourcePackDataInfoPacket ();
442441 String [] packID = id .split ("_" );
443442
444443 if (packID .length < 2 ) {
445444 GeyserImpl .getInstance ().getLogger ().debug ("Client {0} tried to request invalid pack id {1}!" ,
446- session .bedrockUsername (), packID );
445+ session .bedrockUsername (), packID );
447446 session .disconnect ("disconnectionScreen.resourcePack" );
448447 return ;
449448 }
@@ -453,15 +452,15 @@ protected void sendPackDataInfo(String id) {
453452 packId = UUID .fromString (packID [0 ]);
454453 } catch (IllegalArgumentException e ) {
455454 GeyserImpl .getInstance ().getLogger ().debug ("Client {0} tried to request pack with an invalid id {1})" ,
456- session .bedrockUsername (), id );
455+ session .bedrockUsername (), id );
457456 session .disconnect ("disconnectionScreen.resourcePack" );
458457 return ;
459458 }
460459
461460 ResourcePackHolder holder = this .resourcePackLoadEvent .getPacks ().get (packId );
462461 if (holder == null ) {
463462 GeyserImpl .getInstance ().getLogger ().debug ("Client {0} tried to request pack id {1} not sent to it!" ,
464- session .bedrockUsername (), id );
463+ session .bedrockUsername (), id );
465464 session .disconnect ("disconnectionScreen.resourcePack" );
466465 return ;
467466 }
0 commit comments