Push forward

This commit is contained in:
2026-07-14 12:22:17 +08:00
parent 576a9a44c8
commit 969cd5c5f8
135 changed files with 551 additions and 551 deletions
@@ -157,7 +157,7 @@ index efcf294b523ca6b039eb2544546bf863ba717749..343c98fb35eb4cb736d26f67a11c00ef
}
+ // Shiroha start - Async protocol switch
+ };
+ if (!moe.monnairealms.camellia.config.modules.optimizations.AsyncProtocolChangeConfig.enabled) {
+ if (!io.nanachiyo0721.shiroha.config.modules.optimizations.AsyncProtocolChangeConfig.enabled) {
+ this.connection.setupOutboundProtocol(GameProtocols.CLIENTBOUND_TEMPLATE.bind(RegistryFriendlyByteBuf.decorator(this.server.registryAccess())));
+ afterSwitch.run(); // directly run callback as we won't process any packet this time
+ } else {
@@ -178,7 +178,7 @@ index eda7e765c7c2ffee305edc81e0c7a6b1e5bfa18d..4c9ea818be83ed3c4dacc762f4d0e8c0
} // Folia end - rewrite login process - move connection ownership to global region
this.waitingForSwitchToConfig = true; // Folia - rewrite login process - fix bad ordering of this field write - moved down
this.send(ClientboundStartConfigurationPacket.INSTANCE);
+ if (!moe.monnairealms.camellia.config.modules.optimizations.AsyncProtocolChangeConfig.enabled) { // Shiroha - Async protocol switch
+ if (!io.nanachiyo0721.shiroha.config.modules.optimizations.AsyncProtocolChangeConfig.enabled) { // Shiroha - Async protocol switch
this.connection.setupOutboundProtocol(ConfigurationProtocols.CLIENTBOUND);
+ // Shiroha start - Async protcol switch
+ } else {
@@ -192,7 +192,7 @@ index eda7e765c7c2ffee305edc81e0c7a6b1e5bfa18d..4c9ea818be83ed3c4dacc762f4d0e8c0
}
final ServerConfigurationPacketListenerImpl listener = new ServerConfigurationPacketListenerImpl(this.server, this.connection, this.createCookie(this.player.clientInformation())); // Paper
+ if (!moe.monnairealms.camellia.config.modules.optimizations.AsyncProtocolChangeConfig.enabled) { // Shiroha - Async protocol switch
+ if (!io.nanachiyo0721.shiroha.config.modules.optimizations.AsyncProtocolChangeConfig.enabled) { // Shiroha - Async protocol switch
this.connection
.setupInboundProtocol(
ConfigurationProtocols.SERVERBOUND,
@@ -238,7 +238,7 @@ index f2329d1a9d9d4bf4c9d771e25e54f2f9ef65a76c..7de3bbecea2f11e4e1cb65408729f346
+
+ Runnable afterSwitch = () -> io.papermc.paper.threadedregions.RegionizedServer.getInstance().addTask(configPacketListener::startConfiguration); // push back to main thread
+
+ if (!moe.monnairealms.camellia.config.modules.optimizations.AsyncProtocolChangeConfig.enabled) {
+ if (!io.nanachiyo0721.shiroha.config.modules.optimizations.AsyncProtocolChangeConfig.enabled) {
+ this.connection.setupOutboundProtocol(ConfigurationProtocols.CLIENTBOUND);
+ this.connection.setupInboundProtocol(ConfigurationProtocols.SERVERBOUND, configPacketListener);
+ afterSwitch.run();
@@ -260,7 +260,7 @@ index e7579a9873362317dd82b63306cf650af9472574..9e90197b96fcac958c5073ca8f560e77
// only after setting the connection listener to game type, add the connection to this regions list
level.getCurrentWorldData().connections.add(connection);
// Folia end - rewrite login process
+ if (!moe.monnairealms.camellia.config.modules.optimizations.AsyncProtocolChangeConfig.enabled) { // Shiroha - Async protocol switch // we will run async switch once these main thread logics became done
+ if (!io.nanachiyo0721.shiroha.config.modules.optimizations.AsyncProtocolChangeConfig.enabled) { // Shiroha - Async protocol switch // we will run async switch once these main thread logics became done
connection.setupInboundProtocol(
GameProtocols.SERVERBOUND_TEMPLATE.bind(RegistryFriendlyByteBuf.decorator(this.server.registryAccess()), playerConnection), playerConnection
);
@@ -273,7 +273,7 @@ index e7579a9873362317dd82b63306cf650af9472574..9e90197b96fcac958c5073ca8f560e77
}
// Paper end - Send empty chunk
+ // Shiroha start - Async protocol switch
+ if (moe.monnairealms.camellia.config.modules.optimizations.AsyncProtocolChangeConfig.enabled) {
+ if (io.nanachiyo0721.shiroha.config.modules.optimizations.AsyncProtocolChangeConfig.enabled) {
+ // auto read will be enabled once the async switch is done
+ connection.setupInboundProtocolAsync(
+ GameProtocols.SERVERBOUND_TEMPLATE.bind(RegistryFriendlyByteBuf.decorator(this.server.registryAccess()), playerConnection),