From 636a9525662d56b9027ab76a6012e4651392781c Mon Sep 17 00:00:00 2001 From: daoge_cmd <3523206925@qq.com> Date: Wed, 23 Oct 2024 16:44:17 +0800 Subject: [PATCH] chores: change some field value in start game packet to match vanilla behavior --- .../main/java/org/allaymc/api/server/ServerSettings.java | 4 ++-- .../component/player/EntityPlayerNetworkComponentImpl.java | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/api/src/main/java/org/allaymc/api/server/ServerSettings.java b/api/src/main/java/org/allaymc/api/server/ServerSettings.java index 54f34d623..bef354ded 100644 --- a/api/src/main/java/org/allaymc/api/server/ServerSettings.java +++ b/api/src/main/java/org/allaymc/api/server/ServerSettings.java @@ -123,8 +123,8 @@ public static class NetworkSettings extends OkaeriConfig { @Accessors(fluent = true) public static class WorldConfig extends OkaeriConfig { - @CustomKey("ticking-radius") - private int tickingRadius = 8; + @CustomKey("tick-radius") + private int tickRadius = 8; @CustomKey("view-distance") private int viewDistance = 8; diff --git a/server/src/main/java/org/allaymc/server/entity/component/player/EntityPlayerNetworkComponentImpl.java b/server/src/main/java/org/allaymc/server/entity/component/player/EntityPlayerNetworkComponentImpl.java index 13913d2fb..a5fa0df09 100644 --- a/server/src/main/java/org/allaymc/server/entity/component/player/EntityPlayerNetworkComponentImpl.java +++ b/server/src/main/java/org/allaymc/server/entity/component/player/EntityPlayerNetworkComponentImpl.java @@ -19,6 +19,7 @@ import org.allaymc.api.item.ItemStack; import org.allaymc.api.item.recipe.Recipe; import org.allaymc.api.math.location.Location3f; +import org.allaymc.api.network.ProtocolInfo; import org.allaymc.api.pack.Pack; import org.allaymc.api.registry.Registries; import org.allaymc.api.server.Server; @@ -310,8 +311,8 @@ public void initializePlayer() { startGamePacket.setLevelName(Server.SETTINGS.genericSettings().motd()); startGamePacket.setLevelId(""); startGamePacket.setDefaultPlayerPermission(Server.SETTINGS.genericSettings().defaultPermission()); - startGamePacket.setServerChunkTickRange(spawnWorld.getWorldData().getServerChunkTickRange()); - startGamePacket.setVanillaVersion(server.getNetworkServer().getCodec().getMinecraftVersion()); + startGamePacket.setServerChunkTickRange(Server.SETTINGS.worldSettings().tickRadius()); + startGamePacket.setVanillaVersion("*"); startGamePacket.setPremiumWorldTemplateId(""); startGamePacket.setInventoriesServerAuthoritative(true); startGamePacket.setItemDefinitions(DeferredData.getItemDefinitions()); @@ -324,7 +325,7 @@ public void initializePlayer() { startGamePacket.setMultiplayerCorrelationId(UUID.randomUUID().toString()); startGamePacket.setXblBroadcastMode(GamePublishSetting.PUBLIC); startGamePacket.setPlatformBroadcastMode(GamePublishSetting.PUBLIC); - startGamePacket.setServerEngine("Allay"); + startGamePacket.setServerEngine(ProtocolInfo.getMinecraftVersionStr()); startGamePacket.setBlockRegistryChecksum(0L); startGamePacket.setPlayerPropertyData(NbtMap.EMPTY); startGamePacket.setWorldTemplateId(new UUID(0, 0));