From 768b09e7fdb58a98395c2d043435e899028523db Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 12 Nov 2021 22:44:15 -0500 Subject: [PATCH] Update to latest MCProtocolLib with Mojang mappings --- .../spigot/world/GeyserPistonListener.java | 2 +- connector/pom.xml | 6 +-- .../command/defaults/OffhandCommand.java | 6 +-- .../command/defaults/StatisticsCommand.java | 6 +-- .../entity/AreaEffectCloudEntity.java | 2 +- .../geysermc/connector/entity/BoatEntity.java | 2 +- .../entity/living/monster/ShulkerEntity.java | 2 +- .../network/session/GeyserSession.java | 37 +++++++--------- .../session/cache/AdvancementsCache.java | 8 ++-- .../network/session/cache/BookEditCache.java | 4 +- .../network/session/cache/TagCache.java | 6 +-- .../network/session/cache/TeleportCache.java | 2 +- .../translators/PacketTranslatorRegistry.java | 8 ++-- .../BedrockAdventureSettingsTranslator.java | 4 +- .../bedrock/BedrockAnimateTranslator.java | 10 ++--- .../BedrockBlockEntityDataTranslator.java | 10 ++--- .../bedrock/BedrockBookEditTranslator.java | 4 +- .../BedrockCommandBlockUpdateTranslator.java | 10 ++--- .../BedrockCommandRequestTranslator.java | 4 +- .../BedrockContainerCloseTranslator.java | 4 +- .../bedrock/BedrockFilterTextTranslator.java | 4 +- ...BedrockInventoryTransactionTranslator.java | 42 +++++++++---------- .../BedrockItemFrameDropItemTranslator.java | 4 +- .../BedrockLecternUpdateTranslator.java | 16 +++---- .../BedrockMobEquipmentTranslator.java | 10 ++--- .../BedrockMoveEntityAbsoluteTranslator.java | 6 +-- .../BedrockNetworkStackLatencyTranslator.java | 4 +- .../bedrock/BedrockPlayerInputTranslator.java | 12 +++--- .../bedrock/BedrockRespawnTranslator.java | 4 +- .../bedrock/BedrockShowCreditsTranslator.java | 4 +- .../bedrock/BedrockTextTranslator.java | 7 ++-- .../entity/BedrockEntityEventTranslator.java | 4 +- .../player/BedrockActionTranslator.java | 40 +++++++++--------- .../entity/player/BedrockEmoteTranslator.java | 6 +-- .../player/BedrockInteractTranslator.java | 12 +++--- .../player/BedrockMovePlayerTranslator.java | 12 +++--- .../player/BedrockRiderJumpTranslator.java | 6 +-- .../network/translators/effect/Effect.java | 6 +-- .../translators/effect/PlaySoundEffect.java | 4 +- .../translators/effect/SoundEventEffect.java | 4 +- .../translators/effect/SoundLevelEffect.java | 4 +- .../inventory/click/ClickPlan.java | 4 +- .../BeaconInventoryTranslator.java | 4 +- .../EnchantingInventoryTranslator.java | 4 +- .../LecternInventoryTranslator.java | 8 ++-- .../translators/LoomInventoryTranslator.java | 4 +- .../PlayerInventoryTranslator.java | 6 +-- .../StonecutterInventoryTranslator.java | 4 +- .../java/JavaAdvancementsTabTranslator.java | 9 ++-- .../java/JavaAdvancementsTranslator.java | 10 ++--- .../java/JavaBossBarTranslator.java | 8 ++-- .../translators/java/JavaChatTranslator.java | 8 ++-- .../java/JavaDeclareCommandsTranslator.java | 8 ++-- .../java/JavaDeclareRecipesTranslator.java | 8 ++-- .../java/JavaDeclareTagsTranslator.java | 8 ++-- .../java/JavaDifficultyTranslator.java | 9 ++-- .../java/JavaDisconnectPacket.java | 8 ++-- ...or.java => JavaGameProfileTranslator.java} | 8 ++-- .../java/JavaJoinGameTranslator.java | 20 ++++----- .../java/JavaKeepAliveTranslator.java | 8 ++-- .../java/JavaLoginDisconnectTranslator.java | 8 ++-- .../JavaLoginPluginRequestTranslator.java | 13 +++--- .../translators/java/JavaPingPacket.java | 12 +++--- .../java/JavaPluginMessageTranslator.java | 12 +++--- ...nslator.java => JavaRecipeTranslator.java} | 8 ++-- .../java/JavaRespawnTranslator.java | 8 ++-- .../java/JavaStatisticsTranslator.java | 8 ++-- .../entity/JavaEntityAnimationTranslator.java | 10 ++--- .../entity/JavaEntityAttachTranslator.java | 8 ++-- .../JavaEntityCollectItemTranslator.java | 8 ++-- .../entity/JavaEntityEffectTranslator.java | 8 ++-- .../entity/JavaEntityEquipmentTranslator.java | 8 ++-- .../entity/JavaEntityHeadLookTranslator.java | 12 +++--- .../entity/JavaEntityMetadataTranslator.java | 8 ++-- .../JavaEntityPositionRotationTranslator.java | 8 ++-- .../entity/JavaEntityPositionTranslator.java | 12 +++--- .../JavaEntityPropertiesTranslator.java | 12 +++--- .../JavaEntityRemoveEffectTranslator.java | 8 ++-- .../entity/JavaEntityRotationTranslator.java | 8 ++-- .../JavaEntitySetPassengersTranslator.java | 8 ++-- .../entity/JavaEntityStatusTranslator.java | 8 ++-- .../entity/JavaEntityTeleportTranslator.java | 11 +++-- .../entity/JavaEntityVelocityTranslator.java | 8 ++-- .../JavaMoveVehicleTranslator.java} | 10 ++--- .../entity/JavaRemoveEntitiesTranslator.java | 8 ++-- .../player/JavaPlayerAbilitiesTranslator.java | 8 ++-- .../player/JavaPlayerActionAckTranslator.java | 8 ++-- .../JavaPlayerChangeHeldItemTranslator.java | 8 ++-- .../player/JavaPlayerHealthTranslator.java | 8 ++-- .../player/JavaPlayerListEntryTranslator.java | 8 ++-- .../JavaPlayerPositionRotationTranslator.java | 12 +++--- .../JavaPlayerSetExperienceTranslator.java | 8 ++-- .../spawn/JavaSpawnEntityTranslator.java | 8 ++-- .../spawn/JavaSpawnExpOrbTranslator.java | 11 +++-- .../JavaSpawnLivingEntityTranslator.java | 8 ++-- .../spawn/JavaSpawnPaintingTranslator.java | 8 ++-- .../spawn/JavaSpawnPlayerTranslator.java | 8 ++-- .../JavaBlockBreakAnimTranslator.java | 10 ++--- .../JavaBlockChangeTranslator.java | 14 +++---- .../JavaBlockValueTranslator.java | 12 +++--- .../JavaChunkDataTranslator.java | 10 ++--- .../JavaExplosionTranslator.java | 12 +++--- .../JavaMapDataTranslator.java | 17 ++++---- .../JavaMultiBlockChangeTranslator.java | 13 +++--- .../JavaNotifyClientTranslator.java | 22 +++++----- .../JavaPlayBuiltinSoundTranslator.java | 10 ++--- .../JavaPlayEffectTranslator.java | 12 +++--- .../JavaPlaySoundTranslator.java | 14 +++---- .../JavaSpawnParticleTranslator.java | 12 +++--- .../JavaSpawnPositionTranslator.java | 15 ++++--- .../JavaStopSoundTranslator.java | 14 +++---- .../JavaUnloadChunkTranslator.java | 10 ++--- .../JavaUpdateTileEntityTranslator.java | 12 +++--- .../JavaUpdateTimeTranslator.java | 10 ++--- .../JavaUpdateViewDistanceTranslator.java | 11 +++-- .../JavaUpdateViewPositionTranslator.java | 11 +++-- .../JavaInitializeBorderTranslator.java | 10 ++--- .../border/JavaSetBorderCenterTranslator.java | 10 ++--- .../JavaSetBorderLerpSizeTranslator.java | 10 ++--- .../border/JavaSetBorderSizeTranslator.java | 10 ++--- .../JavaSetBorderWarningDelayTranslator.java | 10 ++--- ...avaSetBorderWarningDistanceTranslator.java | 10 ++--- .../JavaDisplayScoreboardTranslator.java | 8 ++-- .../JavaScoreboardObjectiveTranslator.java | 8 ++-- .../java/scoreboard/JavaTeamTranslator.java | 8 ++-- .../scoreboard/JavaUpdateScoreTranslator.java | 8 ++-- .../java/title/JavaClearTitlesTranslator.java | 8 ++-- .../title/JavaSetActionBarTextTranslator.java | 8 ++-- .../title/JavaSetSubtitleTextTranslator.java | 8 ++-- .../title/JavaSetTitleTextTranslator.java | 8 ++-- .../JavaSetTitlesAnimationTranslator.java | 8 ++-- .../window/JavaCloseWindowTranslator.java | 8 ++-- .../window/JavaOpenHorseWindowTranslator.java | 8 ++-- .../java/window/JavaOpenWindowTranslator.java | 14 +++---- .../java/window/JavaSetSlotTranslator.java | 10 ++--- .../JavaTradeListTranslator.java | 10 ++--- .../window/JavaWindowItemsTranslator.java | 8 ++-- .../window/JavaWindowPropertyTranslator.java | 8 ++-- .../translators/world/GeyserWorldManager.java | 8 ++-- .../world/block/entity/PistonBlockEntity.java | 2 +- .../connector/registry/Registries.java | 4 +- .../loader/ParticleTypesRegistryLoader.java | 2 +- .../loader/SoundEffectsRegistryLoader.java | 2 +- .../connector/utils/BedrockMapIcon.java | 2 +- .../geysermc/connector/utils/BlockUtils.java | 2 +- .../connector/utils/DimensionUtils.java | 4 +- .../geysermc/connector/utils/Direction.java | 2 +- .../geysermc/connector/utils/EffectUtils.java | 2 +- .../connector/utils/InventoryUtils.java | 12 +++--- .../connector/utils/PluginMessageUtils.java | 4 +- 150 files changed, 652 insertions(+), 662 deletions(-) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{JavaLoginSuccessTranslator.java => JavaGameProfileTranslator.java} (88%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{JavaUnlockRecipesTranslator.java => JavaRecipeTranslator.java} (85%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world/JavaVehicleMoveTranslator.java => entity/JavaMoveVehicleTranslator.java} (81%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaBlockBreakAnimTranslator.java (90%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaBlockChangeTranslator.java (90%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaBlockValueTranslator.java (93%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaChunkDataTranslator.java (94%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaExplosionTranslator.java (89%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaMapDataTranslator.java (84%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaMultiBlockChangeTranslator.java (79%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaNotifyClientTranslator.java (91%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaPlayBuiltinSoundTranslator.java (93%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaPlayEffectTranslator.java (96%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaPlaySoundTranslator.java (84%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaSpawnParticleTranslator.java (94%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaSpawnPositionTranslator.java (84%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaStopSoundTranslator.java (87%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaUnloadChunkTranslator.java (87%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaUpdateTileEntityTranslator.java (90%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaUpdateTimeTranslator.java (85%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaUpdateViewDistanceTranslator.java (80%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaUpdateViewPositionTranslator.java (82%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/border/JavaInitializeBorderTranslator.java (85%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/border/JavaSetBorderCenterTranslator.java (82%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/border/JavaSetBorderLerpSizeTranslator.java (82%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/border/JavaSetBorderSizeTranslator.java (83%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/border/JavaSetBorderWarningDelayTranslator.java (81%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/border/JavaSetBorderWarningDistanceTranslator.java (80%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => window}/JavaTradeListTranslator.java (94%) diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserPistonListener.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserPistonListener.java index 39fefb2de..9810334f6 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserPistonListener.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserPistonListener.java @@ -25,7 +25,7 @@ package org.geysermc.platform.spigot.world; -import com.github.steveice10.mc.protocol.data.game.world.block.value.PistonValueType; +import com.github.steveice10.mc.protocol.data.game.level.block.value.PistonValueType; import com.nukkitx.math.vector.Vector3i; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; diff --git a/connector/pom.xml b/connector/pom.xml index b9b7b5732..0b9913ea2 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -147,9 +147,9 @@ compile - com.github.GeyserMC - MCProtocolLib - c2985e8 + com.github.steveice10 + mcprotocollib + 1.17.1-3-SNAPSHOT compile diff --git a/connector/src/main/java/org/geysermc/connector/command/defaults/OffhandCommand.java b/connector/src/main/java/org/geysermc/connector/command/defaults/OffhandCommand.java index 47ca821b9..ea6062063 100644 --- a/connector/src/main/java/org/geysermc/connector/command/defaults/OffhandCommand.java +++ b/connector/src/main/java/org/geysermc/connector/command/defaults/OffhandCommand.java @@ -26,8 +26,8 @@ package org.geysermc.connector.command.defaults; import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerAction; -import com.github.steveice10.mc.protocol.data.game.world.block.BlockFace; -import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerActionPacket; +import com.github.steveice10.mc.protocol.data.game.level.block.BlockFace; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerActionPacket; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.command.CommandSender; import org.geysermc.connector.command.GeyserCommand; @@ -46,7 +46,7 @@ public class OffhandCommand extends GeyserCommand { return; } - ClientPlayerActionPacket releaseItemPacket = new ClientPlayerActionPacket(PlayerAction.SWAP_HANDS, BlockUtils.POSITION_ZERO, + ServerboundPlayerActionPacket releaseItemPacket = new ServerboundPlayerActionPacket(PlayerAction.SWAP_HANDS, BlockUtils.POSITION_ZERO, BlockFace.DOWN); session.sendDownstreamPacket(releaseItemPacket); } diff --git a/connector/src/main/java/org/geysermc/connector/command/defaults/StatisticsCommand.java b/connector/src/main/java/org/geysermc/connector/command/defaults/StatisticsCommand.java index 3502941d5..7c2c13816 100644 --- a/connector/src/main/java/org/geysermc/connector/command/defaults/StatisticsCommand.java +++ b/connector/src/main/java/org/geysermc/connector/command/defaults/StatisticsCommand.java @@ -26,7 +26,7 @@ package org.geysermc.connector.command.defaults; import com.github.steveice10.mc.protocol.data.game.ClientRequest; -import com.github.steveice10.mc.protocol.packet.ingame.client.ClientRequestPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientCommandPacket; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.command.CommandSender; import org.geysermc.connector.command.GeyserCommand; @@ -43,8 +43,8 @@ public class StatisticsCommand extends GeyserCommand { if (session == null) return; session.setWaitingForStatistics(true); - ClientRequestPacket clientRequestPacket = new ClientRequestPacket(ClientRequest.STATS); - session.sendDownstreamPacket(clientRequestPacket); + ServerboundClientCommandPacket ServerboundClientCommandPacket = new ServerboundClientCommandPacket(ClientRequest.STATS); + session.sendDownstreamPacket(ServerboundClientCommandPacket); } @Override diff --git a/connector/src/main/java/org/geysermc/connector/entity/AreaEffectCloudEntity.java b/connector/src/main/java/org/geysermc/connector/entity/AreaEffectCloudEntity.java index 218275ae8..48283818e 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/AreaEffectCloudEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/AreaEffectCloudEntity.java @@ -26,7 +26,7 @@ package org.geysermc.connector.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; -import com.github.steveice10.mc.protocol.data.game.world.particle.Particle; +import com.github.steveice10.mc.protocol.data.game.level.particle.Particle; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; diff --git a/connector/src/main/java/org/geysermc/connector/entity/BoatEntity.java b/connector/src/main/java/org/geysermc/connector/entity/BoatEntity.java index 4cc9fea0e..369b86a8e 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/BoatEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/BoatEntity.java @@ -72,7 +72,7 @@ public class BoatEntity extends Entity { MoveEntityAbsolutePacket moveEntityPacket = new MoveEntityAbsolutePacket(); moveEntityPacket.setRuntimeEntityId(geyserId); - // Minimal glitching when ServerVehicleMovePacket is sent + // Minimal glitching when ClientboundMoveVehiclePacket is sent moveEntityPacket.setPosition(session.getRidingVehicleEntity() == this ? position.up(EntityType.PLAYER.getOffset() - this.entityType.getOffset()) : this.position); moveEntityPacket.setRotation(getBedrockRotation()); moveEntityPacket.setOnGround(isOnGround); diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/ShulkerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/ShulkerEntity.java index 142c0012b..2402e4330 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/ShulkerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/ShulkerEntity.java @@ -26,7 +26,7 @@ package org.geysermc.connector.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; -import com.github.steveice10.mc.protocol.data.game.world.block.BlockFace; +import com.github.steveice10.mc.protocol.data.game.level.block.BlockFace; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 6a357251b..949b0937a 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -40,12 +40,12 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.recipe.Recipe; import com.github.steveice10.mc.protocol.data.game.statistic.Statistic; -import com.github.steveice10.mc.protocol.packet.handshake.client.HandshakePacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerAbilitiesPacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerPositionPacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerPositionRotationPacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.world.ClientTeleportConfirmPacket; -import com.github.steveice10.mc.protocol.packet.login.client.LoginPluginResponsePacket; +import com.github.steveice10.mc.protocol.packet.handshake.serverbound.ClientIntentionPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerAbilitiesPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosRotPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundAcceptTeleportationPacket; +import com.github.steveice10.mc.protocol.packet.login.serverbound.ServerboundCustomQueryPacket; import com.github.steveice10.packetlib.BuiltinFlags; import com.github.steveice10.packetlib.event.session.*; import com.github.steveice10.packetlib.packet.Packet; @@ -376,7 +376,7 @@ public class GeyserSession implements CommandSender { private long lastMovementTimestamp = System.currentTimeMillis(); /** - * Used to send a ClientVehicleMovePacket for every PlayerInputPacket after idling on a boat/horse for more than 100ms + * Used to send a ServerboundMoveVehiclePacket for every PlayerInputPacket after idling on a boat/horse for more than 100ms */ @Setter private long lastVehicleMoveTimestamp = System.currentTimeMillis(); @@ -737,7 +737,7 @@ public class GeyserSession implements CommandSender { @Override public void packetSending(PacketSendingEvent event) { //todo move this somewhere else - if (event.getPacket() instanceof HandshakePacket) { + if (event.getPacket() instanceof ClientIntentionPacket) { String addressSuffix; if (floodgate) { byte[] encryptedData; @@ -778,21 +778,16 @@ public class GeyserSession implements CommandSender { addressSuffix = ""; } - HandshakePacket handshakePacket = event.getPacket(); + ClientIntentionPacket intentionPacket = event.getPacket(); String address; if (connector.getConfig().getRemote().isForwardHost()) { address = clientData.getServerAddress().split(":")[0]; } else { - address = handshakePacket.getHostname(); + address = intentionPacket.getHostname(); } - event.setPacket(new HandshakePacket( - handshakePacket.getProtocolVersion(), - address + addressSuffix, - handshakePacket.getPort(), - handshakePacket.getIntent() - )); + event.setPacket(intentionPacket.withHostname(address + addressSuffix)); } } @@ -963,7 +958,7 @@ public class GeyserSession implements CommandSender { Vector3d position = collisionManager.adjustBedrockPosition(playerEntity.getPosition(), playerEntity.isOnGround(), false); // A null return value cancels the packet if (position != null) { - ClientPlayerPositionPacket packet = new ClientPlayerPositionPacket(playerEntity.isOnGround(), + ServerboundMovePlayerPosPacket packet = new ServerboundMovePlayerPosPacket(playerEntity.isOnGround(), position.getX(), position.getY(), position.getZ()); sendDownstreamPacket(packet); } @@ -1242,10 +1237,10 @@ public class GeyserSession implements CommandSender { TeleportCache entry = it.next().getValue(); int nextID = entry.getTeleportConfirmId(); if (nextID <= teleportID) { - ClientTeleportConfirmPacket teleportConfirmPacket = new ClientTeleportConfirmPacket(nextID); + ServerboundAcceptTeleportationPacket teleportConfirmPacket = new ServerboundAcceptTeleportationPacket(nextID); sendDownstreamPacket(teleportConfirmPacket); // Servers (especially ones like Hypixel) expect exact coordinates given back to them. - ClientPlayerPositionRotationPacket positionPacket = new ClientPlayerPositionRotationPacket(playerEntity.isOnGround(), + ServerboundMovePlayerPosRotPacket positionPacket = new ServerboundMovePlayerPosRotPacket(playerEntity.isOnGround(), entry.getX(), entry.getY(), entry.getZ(), entry.getYaw(), entry.getPitch()); sendDownstreamPacket(positionPacket); it.remove(); @@ -1320,7 +1315,7 @@ public class GeyserSession implements CommandSender { } private void sendDownstreamPacket0(Packet packet) { - if (protocol.getSubProtocol().equals(SubProtocol.GAME) || packet.getClass() == LoginPluginResponsePacket.class) { + if (protocol.getSubProtocol().equals(SubProtocol.GAME) || packet.getClass() == ServerboundCustomQueryPacket.class) { downstream.send(packet); } else { connector.getLogger().debug("Tried to send downstream packet " + packet.getClass().getSimpleName() + " before connected to the server"); @@ -1400,7 +1395,7 @@ public class GeyserSession implements CommandSender { if (spectator && !flying) { // We're "flying locked" in this gamemode flying = true; - ClientPlayerAbilitiesPacket abilitiesPacket = new ClientPlayerAbilitiesPacket(true); + ServerboundPlayerAbilitiesPacket abilitiesPacket = new ServerboundPlayerAbilitiesPacket(true); sendDownstreamPacket(abilitiesPacket); } flags.add(AdventureSetting.FLYING); diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/AdvancementsCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/AdvancementsCache.java index 98ec5b262..8831e140c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/AdvancementsCache.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/AdvancementsCache.java @@ -26,7 +26,7 @@ package org.geysermc.connector.network.session.cache; import com.github.steveice10.mc.protocol.data.game.advancement.Advancement; -import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientAdvancementTabPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundSeenAdvancementsPacket; import lombok.Getter; import lombok.Setter; import org.geysermc.connector.network.session.GeyserSession; @@ -113,7 +113,7 @@ public class AdvancementsCache { buildAndShowListForm(); } else { // Send a packet indicating that we intend to open this particular advancement window - ClientAdvancementTabPacket packet = new ClientAdvancementTabPacket(id); + ServerboundSeenAdvancementsPacket packet = new ServerboundSeenAdvancementsPacket(id); session.sendDownstreamPacket(packet); // Wait for a response there } @@ -152,7 +152,7 @@ public class AdvancementsCache { SimpleFormResponse response = form.parseResponse(responseData); if (!response.isCorrect()) { // Indicate that we have closed the current advancement tab - session.sendDownstreamPacket(new ClientAdvancementTabPacket()); + session.sendDownstreamPacket(new ServerboundSeenAdvancementsPacket()); return; } @@ -176,7 +176,7 @@ public class AdvancementsCache { } else { buildAndShowMenuForm(); // Indicate that we have closed the current advancement tab - session.sendDownstreamPacket(new ClientAdvancementTabPacket()); + session.sendDownstreamPacket(new ServerboundSeenAdvancementsPacket()); } }); diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/BookEditCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/BookEditCache.java index d2ee8f552..193a1d41a 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/BookEditCache.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/BookEditCache.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.session.cache; -import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientEditBookPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundEditBookPacket; import lombok.Setter; import org.geysermc.connector.inventory.GeyserItemStack; import org.geysermc.connector.network.session.GeyserSession; @@ -39,7 +39,7 @@ import org.geysermc.connector.network.session.GeyserSession; public class BookEditCache { private final GeyserSession session; @Setter - private ClientEditBookPacket packet; + private ServerboundEditBookPacket packet; /** * Stores the last time a book update packet was sent to the server. */ diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/TagCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/TagCache.java index e10e4dad5..221ab36c3 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/TagCache.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/TagCache.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.session.cache; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerDeclareTagsPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundUpdateTagsPacket; import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.ints.IntLists; import org.geysermc.connector.registry.type.BlockMapping; @@ -34,7 +34,7 @@ import org.geysermc.connector.registry.type.ItemMapping; import java.util.Map; /** - * Manages information sent from the {@link ServerDeclareTagsPacket}. If that packet is not sent, all lists here + * Manages information sent from the {@link ClientboundUpdateTagsPacket}. If that packet is not sent, all lists here * will remain empty, matching Java Edition behavior. */ public class TagCache { @@ -61,7 +61,7 @@ public class TagCache { clear(); } - public void loadPacket(ServerDeclareTagsPacket packet) { + public void loadPacket(ClientboundUpdateTagsPacket packet) { Map blockTags = packet.getTags().get("minecraft:block"); this.leaves = IntList.of(blockTags.get("minecraft:leaves")); this.wool = IntList.of(blockTags.get("minecraft:wool")); diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/TeleportCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/TeleportCache.java index 17b96aeb1..6f40481db 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/TeleportCache.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/TeleportCache.java @@ -33,7 +33,7 @@ import lombok.RequiredArgsConstructor; * Represents a teleport ID and corresponding coordinates that need to be confirmed.
* * The vanilla Java client, after getting a - * {@link com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket}, + * {@link com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerPositionPacket}, * adjusts the player's positions and immediately sends a teleport back. However, we want to acknowledge that the * Bedrock player actually moves close to that point, so we store the teleport until we get a movement packet from * Bedrock that the teleport was successful. diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java b/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java index 56735f98d..d86830d20 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java @@ -25,8 +25,8 @@ package org.geysermc.connector.network.translators; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerPlayerListDataPacket; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerUpdateLightPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundTabListPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLightUpdatePacket; import com.github.steveice10.packetlib.packet.Packet; import com.nukkitx.protocol.bedrock.BedrockPacket; import io.netty.channel.EventLoop; @@ -73,8 +73,8 @@ public class PacketTranslatorRegistry { } } - IGNORED_PACKETS.add(ServerUpdateLightPacket.class); // Light is handled on Bedrock for us - IGNORED_PACKETS.add(ServerPlayerListDataPacket.class); // Cant be implemented in bedrock + IGNORED_PACKETS.add(ClientboundLightUpdatePacket.class); // Light is handled on Bedrock for us + IGNORED_PACKETS.add(ClientboundTabListPacket.class); // Cant be implemented in Bedrock } private PacketTranslatorRegistry() { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAdventureSettingsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAdventureSettingsTranslator.java index a9ae9db6d..8a978fac3 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAdventureSettingsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAdventureSettingsTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.connector.network.translators.bedrock; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; -import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerAbilitiesPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerAbilitiesPacket; import com.nukkitx.protocol.bedrock.data.AdventureSetting; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.AdventureSettingsPacket; @@ -47,7 +47,7 @@ public class BedrockAdventureSettingsTranslator extends PacketTranslator { case SWING_ARM -> // Delay so entity damage can be processed first session.scheduleInEventLoop(() -> - session.sendDownstreamPacket(new ClientPlayerSwingArmPacket(Hand.MAIN_HAND)), + session.sendDownstreamPacket(new ServerboundSwingPacket(Hand.MAIN_HAND)), 25, TimeUnit.MILLISECONDS ); @@ -57,12 +57,12 @@ public class BedrockAnimateTranslator extends PacketTranslator { case ROW_LEFT -> { // Packet value is a float of how long one has been rowing, so we convert that into a boolean session.setSteeringLeft(packet.getRowingTime() > 0.0); - ClientSteerBoatPacket steerLeftPacket = new ClientSteerBoatPacket(session.isSteeringLeft(), session.isSteeringRight()); + ServerboundPaddleBoatPacket steerLeftPacket = new ServerboundPaddleBoatPacket(session.isSteeringLeft(), session.isSteeringRight()); session.sendDownstreamPacket(steerLeftPacket); } case ROW_RIGHT -> { session.setSteeringRight(packet.getRowingTime() > 0.0); - ClientSteerBoatPacket steerRightPacket = new ClientSteerBoatPacket(session.isSteeringLeft(), session.isSteeringRight()); + ServerboundPaddleBoatPacket steerRightPacket = new ServerboundPaddleBoatPacket(session.isSteeringLeft(), session.isSteeringRight()); session.sendDownstreamPacket(steerRightPacket); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockEntityDataTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockEntityDataTranslator.java index a5575bb82..6f94085ae 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockEntityDataTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockEntityDataTranslator.java @@ -26,8 +26,8 @@ package org.geysermc.connector.network.translators.bedrock; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; -import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientUpdateJigsawBlockPacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.world.ClientUpdateSignPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundSetJigsawBlockPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundSignUpdatePacket; import com.nukkitx.nbt.NbtMap; import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; import org.geysermc.connector.network.session.GeyserSession; @@ -105,8 +105,8 @@ public class BedrockBlockEntityDataTranslator extends PacketTranslator title = null; } - session.getBookEditCache().setPacket(new ClientEditBookPacket(session.getPlayerInventory().getHeldItemSlot(), networkPages, title)); + session.getBookEditCache().setPacket(new ServerboundEditBookPacket(session.getPlayerInventory().getHeldItemSlot(), networkPages, title)); // There won't be any more book updates after this, so we can try sending the edit packet immediately if (packet.getAction() == BookEditPacket.Action.SIGN_BOOK) { session.getBookEditCache().checkForSend(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java index 4a87776b1..a64e9c784 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java @@ -26,9 +26,9 @@ package org.geysermc.connector.network.translators.bedrock; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; -import com.github.steveice10.mc.protocol.data.game.world.block.CommandBlockMode; -import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientUpdateCommandBlockMinecartPacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientUpdateCommandBlockPacket; +import com.github.steveice10.mc.protocol.data.game.level.block.CommandBlockMode; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundSetCommandMinecartPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundSetCommandBlockPacket; import com.nukkitx.protocol.bedrock.packet.CommandBlockUpdatePacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; @@ -52,12 +52,12 @@ public class BedrockCommandBlockUpdateTranslator extends PacketTranslator 1; - ClientPlayerActionPacket dropAllPacket = new ClientPlayerActionPacket( + ServerboundPlayerActionPacket dropAllPacket = new ServerboundPlayerActionPacket( dropAll ? PlayerAction.DROP_ITEM_STACK : PlayerAction.DROP_ITEM, BlockUtils.POSITION_ZERO, BlockFace.DOWN @@ -128,9 +128,9 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator { - ClientPlayerUseItemPacket itemPacket = new ClientPlayerUseItemPacket(Hand.MAIN_HAND); + ServerboundUseItemPacket itemPacket = new ServerboundUseItemPacket(Hand.MAIN_HAND); session.sendDownstreamPacket(itemPacket); }, 5, TimeUnit.MILLISECONDS)); } @@ -280,7 +280,7 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator { @@ -317,7 +317,7 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator currentJavaPage) { for (int i = currentJavaPage; i < newJavaPage; i++) { - ClientClickWindowButtonPacket clickButtonPacket = new ClientClickWindowButtonPacket(session.getOpenInventory().getId(), 2); + ServerboundContainerButtonClickPacket clickButtonPacket = new ServerboundContainerButtonClickPacket(session.getOpenInventory().getId(), 2); session.sendDownstreamPacket(clickButtonPacket); } } else { for (int i = currentJavaPage; i > newJavaPage; i--) { - ClientClickWindowButtonPacket clickButtonPacket = new ClientClickWindowButtonPacket(session.getOpenInventory().getId(), 1); + ServerboundContainerButtonClickPacket clickButtonPacket = new ServerboundContainerButtonClickPacket(session.getOpenInventory().getId(), 1); session.sendDownstreamPacket(clickButtonPacket); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMobEquipmentTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMobEquipmentTranslator.java index 4e53e0c4e..26dd340f6 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMobEquipmentTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMobEquipmentTranslator.java @@ -26,8 +26,8 @@ package org.geysermc.connector.network.translators.bedrock; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; -import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerChangeHeldItemPacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerUseItemPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundSetCarriedItemPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundUseItemPacket; import com.nukkitx.protocol.bedrock.data.inventory.ContainerId; import com.nukkitx.protocol.bedrock.packet.MobEquipmentPacket; import org.geysermc.connector.network.session.GeyserSession; @@ -54,14 +54,14 @@ public class BedrockMobEquipmentTranslator extends PacketTranslator session.sendDownstreamPacket(new ClientPlayerUseItemPacket(Hand.MAIN_HAND)), + session.getConnector().getGeneralThreadPool().schedule(() -> session.sendDownstreamPacket(new ServerboundUseItemPacket(Hand.MAIN_HAND)), 50, TimeUnit.MILLISECONDS); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMoveEntityAbsoluteTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMoveEntityAbsoluteTranslator.java index 6b3ad4467..b1e894d0a 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMoveEntityAbsoluteTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMoveEntityAbsoluteTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.bedrock; -import com.github.steveice10.mc.protocol.packet.ingame.client.world.ClientVehicleMovePacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundMoveVehiclePacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket; import org.geysermc.connector.entity.BoatEntity; @@ -66,10 +66,10 @@ public class BedrockMoveEntityAbsoluteTranslator extends PacketTranslator 0) { if (session.getConnector().getConfig().isForwardPlayerPing()) { - ClientKeepAlivePacket keepAlivePacket = new ClientKeepAlivePacket(pingId); + ServerboundKeepAlivePacket keepAlivePacket = new ServerboundKeepAlivePacket(pingId); session.sendDownstreamPacket(keepAlivePacket); } return; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPlayerInputTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPlayerInputTranslator.java index 27289b5d2..8cc7568b5 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPlayerInputTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPlayerInputTranslator.java @@ -25,8 +25,8 @@ package org.geysermc.connector.network.translators.bedrock; -import com.github.steveice10.mc.protocol.packet.ingame.client.world.ClientSteerVehiclePacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.world.ClientVehicleMovePacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundPlayerInputPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundMoveVehiclePacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.packet.PlayerInputPacket; @@ -47,11 +47,11 @@ public class BedrockPlayerInputTranslator extends PacketTranslator { session.sendUpstreamPacket(movePlayerPacket); } - ClientRequestPacket javaRespawnPacket = new ClientRequestPacket(ClientRequest.RESPAWN); + ServerboundClientCommandPacket javaRespawnPacket = new ServerboundClientCommandPacket(ClientRequest.RESPAWN); session.sendDownstreamPacket(javaRespawnPacket); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockShowCreditsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockShowCreditsTranslator.java index 0252817ef..8feadb180 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockShowCreditsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockShowCreditsTranslator.java @@ -30,7 +30,7 @@ import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import com.github.steveice10.mc.protocol.data.game.ClientRequest; -import com.github.steveice10.mc.protocol.packet.ingame.client.ClientRequestPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientCommandPacket; import com.nukkitx.protocol.bedrock.packet.ShowCreditsPacket; @Translator(packet = ShowCreditsPacket.class) @@ -39,7 +39,7 @@ public class BedrockShowCreditsTranslator extends PacketTranslator { return; } - ClientChatPacket chatPacket = new ClientChatPacket(message); + ServerboundChatPacket chatPacket = new ServerboundChatPacket(message); session.sendDownstreamPacket(chatPacket); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java index ae2acc21b..7b19dee44 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.connector.network.translators.bedrock.entity; import com.github.steveice10.mc.protocol.data.game.window.VillagerTrade; -import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientSelectTradePacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundSelectTradePacket; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; import org.geysermc.connector.entity.Entity; @@ -51,7 +51,7 @@ public class BedrockEntityEventTranslator extends PacketTranslator { - ClientSelectTradePacket selectTradePacket = new ClientSelectTradePacket(packet.getData()); + ServerboundSelectTradePacket selectTradePacket = new ServerboundSelectTradePacket(packet.getData()); session.sendDownstreamPacket(selectTradePacket); session.scheduleInEventLoop(() -> { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockActionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockActionTranslator.java index ab652434c..497de45f8 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockActionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockActionTranslator.java @@ -27,8 +27,8 @@ package org.geysermc.connector.network.translators.bedrock.entity.player; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.mc.protocol.data.game.entity.player.*; -import com.github.steveice10.mc.protocol.data.game.world.block.BlockFace; -import com.github.steveice10.mc.protocol.packet.ingame.client.player.*; +import com.github.steveice10.mc.protocol.data.game.level.block.BlockFace; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.*; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.data.LevelEventType; @@ -80,27 +80,27 @@ public class BedrockActionTranslator extends PacketTranslator { public void translate(GeyserSession session, EmotePacket packet) { if (session.getConnector().getConfig().getEmoteOffhandWorkaround() != EmoteOffhandWorkaroundOption.DISABLED) { // Activate the workaround - we should trigger the offhand now - ClientPlayerActionPacket swapHandsPacket = new ClientPlayerActionPacket(PlayerAction.SWAP_HANDS, BlockUtils.POSITION_ZERO, + ServerboundPlayerActionPacket swapHandsPacket = new ServerboundPlayerActionPacket(PlayerAction.SWAP_HANDS, BlockUtils.POSITION_ZERO, BlockFace.DOWN); session.sendDownstreamPacket(swapHandsPacket); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockInteractTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockInteractTranslator.java index cb101c231..9a307d076 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockInteractTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockInteractTranslator.java @@ -28,8 +28,8 @@ package org.geysermc.connector.network.translators.bedrock.entity.player; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.InteractAction; import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerState; -import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerInteractEntityPacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerStatePacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundInteractPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerCommandPacket; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; @@ -62,17 +62,17 @@ public class BedrockInteractTranslator extends PacketTranslator if (session.getPlayerInventory().getItemInHand().getJavaId() == session.getItemMappings().getStoredItems().shield().getJavaId()) { break; } - ClientPlayerInteractEntityPacket interactPacket = new ClientPlayerInteractEntityPacket((int) entity.getEntityId(), + ServerboundInteractPacket interactPacket = new ServerboundInteractPacket((int) entity.getEntityId(), InteractAction.INTERACT, Hand.MAIN_HAND, session.isSneaking()); session.sendDownstreamPacket(interactPacket); break; case DAMAGE: - ClientPlayerInteractEntityPacket attackPacket = new ClientPlayerInteractEntityPacket((int) entity.getEntityId(), + ServerboundInteractPacket attackPacket = new ServerboundInteractPacket((int) entity.getEntityId(), InteractAction.ATTACK, Hand.MAIN_HAND, session.isSneaking()); session.sendDownstreamPacket(attackPacket); break; case LEAVE_VEHICLE: - ClientPlayerStatePacket sneakPacket = new ClientPlayerStatePacket((int) entity.getEntityId(), PlayerState.START_SNEAKING); + ServerboundPlayerCommandPacket sneakPacket = new ServerboundPlayerCommandPacket((int) entity.getEntityId(), PlayerState.START_SNEAKING); session.sendDownstreamPacket(sneakPacket); session.setRidingVehicleEntity(null); break; @@ -101,7 +101,7 @@ public class BedrockInteractTranslator extends PacketTranslator if (ridingEntity instanceof AbstractHorseEntity) { if (ridingEntity.getMetadata().getFlags().getFlag(EntityFlag.TAMED)) { // We should request to open the horse inventory instead - ClientPlayerStatePacket openHorseWindowPacket = new ClientPlayerStatePacket((int) session.getPlayerEntity().getEntityId(), PlayerState.OPEN_HORSE_INVENTORY); + ServerboundPlayerCommandPacket openHorseWindowPacket = new ServerboundPlayerCommandPacket((int) session.getPlayerEntity().getEntityId(), PlayerState.OPEN_HORSE_INVENTORY); session.sendDownstreamPacket(openHorseWindowPacket); } } else { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java index fb7979afd..85d3a945e 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java @@ -25,9 +25,9 @@ package org.geysermc.connector.network.translators.bedrock.entity.player; -import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerPositionPacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerPositionRotationPacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerRotationPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosRotPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerRotPacket; import com.github.steveice10.packetlib.packet.Packet; import com.nukkitx.math.vector.Vector3d; import com.nukkitx.math.vector.Vector3f; @@ -81,7 +81,7 @@ public class BedrockMovePlayerTranslator extends PacketTranslator { +@Translator(packet = ClientboundSelectAdvancementsTabPacket.class) +public class JavaAdvancementsTabTranslator extends PacketTranslator { + @Override - public void translate(GeyserSession session, ServerAdvancementTabPacket packet) { + public void translate(GeyserSession session, ClientboundSelectAdvancementsTabPacket packet) { AdvancementsCache advancementsCache = session.getAdvancementsCache(); advancementsCache.setCurrentAdvancementCategoryId(packet.getTabId()); advancementsCache.buildAndShowListForm(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaAdvancementsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaAdvancementsTranslator.java index 01de50c21..46aac1212 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaAdvancementsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaAdvancementsTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.connector.network.translators.java; import com.github.steveice10.mc.protocol.data.game.advancement.Advancement; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerAdvancementsPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundUpdateAdvancementsPacket; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; @@ -38,11 +38,11 @@ import org.geysermc.connector.utils.LocaleUtils; import java.util.Map; -@Translator(packet = ServerAdvancementsPacket.class) -public class JavaAdvancementsTranslator extends PacketTranslator { +@Translator(packet = ClientboundUpdateAdvancementsPacket.class) +public class JavaAdvancementsTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerAdvancementsPacket packet) { + public void translate(GeyserSession session, ClientboundUpdateAdvancementsPacket packet) { AdvancementsCache advancementsCache = session.getAdvancementsCache(); if (packet.isReset()) { advancementsCache.getStoredAdvancements().clear(); @@ -72,7 +72,7 @@ public class JavaAdvancementsTranslator extends PacketTranslator { +@Translator(packet = ClientboundBossEventPacket.class) +public class JavaBossBarTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerBossBarPacket packet) { + public void translate(GeyserSession session, ClientboundBossEventPacket packet) { BossBar bossBar = session.getEntityCache().getBossBar(packet.getUuid()); switch (packet.getAction()) { case ADD: diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaChatTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaChatTranslator.java index 57e473267..0b6683f8b 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaChatTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaChatTranslator.java @@ -25,18 +25,18 @@ package org.geysermc.connector.network.translators.java; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerChatPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundChatPacket; import com.nukkitx.protocol.bedrock.packet.TextPacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.chat.MessageTranslator; -@Translator(packet = ServerChatPacket.class) -public class JavaChatTranslator extends PacketTranslator { +@Translator(packet = ClientboundChatPacket.class) +public class JavaChatTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerChatPacket packet) { + public void translate(GeyserSession session, ClientboundChatPacket packet) { TextPacket textPacket = new TextPacket(); textPacket.setPlatformChatId(""); textPacket.setSourceName(""); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java index 92dc83c37..61e8be4a5 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.connector.network.translators.java; import com.github.steveice10.mc.protocol.data.game.command.CommandNode; import com.github.steveice10.mc.protocol.data.game.command.CommandParser; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerDeclareCommandsPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundCommandsPacket; import com.nukkitx.protocol.bedrock.data.command.CommandData; import com.nukkitx.protocol.bedrock.data.command.CommandEnumData; import com.nukkitx.protocol.bedrock.data.command.CommandParam; @@ -53,8 +53,8 @@ import org.geysermc.connector.utils.EntityUtils; import java.util.*; -@Translator(packet = ServerDeclareCommandsPacket.class) -public class JavaDeclareCommandsTranslator extends PacketTranslator { +@Translator(packet = ClientboundCommandsPacket.class) +public class JavaDeclareCommandsTranslator extends PacketTranslator { private static final String[] ALL_EFFECT_IDENTIFIERS = EntityUtils.getAllEffectIdentifiers(); private static final String[] ENUM_BOOLEAN = {"true", "false"}; @@ -98,7 +98,7 @@ public class JavaDeclareCommandsTranslator extends PacketTranslator { +@Translator(packet = ClientboundUpdateRecipesPacket.class) +public class JavaDeclareRecipesTranslator extends PacketTranslator { /** * Required to use the specified cartography table recipes */ @@ -71,7 +71,7 @@ public class JavaDeclareRecipesTranslator extends PacketTranslator> recipeTypes = Registries.CRAFTING_DATA.forVersion(session.getUpstream().getProtocolVersion()); // Get the last known network ID (first used for the pregenerated recipes) and increment from there. int netId = InventoryUtils.LAST_RECIPE_NET_ID + 1; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareTagsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareTagsTranslator.java index c72ab4543..a6c532919 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareTagsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareTagsTranslator.java @@ -25,16 +25,16 @@ package org.geysermc.connector.network.translators.java; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerDeclareTagsPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundUpdateTagsPacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerDeclareTagsPacket.class) -public class JavaDeclareTagsTranslator extends PacketTranslator { +@Translator(packet = ClientboundUpdateTagsPacket.class) +public class JavaDeclareTagsTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerDeclareTagsPacket packet) { + public void translate(GeyserSession session, ClientboundUpdateTagsPacket packet) { session.getTagCache().loadPacket(packet); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDifficultyTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDifficultyTranslator.java index b6299cc35..56c32ca95 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDifficultyTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDifficultyTranslator.java @@ -25,18 +25,17 @@ package org.geysermc.connector.network.translators.java; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundChangeDifficultyPacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; - -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerDifficultyPacket; import com.nukkitx.protocol.bedrock.packet.SetDifficultyPacket; -@Translator(packet = ServerDifficultyPacket.class) -public class JavaDifficultyTranslator extends PacketTranslator { +@Translator(packet = ClientboundChangeDifficultyPacket.class) +public class JavaDifficultyTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerDifficultyPacket packet) { + public void translate(GeyserSession session, ClientboundChangeDifficultyPacket packet) { SetDifficultyPacket setDifficultyPacket = new SetDifficultyPacket(); setDifficultyPacket.setDifficulty(packet.getDifficulty().ordinal()); session.sendUpstreamPacket(setDifficultyPacket); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDisconnectPacket.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDisconnectPacket.java index b5b2e83a3..72a9646fe 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDisconnectPacket.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDisconnectPacket.java @@ -25,17 +25,17 @@ package org.geysermc.connector.network.translators.java; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerDisconnectPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundDisconnectPacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.chat.MessageTranslator; -@Translator(packet = ServerDisconnectPacket.class) -public class JavaDisconnectPacket extends PacketTranslator { +@Translator(packet = ClientboundDisconnectPacket.class) +public class JavaDisconnectPacket extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerDisconnectPacket packet) { + public void translate(GeyserSession session, ClientboundDisconnectPacket packet) { session.disconnect(MessageTranslator.convertMessage(packet.getReason(), session.getLocale())); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginSuccessTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaGameProfileTranslator.java similarity index 88% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginSuccessTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/JavaGameProfileTranslator.java index e3350c5eb..326ad97ac 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginSuccessTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaGameProfileTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.connector.network.translators.java; import com.github.steveice10.mc.auth.data.GameProfile; -import com.github.steveice10.mc.protocol.packet.login.server.LoginSuccessPacket; +import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundGameProfilePacket; import org.geysermc.connector.common.AuthType; import org.geysermc.connector.entity.player.PlayerEntity; import org.geysermc.connector.network.session.GeyserSession; @@ -34,11 +34,11 @@ import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.skin.SkinManager; -@Translator(packet = LoginSuccessPacket.class) -public class JavaLoginSuccessTranslator extends PacketTranslator { +@Translator(packet = ClientboundGameProfilePacket.class) +public class JavaGameProfileTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, LoginSuccessPacket packet) { + public void translate(GeyserSession session, ClientboundGameProfilePacket packet) { PlayerEntity playerEntity = session.getPlayerEntity(); AuthType remoteAuthType = session.getRemoteAuthType(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaJoinGameTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaJoinGameTranslator.java index b0332e23e..932b205a0 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaJoinGameTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaJoinGameTranslator.java @@ -28,9 +28,9 @@ package org.geysermc.connector.network.translators.java; import com.github.steveice10.mc.protocol.data.game.entity.player.HandPreference; import com.github.steveice10.mc.protocol.data.game.setting.ChatVisibility; import com.github.steveice10.mc.protocol.data.game.setting.SkinPart; -import com.github.steveice10.mc.protocol.packet.ingame.client.ClientPluginMessagePacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.ClientSettingsPacket; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundLoginPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientInformationPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCustomPayloadPacket; import com.nukkitx.protocol.bedrock.data.GameRuleData; import com.nukkitx.protocol.bedrock.data.PlayerPermission; import com.nukkitx.protocol.bedrock.packet.*; @@ -47,12 +47,12 @@ import org.geysermc.connector.utils.PluginMessageUtils; import java.util.Arrays; import java.util.List; -@Translator(packet = ServerJoinGamePacket.class) -public class JavaJoinGameTranslator extends PacketTranslator { +@Translator(packet = ClientboundLoginPacket.class) +public class JavaJoinGameTranslator extends PacketTranslator { private static final List SKIN_PART_VALUES = Arrays.asList(SkinPart.values()); @Override - public void translate(GeyserSession session, ServerJoinGamePacket packet) { + public void translate(GeyserSession session, ClientboundLoginPacket packet) { PlayerEntity entity = session.getPlayerEntity(); entity.setEntityId(packet.getEntityId()); @@ -100,14 +100,14 @@ public class JavaJoinGameTranslator extends PacketTranslator { +@Translator(packet = ClientboundKeepAlivePacket.class) +public class JavaKeepAliveTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerKeepAlivePacket packet) { + public void translate(GeyserSession session, ClientboundKeepAlivePacket packet) { if (!session.getConnector().getConfig().isForwardPlayerPing()) { return; } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginDisconnectTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginDisconnectTranslator.java index b596a336d..9773a237a 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginDisconnectTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginDisconnectTranslator.java @@ -25,17 +25,17 @@ package org.geysermc.connector.network.translators.java; -import com.github.steveice10.mc.protocol.packet.login.server.LoginDisconnectPacket; +import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundLoginDisconnectPacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.chat.MessageTranslator; -@Translator(packet = LoginDisconnectPacket.class) -public class JavaLoginDisconnectTranslator extends PacketTranslator { +@Translator(packet = ClientboundLoginDisconnectPacket.class) +public class JavaLoginDisconnectTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, LoginDisconnectPacket packet) { + public void translate(GeyserSession session, ClientboundLoginDisconnectPacket packet) { // The client doesn't manually get disconnected so we have to do it ourselves session.disconnect(MessageTranslator.convertMessage(packet.getReason(), session.getLocale())); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginPluginRequestTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginPluginRequestTranslator.java index 2ed285208..9f734acc4 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginPluginRequestTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginPluginRequestTranslator.java @@ -25,21 +25,20 @@ package org.geysermc.connector.network.translators.java; +import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundCustomQueryPacket; +import com.github.steveice10.mc.protocol.packet.login.serverbound.ServerboundCustomQueryPacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -import com.github.steveice10.mc.protocol.packet.login.client.LoginPluginResponsePacket; -import com.github.steveice10.mc.protocol.packet.login.server.LoginPluginRequestPacket; - -@Translator(packet = LoginPluginRequestPacket.class) -public class JavaLoginPluginRequestTranslator extends PacketTranslator { +@Translator(packet = ClientboundCustomQueryPacket.class) +public class JavaLoginPluginRequestTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, LoginPluginRequestPacket packet) { + public void translate(GeyserSession session, ClientboundCustomQueryPacket packet) { // A vanilla client doesn't know any PluginMessage in the Login state, so we don't know any either. // Note: Fabric Networking API v1 will not let the client log in without sending this session.sendDownstreamPacket( - new LoginPluginResponsePacket(packet.getMessageId(), null) + new ServerboundCustomQueryPacket(packet.getMessageId(), null) ); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPingPacket.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPingPacket.java index c2dc3454d..1d090eb19 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPingPacket.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPingPacket.java @@ -25,18 +25,18 @@ package org.geysermc.connector.network.translators.java; -import com.github.steveice10.mc.protocol.packet.ingame.client.ClientPongPacket; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerPingPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundPongPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundPingPacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; // Why does this packet exist? Whatever, we better implement it -@Translator(packet = ServerPingPacket.class) -public class JavaPingPacket extends PacketTranslator { +@Translator(packet = ClientboundPingPacket.class) +public class JavaPingPacket extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerPingPacket packet) { - session.sendDownstreamPacket(new ClientPongPacket(packet.getId())); + public void translate(GeyserSession session, ClientboundPingPacket packet) { + session.sendDownstreamPacket(new ServerboundPongPacket(packet.getId())); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java index 6b49c764b..2b5926b2c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java @@ -25,8 +25,8 @@ package org.geysermc.connector.network.translators.java; -import com.github.steveice10.mc.protocol.packet.ingame.client.ClientPluginMessagePacket; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerPluginMessagePacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCustomPayloadPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundCustomPayloadPacket; import com.google.common.base.Charsets; import com.nukkitx.protocol.bedrock.packet.TransferPacket; import org.geysermc.connector.GeyserConnector; @@ -41,12 +41,12 @@ import org.geysermc.cumulus.util.FormType; import java.nio.charset.StandardCharsets; -@Translator(packet = ServerPluginMessagePacket.class) -public class JavaPluginMessageTranslator extends PacketTranslator { +@Translator(packet = ClientboundCustomPayloadPacket.class) +public class JavaPluginMessageTranslator extends PacketTranslator { private final GeyserLogger logger = GeyserConnector.getInstance().getLogger(); @Override - public void translate(GeyserSession session, ServerPluginMessagePacket packet) { + public void translate(GeyserSession session, ClientboundCustomPayloadPacket packet) { // The only plugin messages it has to listen for are Floodgate plugin messages if (session.getRemoteAuthType() != AuthType.FLOODGATE) { return; @@ -77,7 +77,7 @@ public class JavaPluginMessageTranslator extends PacketTranslator { +@Translator(packet = ClientboundRecipePacket.class) +public class JavaRecipeTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerUnlockRecipesPacket packet) { + public void translate(GeyserSession session, ClientboundRecipePacket packet) { if (packet.getAction() == UnlockRecipesAction.REMOVE) { session.getUnlockedRecipes().removeAll(Arrays.asList(packet.getRecipes())); } else { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaRespawnTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaRespawnTranslator.java index 0b9d16827..0ae81482c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaRespawnTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaRespawnTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.java; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerRespawnPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundRespawnPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; @@ -39,11 +39,11 @@ import org.geysermc.connector.network.translators.inventory.InventoryTranslator; import org.geysermc.connector.utils.ChunkUtils; import org.geysermc.connector.utils.DimensionUtils; -@Translator(packet = ServerRespawnPacket.class) -public class JavaRespawnTranslator extends PacketTranslator { +@Translator(packet = ClientboundRespawnPacket.class) +public class JavaRespawnTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerRespawnPacket packet) { + public void translate(GeyserSession session, ClientboundRespawnPacket packet) { SessionPlayerEntity entity = session.getPlayerEntity(); entity.setHealth(entity.getMaxHealth()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaStatisticsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaStatisticsTranslator.java index 15c6452ed..69a82efe0 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaStatisticsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaStatisticsTranslator.java @@ -25,17 +25,17 @@ package org.geysermc.connector.network.translators.java; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerStatisticsPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundAwardStatsPacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.utils.StatisticsUtils; -@Translator(packet = ServerStatisticsPacket.class) -public class JavaStatisticsTranslator extends PacketTranslator { +@Translator(packet = ClientboundAwardStatsPacket.class) +public class JavaStatisticsTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerStatisticsPacket packet) { + public void translate(GeyserSession session, ClientboundAwardStatsPacket packet) { session.updateStatistics(packet.getStatistics()); if (session.isWaitingForStatistics()) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityAnimationTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityAnimationTranslator.java index 57bacc658..95a1628df 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityAnimationTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityAnimationTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.java.entity; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityAnimationPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundAnimatePacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.AnimateEntityPacket; import com.nukkitx.protocol.bedrock.packet.AnimatePacket; @@ -36,11 +36,11 @@ import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.utils.DimensionUtils; -@Translator(packet = ServerEntityAnimationPacket.class) -public class JavaEntityAnimationTranslator extends PacketTranslator { +@Translator(packet = ClientboundAnimatePacket.class) +public class JavaEntityAnimationTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerEntityAnimationPacket packet) { + public void translate(GeyserSession session, ClientboundAnimatePacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); @@ -56,7 +56,7 @@ public class JavaEntityAnimationTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetEntityLinkPacket.class) +public class JavaEntityAttachTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerEntityAttachPacket packet) { + public void translate(GeyserSession session, ClientboundSetEntityLinkPacket packet) { Entity holderId; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityCollectItemTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityCollectItemTranslator.java index 70b93472f..8bc497b8d 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityCollectItemTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityCollectItemTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.java.entity; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityCollectItemPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundTakeItemEntityPacket; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; import com.nukkitx.protocol.bedrock.packet.TakeItemEntityPacket; @@ -40,11 +40,11 @@ import org.geysermc.connector.network.translators.Translator; * In Java, this is called for item entities, experience orbs and arrows * Bedrock uses it for arrows and item entities, but not experience orbs. */ -@Translator(packet = ServerEntityCollectItemPacket.class) -public class JavaEntityCollectItemTranslator extends PacketTranslator { +@Translator(packet = ClientboundTakeItemEntityPacket.class) +public class JavaEntityCollectItemTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerEntityCollectItemPacket packet) { + public void translate(GeyserSession session, ClientboundTakeItemEntityPacket packet) { // Collected entity is the other entity Entity collectedEntity = session.getEntityCache().getEntityByJavaId(packet.getCollectedEntityId()); if (collectedEntity == null) return; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEffectTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEffectTranslator.java index d99b11a49..3e8c056cb 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEffectTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEffectTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.java.entity; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityEffectPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundUpdateMobEffectPacket; import com.nukkitx.protocol.bedrock.packet.MobEffectPacket; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.network.session.GeyserSession; @@ -33,11 +33,11 @@ import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.utils.EntityUtils; -@Translator(packet = ServerEntityEffectPacket.class) -public class JavaEntityEffectTranslator extends PacketTranslator { +@Translator(packet = ClientboundUpdateMobEffectPacket.class) +public class JavaEntityEffectTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerEntityEffectPacket packet) { + public void translate(GeyserSession session, ClientboundUpdateMobEffectPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEquipmentTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEquipmentTranslator.java index f297f1a38..3df6df2b0 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEquipmentTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEquipmentTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.connector.network.translators.java.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Equipment; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityEquipmentPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundSetEquipmentPacket; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.LivingEntity; @@ -35,11 +35,11 @@ import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.item.ItemTranslator; -@Translator(packet = ServerEntityEquipmentPacket.class) -public class JavaEntityEquipmentTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetEquipmentPacket.class) +public class JavaEntityEquipmentTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerEntityEquipmentPacket packet) { + public void translate(GeyserSession session, ClientboundSetEquipmentPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityHeadLookTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityHeadLookTranslator.java index 5120e8c3a..97a4f16d5 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityHeadLookTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityHeadLookTranslator.java @@ -25,20 +25,22 @@ package org.geysermc.connector.network.translators.java.entity; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityHeadLookPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundRotateHeadPacket; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerEntityHeadLookPacket.class) -public class JavaEntityHeadLookTranslator extends PacketTranslator { +@Translator(packet = ClientboundRotateHeadPacket.class) +public class JavaEntityHeadLookTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerEntityHeadLookPacket packet) { - Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId()); + public void translate(GeyserSession session, ClientboundRotateHeadPacket packet) { + Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); + } else { + entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId()); } if (entity == null) return; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityMetadataTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityMetadataTranslator.java index 02ec44ad1..d55a4e747 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityMetadataTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityMetadataTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.connector.network.translators.java.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityMetadataPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundSetEntityDataPacket; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; @@ -34,11 +34,11 @@ import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.utils.InteractiveTagManager; import org.geysermc.connector.utils.LanguageUtils; -@Translator(packet = ServerEntityMetadataPacket.class) -public class JavaEntityMetadataTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetEntityDataPacket.class) +public class JavaEntityMetadataTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerEntityMetadataPacket packet) { + public void translate(GeyserSession session, ClientboundSetEntityDataPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPositionRotationTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPositionRotationTranslator.java index 733725936..419010a2f 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPositionRotationTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPositionRotationTranslator.java @@ -25,17 +25,17 @@ package org.geysermc.connector.network.translators.java.entity; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityPositionRotationPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundMoveEntityPosRotPacket; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerEntityPositionRotationPacket.class) -public class JavaEntityPositionRotationTranslator extends PacketTranslator { +@Translator(packet = ClientboundMoveEntityPosRotPacket.class) +public class JavaEntityPositionRotationTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerEntityPositionRotationPacket packet) { + public void translate(GeyserSession session, ClientboundMoveEntityPosRotPacket packet) { Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId()); if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPositionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPositionTranslator.java index 67f8fe1b6..f43afbe9b 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPositionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPositionTranslator.java @@ -25,20 +25,22 @@ package org.geysermc.connector.network.translators.java.entity; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityPositionPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundMoveEntityPosPacket; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerEntityPositionPacket.class) -public class JavaEntityPositionTranslator extends PacketTranslator { +@Translator(packet = ClientboundMoveEntityPosPacket.class) +public class JavaEntityPositionTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerEntityPositionPacket packet) { - Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId()); + public void translate(GeyserSession session, ClientboundMoveEntityPosPacket packet) { + Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); + } else { + entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId()); } if (entity == null) return; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPropertiesTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPropertiesTranslator.java index c3937a1e3..9f00a1832 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPropertiesTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPropertiesTranslator.java @@ -25,26 +25,26 @@ package org.geysermc.connector.network.translators.java.entity; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityPropertiesPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundUpdateAttributesPacket; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.LivingEntity; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerEntityPropertiesPacket.class) -public class JavaEntityPropertiesTranslator extends PacketTranslator { +@Translator(packet = ClientboundUpdateAttributesPacket.class) +public class JavaEntityPropertiesTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerEntityPropertiesPacket packet) { + public void translate(GeyserSession session, ClientboundUpdateAttributesPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); } else { entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId()); } - if (!(entity instanceof LivingEntity)) return; + if (!(entity instanceof LivingEntity livingEntity)) return; - ((LivingEntity) entity).updateBedrockAttributes(session, packet.getAttributes()); + livingEntity.updateBedrockAttributes(session, packet.getAttributes()); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityRemoveEffectTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityRemoveEffectTranslator.java index 131fa2505..efb1ed75b 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityRemoveEffectTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityRemoveEffectTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.java.entity; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityRemoveEffectPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundRemoveMobEffectPacket; import com.nukkitx.protocol.bedrock.packet.MobEffectPacket; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.network.session.GeyserSession; @@ -33,11 +33,11 @@ import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.utils.EntityUtils; -@Translator(packet = ServerEntityRemoveEffectPacket.class) -public class JavaEntityRemoveEffectTranslator extends PacketTranslator { +@Translator(packet = ClientboundRemoveMobEffectPacket.class) +public class JavaEntityRemoveEffectTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerEntityRemoveEffectPacket packet) { + public void translate(GeyserSession session, ClientboundRemoveMobEffectPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityRotationTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityRotationTranslator.java index 71e005899..846914ebe 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityRotationTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityRotationTranslator.java @@ -25,17 +25,17 @@ package org.geysermc.connector.network.translators.java.entity; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityRotationPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundMoveEntityRotPacket; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerEntityRotationPacket.class) -public class JavaEntityRotationTranslator extends PacketTranslator { +@Translator(packet = ClientboundMoveEntityRotPacket.class) +public class JavaEntityRotationTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerEntityRotationPacket packet) { + public void translate(GeyserSession session, ClientboundMoveEntityRotPacket packet) { Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId()); if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntitySetPassengersTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntitySetPassengersTranslator.java index da282648b..081f59f37 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntitySetPassengersTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntitySetPassengersTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.java.entity; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntitySetPassengersPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundSetPassengersPacket; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityLinkData; import com.nukkitx.protocol.bedrock.packet.SetEntityLinkPacket; @@ -39,11 +39,11 @@ import org.geysermc.connector.utils.EntityUtils; import java.util.Arrays; -@Translator(packet = ServerEntitySetPassengersPacket.class) -public class JavaEntitySetPassengersTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetPassengersPacket.class) +public class JavaEntitySetPassengersTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerEntitySetPassengersPacket packet) { + public void translate(GeyserSession session, ClientboundSetPassengersPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityStatusTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityStatusTranslator.java index 8eafdd8bb..1c943ce8b 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityStatusTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityStatusTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.java.entity; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityStatusPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundEntityEventPacket; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.data.entity.EntityData; @@ -41,11 +41,11 @@ import org.geysermc.connector.network.translators.Translator; import java.util.concurrent.ThreadLocalRandom; -@Translator(packet = ServerEntityStatusPacket.class) -public class JavaEntityStatusTranslator extends PacketTranslator { +@Translator(packet = ClientboundEntityEventPacket.class) +public class JavaEntityStatusTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerEntityStatusPacket packet) { + public void translate(GeyserSession session, ClientboundEntityEventPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityTeleportTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityTeleportTranslator.java index 35dcacfec..bbc852cfe 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityTeleportTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityTeleportTranslator.java @@ -25,19 +25,18 @@ package org.geysermc.connector.network.translators.java.entity; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundTeleportEntityPacket; +import com.nukkitx.math.vector.Vector3f; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityTeleportPacket; -import com.nukkitx.math.vector.Vector3f; - -@Translator(packet = ServerEntityTeleportPacket.class) -public class JavaEntityTeleportTranslator extends PacketTranslator { +@Translator(packet = ClientboundTeleportEntityPacket.class) +public class JavaEntityTeleportTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerEntityTeleportPacket packet) { + public void translate(GeyserSession session, ClientboundTeleportEntityPacket packet) { Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId()); if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityVelocityTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityVelocityTranslator.java index 28d0d977f..c563b84d7 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityVelocityTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityVelocityTranslator.java @@ -32,15 +32,15 @@ import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityVelocityPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundSetEntityMotionPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.SetEntityMotionPacket; -@Translator(packet = ServerEntityVelocityPacket.class) -public class JavaEntityVelocityTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetEntityMotionPacket.class) +public class JavaEntityVelocityTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerEntityVelocityPacket packet) { + public void translate(GeyserSession session, ClientboundSetEntityMotionPacket packet) { Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId()); if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaVehicleMoveTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveVehicleTranslator.java similarity index 81% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaVehicleMoveTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveVehicleTranslator.java index 2f984517c..28a007931 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaVehicleMoveTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveVehicleTranslator.java @@ -23,20 +23,20 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.entity; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerVehicleMovePacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundMoveVehiclePacket; import com.nukkitx.math.vector.Vector3f; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerVehicleMovePacket.class) -public class JavaVehicleMoveTranslator extends PacketTranslator { +@Translator(packet = ClientboundMoveVehiclePacket.class) +public class JavaMoveVehicleTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerVehicleMovePacket packet) { + public void translate(GeyserSession session, ClientboundMoveVehiclePacket packet) { Entity entity = session.getRidingVehicleEntity(); if (entity == null) return; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRemoveEntitiesTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRemoveEntitiesTranslator.java index 0b1e021e2..e0592f34d 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRemoveEntitiesTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRemoveEntitiesTranslator.java @@ -25,17 +25,17 @@ package org.geysermc.connector.network.translators.java.entity; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerRemoveEntitiesPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundRemoveEntitiesPacket; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerRemoveEntitiesPacket.class) -public class JavaRemoveEntitiesTranslator extends PacketTranslator { +@Translator(packet = ClientboundRemoveEntitiesPacket.class) +public class JavaRemoveEntitiesTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerRemoveEntitiesPacket packet) { + public void translate(GeyserSession session, ClientboundRemoveEntitiesPacket packet) { for (int entityId : packet.getEntityIds()) { Entity entity = session.getEntityCache().getEntityByJavaId(entityId); if (entity != null) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerAbilitiesTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerAbilitiesTranslator.java index 4b0152fcb..a03bfceb1 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerAbilitiesTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerAbilitiesTranslator.java @@ -25,16 +25,16 @@ package org.geysermc.connector.network.translators.java.entity.player; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerAbilitiesPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerAbilitiesPacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerPlayerAbilitiesPacket.class) -public class JavaPlayerAbilitiesTranslator extends PacketTranslator { +@Translator(packet = ClientboundPlayerAbilitiesPacket.class) +public class JavaPlayerAbilitiesTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerPlayerAbilitiesPacket packet) { + public void translate(GeyserSession session, ClientboundPlayerAbilitiesPacket packet) { session.setCanFly(packet.isCanFly()); session.setFlying(packet.isFlying()); session.sendAdventureSettings(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerActionAckTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerActionAckTranslator.java index 8c9aa0142..1037bcb85 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerActionAckTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerActionAckTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.connector.network.translators.java.entity.player; import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerAction; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerActionAckPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundBlockBreakAckPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; @@ -36,11 +36,11 @@ import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.world.block.BlockStateValues; import org.geysermc.connector.utils.ChunkUtils; -@Translator(packet = ServerPlayerActionAckPacket.class) -public class JavaPlayerActionAckTranslator extends PacketTranslator { +@Translator(packet = ClientboundBlockBreakAckPacket.class) +public class JavaPlayerActionAckTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerPlayerActionAckPacket packet) { + public void translate(GeyserSession session, ClientboundBlockBreakAckPacket packet) { ChunkUtils.updateBlock(session, packet.getNewState(), packet.getPosition()); if (packet.getAction() == PlayerAction.START_DIGGING && !packet.isSuccessful()) { LevelEventPacket stopBreak = new LevelEventPacket(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerChangeHeldItemTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerChangeHeldItemTranslator.java index 27e16ee12..184aabfad 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerChangeHeldItemTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerChangeHeldItemTranslator.java @@ -25,17 +25,17 @@ package org.geysermc.connector.network.translators.java.entity.player; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerChangeHeldItemPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundSetCarriedItemPacket; import com.nukkitx.protocol.bedrock.packet.PlayerHotbarPacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerPlayerChangeHeldItemPacket.class) -public class JavaPlayerChangeHeldItemTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetCarriedItemPacket.class) +public class JavaPlayerChangeHeldItemTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerPlayerChangeHeldItemPacket packet) { + public void translate(GeyserSession session, ClientboundSetCarriedItemPacket packet) { PlayerHotbarPacket hotbarPacket = new PlayerHotbarPacket(); hotbarPacket.setContainerId(0); hotbarPacket.setSelectedHotbarSlot(packet.getSlot()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerHealthTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerHealthTranslator.java index 20403a610..79a9e61e1 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerHealthTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerHealthTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.java.entity.player; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerHealthPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundSetHealthPacket; import com.nukkitx.protocol.bedrock.data.AttributeData; import com.nukkitx.protocol.bedrock.packet.SetHealthPacket; import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; @@ -37,11 +37,11 @@ import org.geysermc.connector.network.translators.Translator; import java.util.List; -@Translator(packet = ServerPlayerHealthPacket.class) -public class JavaPlayerHealthTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetHealthPacket.class) +public class JavaPlayerHealthTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerPlayerHealthPacket packet) { + public void translate(GeyserSession session, ClientboundSetHealthPacket packet) { SessionPlayerEntity entity = session.getPlayerEntity(); int health = (int) Math.ceil(packet.getHealth()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerListEntryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerListEntryTranslator.java index f1989b2e1..0ce643971 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerListEntryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerListEntryTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.connector.network.translators.java.entity.player; import com.github.steveice10.mc.protocol.data.game.PlayerListEntry; import com.github.steveice10.mc.protocol.data.game.PlayerListEntryAction; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerPlayerListEntryPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundPlayerInfoPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.PlayerListPacket; import org.geysermc.connector.GeyserConnector; @@ -37,10 +37,10 @@ import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.skin.SkinManager; -@Translator(packet = ServerPlayerListEntryPacket.class) -public class JavaPlayerListEntryTranslator extends PacketTranslator { +@Translator(packet = ClientboundPlayerInfoPacket.class) +public class JavaPlayerListEntryTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerPlayerListEntryPacket packet) { + public void translate(GeyserSession session, ClientboundPlayerInfoPacket packet) { if (packet.getAction() != PlayerListEntryAction.ADD_PLAYER && packet.getAction() != PlayerListEntryAction.REMOVE_PLAYER) return; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerPositionRotationTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerPositionRotationTranslator.java index 6b1778464..95e6f1f8e 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerPositionRotationTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerPositionRotationTranslator.java @@ -26,8 +26,8 @@ package org.geysermc.connector.network.translators.java.entity.player; import com.github.steveice10.mc.protocol.data.game.entity.player.PositionElement; -import com.github.steveice10.mc.protocol.packet.ingame.client.world.ClientTeleportConfirmPacket; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerPositionPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundAcceptTeleportationPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityLinkData; @@ -46,11 +46,11 @@ import org.geysermc.connector.utils.ChunkUtils; import org.geysermc.connector.utils.EntityUtils; import org.geysermc.connector.utils.LanguageUtils; -@Translator(packet = ServerPlayerPositionRotationPacket.class) -public class JavaPlayerPositionRotationTranslator extends PacketTranslator { +@Translator(packet = ClientboundPlayerPositionPacket.class) +public class JavaPlayerPositionRotationTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerPlayerPositionRotationPacket packet) { + public void translate(GeyserSession session, ClientboundPlayerPositionPacket packet) { if (!session.isLoggedIn()) return; @@ -81,7 +81,7 @@ public class JavaPlayerPositionRotationTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetExperiencePacket.class) +public class JavaPlayerSetExperienceTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerPlayerSetExperiencePacket packet) { + public void translate(GeyserSession session, ClientboundSetExperiencePacket packet) { SessionPlayerEntity entity = session.getPlayerEntity(); AttributeData experience = GeyserAttributeType.EXPERIENCE.getAttribute(packet.getExperience()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnEntityTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnEntityTranslator.java index e53358ac2..dc5c7b459 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnEntityTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnEntityTranslator.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.object.FallingBlockDat import com.github.steveice10.mc.protocol.data.game.entity.object.HangingDirection; import com.github.steveice10.mc.protocol.data.game.entity.object.ProjectileData; import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnEntityPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddEntityPacket; import com.nukkitx.math.vector.Vector3f; import org.geysermc.connector.entity.*; import org.geysermc.connector.entity.player.PlayerEntity; @@ -42,11 +42,11 @@ import org.geysermc.connector.utils.LanguageUtils; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; -@Translator(packet = ServerSpawnEntityPacket.class) -public class JavaSpawnEntityTranslator extends PacketTranslator { +@Translator(packet = ClientboundAddEntityPacket.class) +public class JavaSpawnEntityTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSpawnEntityPacket packet) { + public void translate(GeyserSession session, ClientboundAddEntityPacket packet) { Vector3f position = Vector3f.from(packet.getX(), packet.getY(), packet.getZ()); Vector3f motion = Vector3f.from(packet.getMotionX(), packet.getMotionY(), packet.getMotionZ()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnExpOrbTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnExpOrbTranslator.java index 6fd0e6094..56cf457da 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnExpOrbTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnExpOrbTranslator.java @@ -25,6 +25,8 @@ package org.geysermc.connector.network.translators.java.entity.spawn; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddExperienceOrbPacket; +import com.nukkitx.math.vector.Vector3f; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.ExpOrbEntity; import org.geysermc.connector.entity.type.EntityType; @@ -32,14 +34,11 @@ import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnExpOrbPacket; -import com.nukkitx.math.vector.Vector3f; - -@Translator(packet = ServerSpawnExpOrbPacket.class) -public class JavaSpawnExpOrbTranslator extends PacketTranslator { +@Translator(packet = ClientboundAddExperienceOrbPacket.class) +public class JavaSpawnExpOrbTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSpawnExpOrbPacket packet) { + public void translate(GeyserSession session, ClientboundAddExperienceOrbPacket packet) { Vector3f position = Vector3f.from(packet.getX(), packet.getY(), packet.getZ()); Entity entity = new ExpOrbEntity( diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnLivingEntityTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnLivingEntityTranslator.java index 46d47e808..b6414b2ac 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnLivingEntityTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnLivingEntityTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.java.entity.spawn; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnLivingEntityPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddMobPacket; import com.nukkitx.math.vector.Vector3f; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.type.EntityType; @@ -38,11 +38,11 @@ import org.geysermc.connector.utils.LanguageUtils; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; -@Translator(packet = ServerSpawnLivingEntityPacket.class) -public class JavaSpawnLivingEntityTranslator extends PacketTranslator { +@Translator(packet = ClientboundAddMobPacket.class) +public class JavaSpawnLivingEntityTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSpawnLivingEntityPacket packet) { + public void translate(GeyserSession session, ClientboundAddMobPacket packet) { Vector3f position = Vector3f.from(packet.getX(), packet.getY(), packet.getZ()); Vector3f motion = Vector3f.from(packet.getMotionX(), packet.getMotionY(), packet.getMotionZ()); Vector3f rotation = Vector3f.from(packet.getYaw(), packet.getPitch(), packet.getHeadYaw()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnPaintingTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnPaintingTranslator.java index 1d5ee4736..595b77d33 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnPaintingTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnPaintingTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.java.entity.spawn; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnPaintingPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddPaintingPacket; import com.nukkitx.math.vector.Vector3f; import org.geysermc.connector.entity.PaintingEntity; import org.geysermc.connector.network.session.GeyserSession; @@ -33,11 +33,11 @@ import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.utils.PaintingType; -@Translator(packet = ServerSpawnPaintingPacket.class) -public class JavaSpawnPaintingTranslator extends PacketTranslator { +@Translator(packet = ClientboundAddPaintingPacket.class) +public class JavaSpawnPaintingTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSpawnPaintingPacket packet) { + public void translate(GeyserSession session, ClientboundAddPaintingPacket packet) { Vector3f position = Vector3f.from(packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ()); PaintingEntity entity = new PaintingEntity(packet.getEntityId(), diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnPlayerTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnPlayerTranslator.java index 6df3666b6..d574da825 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnPlayerTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnPlayerTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.java.entity.spawn; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnPlayerPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddPlayerPacket; import com.nukkitx.math.vector.Vector3f; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.entity.player.PlayerEntity; @@ -35,11 +35,11 @@ import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.utils.LanguageUtils; import org.geysermc.connector.skin.SkinManager; -@Translator(packet = ServerSpawnPlayerPacket.class) -public class JavaSpawnPlayerTranslator extends PacketTranslator { +@Translator(packet = ClientboundAddPlayerPacket.class) +public class JavaSpawnPlayerTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSpawnPlayerPacket packet) { + public void translate(GeyserSession session, ClientboundAddPlayerPacket packet) { Vector3f position = Vector3f.from(packet.getX(), packet.getY(), packet.getZ()); Vector3f rotation = Vector3f.from(packet.getYaw(), packet.getPitch(), packet.getYaw()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockBreakAnimTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockBreakAnimTranslator.java similarity index 90% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockBreakAnimTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockBreakAnimTranslator.java index da2e74604..1e64eb565 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockBreakAnimTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockBreakAnimTranslator.java @@ -23,9 +23,9 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerBlockBreakAnimPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundBlockDestructionPacket; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; @@ -37,11 +37,11 @@ import org.geysermc.connector.registry.BlockRegistries; import org.geysermc.connector.registry.type.ItemMapping; import org.geysermc.connector.utils.BlockUtils; -@Translator(packet = ServerBlockBreakAnimPacket.class) -public class JavaBlockBreakAnimTranslator extends PacketTranslator { +@Translator(packet = ClientboundBlockDestructionPacket.class) +public class JavaBlockBreakAnimTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerBlockBreakAnimPacket packet) { + public void translate(GeyserSession session, ClientboundBlockDestructionPacket packet) { int state = session.getConnector().getWorldManager().getBlockAt(session, packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ()); int breakTime = (int) (65535 / Math.ceil(BlockUtils.getBreakTime(session, BlockRegistries.JAVA_BLOCKS.get(state), ItemMapping.AIR, new CompoundTag(""), false) * 20)); LevelEventPacket levelEventPacket = new LevelEventPacket(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockChangeTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockChangeTranslator.java similarity index 90% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockChangeTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockChangeTranslator.java index 78ee1238e..8ed714710 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockChangeTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockChangeTranslator.java @@ -23,10 +23,10 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerBlockChangePacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundBlockUpdatePacket; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; @@ -38,11 +38,11 @@ import org.geysermc.connector.network.translators.sound.BlockSoundInteractionHan import org.geysermc.connector.registry.BlockRegistries; import org.geysermc.connector.utils.ChunkUtils; -@Translator(packet = ServerBlockChangePacket.class) -public class JavaBlockChangeTranslator extends PacketTranslator { +@Translator(packet = ClientboundBlockUpdatePacket.class) +public class JavaBlockChangeTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerBlockChangePacket packet) { + public void translate(GeyserSession session, ClientboundBlockUpdatePacket packet) { Position pos = packet.getRecord().getPosition(); boolean updatePlacement = session.getConnector().getPlatformType() != PlatformType.SPIGOT && // Spigot simply listens for the block place event session.getConnector().getWorldManager().getBlockAt(session, pos) != packet.getRecord().getBlock(); @@ -53,7 +53,7 @@ public class JavaBlockChangeTranslator extends PacketTranslator { +@Translator(packet = ClientboundBlockEventPacket.class) +public class JavaBlockValueTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerBlockValuePacket packet) { + public void translate(GeyserSession session, ClientboundBlockEventPacket packet) { BlockEventPacket blockEventPacket = new BlockEventPacket(); blockEventPacket.setBlockPosition(Vector3i.from(packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ())); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaChunkDataTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaChunkDataTranslator.java similarity index 94% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaChunkDataTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaChunkDataTranslator.java index baa2d6781..139924858 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaChunkDataTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaChunkDataTranslator.java @@ -23,10 +23,10 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; import com.github.steveice10.mc.protocol.data.game.chunk.Column; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerChunkDataPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelChunkPacket; import com.nukkitx.nbt.NBTOutputStream; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtUtils; @@ -46,11 +46,11 @@ import org.geysermc.connector.utils.ChunkUtils; import static org.geysermc.connector.utils.ChunkUtils.MINIMUM_ACCEPTED_HEIGHT; import static org.geysermc.connector.utils.ChunkUtils.MINIMUM_ACCEPTED_HEIGHT_OVERWORLD; -@Translator(packet = ServerChunkDataPacket.class) -public class JavaChunkDataTranslator extends PacketTranslator { +@Translator(packet = ClientboundLevelChunkPacket.class) +public class JavaChunkDataTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerChunkDataPacket packet) { + public void translate(GeyserSession session, ClientboundLevelChunkPacket packet) { if (session.isSpawned()) { ChunkUtils.updateChunkPosition(session, session.getPlayerEntity().getPosition().toInt()); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaExplosionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaExplosionTranslator.java similarity index 89% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaExplosionTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaExplosionTranslator.java index 721e40c8e..c8af1d1d7 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaExplosionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaExplosionTranslator.java @@ -23,10 +23,10 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; -import com.github.steveice10.mc.protocol.data.game.world.block.ExplodedBlockRecord; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerExplosionPacket; +import com.github.steveice10.mc.protocol.data.game.level.block.ExplodedBlockRecord; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundExplodePacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.data.LevelEventType; @@ -40,11 +40,11 @@ import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.world.block.BlockStateValues; import org.geysermc.connector.utils.ChunkUtils; -@Translator(packet = ServerExplosionPacket.class) -public class JavaExplosionTranslator extends PacketTranslator { +@Translator(packet = ClientboundExplodePacket.class) +public class JavaExplosionTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerExplosionPacket packet) { + public void translate(GeyserSession session, ClientboundExplodePacket packet) { for (ExplodedBlockRecord record : packet.getExploded()) { Vector3i pos = Vector3i.from(packet.getX() + record.getX(), packet.getY() + record.getY(), packet.getZ() + record.getZ()); ChunkUtils.updateBlock(session, BlockStateValues.JAVA_AIR_ID, pos); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaMapDataTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaMapDataTranslator.java similarity index 84% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaMapDataTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaMapDataTranslator.java index 7fee63437..ad080e1f0 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaMapDataTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaMapDataTranslator.java @@ -23,14 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; -import com.github.steveice10.mc.protocol.data.game.world.map.MapData; -import com.github.steveice10.mc.protocol.data.game.world.map.MapIcon; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerMapDataPacket; +import com.github.steveice10.mc.protocol.data.game.level.map.MapData; +import com.github.steveice10.mc.protocol.data.game.level.map.MapIcon; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundMapItemDataPacket; import com.nukkitx.protocol.bedrock.data.MapDecoration; import com.nukkitx.protocol.bedrock.data.MapTrackedObject; -import com.nukkitx.protocol.bedrock.packet.ClientboundMapItemDataPacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; @@ -38,11 +37,11 @@ import org.geysermc.connector.utils.BedrockMapIcon; import org.geysermc.connector.utils.DimensionUtils; import org.geysermc.connector.utils.MapColor; -@Translator(packet = ServerMapDataPacket.class) -public class JavaMapDataTranslator extends PacketTranslator { +@Translator(packet = ClientboundMapItemDataPacket.class) +public class JavaMapDataTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerMapDataPacket packet) { - ClientboundMapItemDataPacket mapItemDataPacket = new ClientboundMapItemDataPacket(); + public void translate(GeyserSession session, ClientboundMapItemDataPacket packet) { + com.nukkitx.protocol.bedrock.packet.ClientboundMapItemDataPacket mapItemDataPacket = new com.nukkitx.protocol.bedrock.packet.ClientboundMapItemDataPacket(); boolean shouldStore = false; mapItemDataPacket.setUniqueMapId(packet.getMapId()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaMultiBlockChangeTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaMultiBlockChangeTranslator.java similarity index 79% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaMultiBlockChangeTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaMultiBlockChangeTranslator.java index 2a4115af7..1d3409af9 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaMultiBlockChangeTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaMultiBlockChangeTranslator.java @@ -23,21 +23,20 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; +import com.github.steveice10.mc.protocol.data.game.level.block.BlockChangeRecord; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSectionBlocksUpdatePacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.utils.ChunkUtils; -import com.github.steveice10.mc.protocol.data.game.world.block.BlockChangeRecord; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerMultiBlockChangePacket; - -@Translator(packet = ServerMultiBlockChangePacket.class) -public class JavaMultiBlockChangeTranslator extends PacketTranslator { +@Translator(packet = ClientboundSectionBlocksUpdatePacket.class) +public class JavaMultiBlockChangeTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerMultiBlockChangePacket packet) { + public void translate(GeyserSession session, ClientboundSectionBlocksUpdatePacket packet) { for (BlockChangeRecord record : packet.getRecords()) { ChunkUtils.updateBlock(session, record.getBlock(), record.getPosition()); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaNotifyClientTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaNotifyClientTranslator.java similarity index 91% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaNotifyClientTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaNotifyClientTranslator.java index 282712172..3b9948530 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaNotifyClientTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaNotifyClientTranslator.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; import com.github.steveice10.mc.protocol.data.game.ClientRequest; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; -import com.github.steveice10.mc.protocol.data.game.world.notify.EnterCreditsValue; -import com.github.steveice10.mc.protocol.data.game.world.notify.RainStrengthValue; -import com.github.steveice10.mc.protocol.data.game.world.notify.RespawnScreenValue; -import com.github.steveice10.mc.protocol.data.game.world.notify.ThunderStrengthValue; -import com.github.steveice10.mc.protocol.packet.ingame.client.ClientRequestPacket; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerNotifyClientPacket; +import com.github.steveice10.mc.protocol.data.game.level.notify.EnterCreditsValue; +import com.github.steveice10.mc.protocol.data.game.level.notify.RainStrengthValue; +import com.github.steveice10.mc.protocol.data.game.level.notify.RespawnScreenValue; +import com.github.steveice10.mc.protocol.data.game.level.notify.ThunderStrengthValue; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientCommandPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundGameEventPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.GameRuleData; import com.nukkitx.protocol.bedrock.data.LevelEventType; @@ -45,11 +45,11 @@ import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.inventory.translators.PlayerInventoryTranslator; import org.geysermc.connector.utils.LocaleUtils; -@Translator(packet = ServerNotifyClientPacket.class) -public class JavaNotifyClientTranslator extends PacketTranslator { +@Translator(packet = ClientboundGameEventPacket.class) +public class JavaNotifyClientTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerNotifyClientPacket packet) { + public void translate(GeyserSession session, ClientboundGameEventPacket packet) { PlayerEntity entity = session.getPlayerEntity(); switch (packet.getNotification()) { @@ -126,7 +126,7 @@ public class JavaNotifyClientTranslator extends PacketTranslator { - ClientRequestPacket javaRespawnPacket = new ClientRequestPacket(ClientRequest.RESPAWN); + ServerboundClientCommandPacket javaRespawnPacket = new ServerboundClientCommandPacket(ClientRequest.RESPAWN); session.sendDownstreamPacket(javaRespawnPacket); } case FIRST_TIME -> { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayBuiltinSoundTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaPlayBuiltinSoundTranslator.java similarity index 93% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayBuiltinSoundTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaPlayBuiltinSoundTranslator.java index f5ae7ff07..49d36ca38 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayBuiltinSoundTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaPlayBuiltinSoundTranslator.java @@ -23,9 +23,9 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerPlayBuiltinSoundPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSoundPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.data.SoundEvent; @@ -40,11 +40,11 @@ import org.geysermc.connector.utils.SoundUtils; import org.geysermc.connector.registry.Registries; import org.geysermc.connector.registry.type.SoundMapping; -@Translator(packet = ServerPlayBuiltinSoundPacket.class) -public class JavaPlayBuiltinSoundTranslator extends PacketTranslator { +@Translator(packet = ClientboundSoundPacket.class) +public class JavaPlayBuiltinSoundTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerPlayBuiltinSoundPacket packet) { + public void translate(GeyserSession session, ClientboundSoundPacket packet) { String packetSound = packet.getSound().getName(); SoundMapping soundMapping = Registries.SOUNDS.get(packetSound); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayEffectTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaPlayEffectTranslator.java similarity index 96% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayEffectTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaPlayEffectTranslator.java index 2018fe211..83eefb10b 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayEffectTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaPlayEffectTranslator.java @@ -23,10 +23,10 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; -import com.github.steveice10.mc.protocol.data.game.world.effect.*; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerPlayEffectPacket; +import com.github.steveice10.mc.protocol.data.game.level.effect.*; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelEventPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.data.SoundEvent; @@ -45,11 +45,11 @@ import org.geysermc.connector.utils.LocaleUtils; import java.util.Collections; import java.util.Locale; -@Translator(packet = ServerPlayEffectPacket.class) -public class JavaPlayEffectTranslator extends PacketTranslator { +@Translator(packet = ClientboundLevelEventPacket.class) +public class JavaPlayEffectTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerPlayEffectPacket packet) { + public void translate(GeyserSession session, ClientboundLevelEventPacket packet) { // Separate case since each RecordEffectData in Java is an individual track in Bedrock if (packet.getEffect() == SoundEffect.RECORD) { RecordEffectData recordEffectData = (RecordEffectData) packet.getData(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlaySoundTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaPlaySoundTranslator.java similarity index 84% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlaySoundTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaPlaySoundTranslator.java index 1f1ac0d12..0ad48e02c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlaySoundTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaPlaySoundTranslator.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; -import com.github.steveice10.mc.protocol.data.game.world.sound.BuiltinSound; -import com.github.steveice10.mc.protocol.data.game.world.sound.CustomSound; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerPlaySoundPacket; +import com.github.steveice10.mc.protocol.data.game.level.sound.BuiltinSound; +import com.github.steveice10.mc.protocol.data.game.level.sound.CustomSound; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundCustomSoundPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.*; import org.geysermc.connector.network.session.GeyserSession; @@ -36,11 +36,11 @@ import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.registry.Registries; import org.geysermc.connector.registry.type.SoundMapping; -@Translator(packet = ServerPlaySoundPacket.class) -public class JavaPlaySoundTranslator extends PacketTranslator { +@Translator(packet = ClientboundCustomSoundPacket.class) +public class JavaPlaySoundTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerPlaySoundPacket packet) { + public void translate(GeyserSession session, ClientboundCustomSoundPacket packet) { String packetSound; if (packet.getSound() instanceof BuiltinSound) { packetSound = ((BuiltinSound) packet.getSound()).getName(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaSpawnParticleTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSpawnParticleTranslator.java similarity index 94% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaSpawnParticleTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSpawnParticleTranslator.java index 3efd8e468..961dc7fd1 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaSpawnParticleTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSpawnParticleTranslator.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; -import com.github.steveice10.mc.protocol.data.game.world.particle.*; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerSpawnParticlePacket; +import com.github.steveice10.mc.protocol.data.game.level.particle.*; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelParticlesPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.BedrockPacket; import com.nukkitx.protocol.bedrock.data.LevelEventType; @@ -46,11 +46,11 @@ import java.util.Random; import java.util.concurrent.ThreadLocalRandom; import java.util.function.Function; -@Translator(packet = ServerSpawnParticlePacket.class) -public class JavaSpawnParticleTranslator extends PacketTranslator { +@Translator(packet = ClientboundLevelParticlesPacket.class) +public class JavaSpawnParticleTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSpawnParticlePacket packet) { + public void translate(GeyserSession session, ClientboundLevelParticlesPacket packet) { Function particleCreateFunction = createParticle(session, packet.getParticle()); if (particleCreateFunction != null) { if (packet.getAmount() == 0) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaSpawnPositionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSpawnPositionTranslator.java similarity index 84% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaSpawnPositionTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSpawnPositionTranslator.java index 16e507440..ae96ada79 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaSpawnPositionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSpawnPositionTranslator.java @@ -23,22 +23,21 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSetDefaultSpawnPositionPacket; +import com.nukkitx.math.vector.Vector3i; +import com.nukkitx.protocol.bedrock.packet.SetSpawnPositionPacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; - -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerSpawnPositionPacket; -import com.nukkitx.math.vector.Vector3i; -import com.nukkitx.protocol.bedrock.packet.SetSpawnPositionPacket; import org.geysermc.connector.utils.DimensionUtils; -@Translator(packet = ServerSpawnPositionPacket.class) -public class JavaSpawnPositionTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetDefaultSpawnPositionPacket.class) +public class JavaSpawnPositionTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSpawnPositionPacket packet) { + public void translate(GeyserSession session, ClientboundSetDefaultSpawnPositionPacket packet) { SetSpawnPositionPacket spawnPositionPacket = new SetSpawnPositionPacket(); spawnPositionPacket.setBlockPosition(Vector3i.from(packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ())); spawnPositionPacket.setSpawnForced(true); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaStopSoundTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaStopSoundTranslator.java similarity index 87% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaStopSoundTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaStopSoundTranslator.java index 93241310f..07d6791fd 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaStopSoundTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaStopSoundTranslator.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; -import com.github.steveice10.mc.protocol.data.game.world.sound.BuiltinSound; -import com.github.steveice10.mc.protocol.data.game.world.sound.CustomSound; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerStopSoundPacket; +import com.github.steveice10.mc.protocol.data.game.level.sound.BuiltinSound; +import com.github.steveice10.mc.protocol.data.game.level.sound.CustomSound; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundStopSoundPacket; import com.nukkitx.protocol.bedrock.packet.StopSoundPacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; @@ -35,11 +35,11 @@ import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.registry.Registries; import org.geysermc.connector.registry.type.SoundMapping; -@Translator(packet = ServerStopSoundPacket.class) -public class JavaStopSoundTranslator extends PacketTranslator { +@Translator(packet = ClientboundStopSoundPacket.class) +public class JavaStopSoundTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerStopSoundPacket packet) { + public void translate(GeyserSession session, ClientboundStopSoundPacket packet) { // Runs if all sounds are stopped if (packet.getSound() == null) { StopSoundPacket stopPacket = new StopSoundPacket(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUnloadChunkTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUnloadChunkTranslator.java similarity index 87% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUnloadChunkTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUnloadChunkTranslator.java index d651eceae..fdc43e758 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUnloadChunkTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUnloadChunkTranslator.java @@ -23,9 +23,9 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerUnloadChunkPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundForgetLevelChunkPacket; import com.nukkitx.math.vector.Vector3i; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; @@ -33,11 +33,11 @@ import org.geysermc.connector.network.translators.Translator; import java.util.Iterator; -@Translator(packet = ServerUnloadChunkPacket.class) -public class JavaUnloadChunkTranslator extends PacketTranslator { +@Translator(packet = ClientboundForgetLevelChunkPacket.class) +public class JavaUnloadChunkTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerUnloadChunkPacket packet) { + public void translate(GeyserSession session, ClientboundForgetLevelChunkPacket packet) { session.getChunkCache().removeChunk(packet.getX(), packet.getZ()); //Checks if a skull is in an unloaded chunk then removes it diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateTileEntityTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateTileEntityTranslator.java similarity index 90% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateTileEntityTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateTileEntityTranslator.java index 9acceb0a5..2f38dd8e9 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateTileEntityTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateTileEntityTranslator.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; -import com.github.steveice10.mc.protocol.data.game.world.block.UpdatedTileType; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerUpdateTileEntityPacket; +import com.github.steveice10.mc.protocol.data.game.level.block.UpdatedTileType; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundBlockEntityDataPacket; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; @@ -41,11 +41,11 @@ import org.geysermc.connector.network.translators.world.block.entity.RequiresBlo import org.geysermc.connector.network.translators.world.block.entity.SkullBlockEntityTranslator; import org.geysermc.connector.utils.BlockEntityUtils; -@Translator(packet = ServerUpdateTileEntityPacket.class) -public class JavaUpdateTileEntityTranslator extends PacketTranslator { +@Translator(packet = ClientboundBlockEntityDataPacket.class) +public class JavaUpdateTileEntityTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerUpdateTileEntityPacket packet) { + public void translate(GeyserSession session, ClientboundBlockEntityDataPacket packet) { String id = BlockEntityUtils.getBedrockBlockEntityId(packet.getType().name()); if (packet.getNbt().isEmpty()) { // Fixes errors in servers sending empty NBT BlockEntityUtils.updateBlockEntity(session, NbtMap.EMPTY, packet.getPosition()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateTimeTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateTimeTranslator.java similarity index 85% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateTimeTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateTimeTranslator.java index 3564177e1..e478fb3a5 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateTimeTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateTimeTranslator.java @@ -23,19 +23,19 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerUpdateTimePacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSetTimePacket; import com.nukkitx.protocol.bedrock.packet.SetTimePacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerUpdateTimePacket.class) -public class JavaUpdateTimeTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetTimePacket.class) +public class JavaUpdateTimeTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerUpdateTimePacket packet) { + public void translate(GeyserSession session, ClientboundSetTimePacket packet) { // Bedrock sends a GameRulesChangedPacket if there is no daylight cycle // Java just sends a negative long if there is no daylight cycle long time = packet.getTime(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateViewDistanceTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateViewDistanceTranslator.java similarity index 80% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateViewDistanceTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateViewDistanceTranslator.java index 155af39b6..faa6e7867 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateViewDistanceTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateViewDistanceTranslator.java @@ -23,19 +23,18 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSetChunkCacheRadiusPacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerUpdateViewDistancePacket; - -@Translator(packet = ServerUpdateViewDistancePacket.class) -public class JavaUpdateViewDistanceTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetChunkCacheRadiusPacket.class) +public class JavaUpdateViewDistanceTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerUpdateViewDistancePacket packet) { + public void translate(GeyserSession session, ClientboundSetChunkCacheRadiusPacket packet) { session.setRenderDistance(packet.getViewDistance()); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateViewPositionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateViewPositionTranslator.java similarity index 82% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateViewPositionTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateViewPositionTranslator.java index a4ce170bf..ced4545c9 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateViewPositionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateViewPositionTranslator.java @@ -23,21 +23,20 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSetChunkCacheCenterPacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.utils.ChunkUtils; - -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerUpdateViewPositionPacket; import com.nukkitx.math.vector.Vector3i; -@Translator(packet = ServerUpdateViewPositionPacket.class) -public class JavaUpdateViewPositionTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetChunkCacheCenterPacket.class) +public class JavaUpdateViewPositionTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerUpdateViewPositionPacket packet) { + public void translate(GeyserSession session, ClientboundSetChunkCacheCenterPacket packet) { if (!session.isSpawned() && session.getLastChunkPosition() == null) { ChunkUtils.updateChunkPosition(session, Vector3i.from(packet.getChunkX() << 4, 64, packet.getChunkZ() << 4)); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaInitializeBorderTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaInitializeBorderTranslator.java similarity index 85% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaInitializeBorderTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaInitializeBorderTranslator.java index 05632cefa..1a3ed5b30 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaInitializeBorderTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaInitializeBorderTranslator.java @@ -23,20 +23,20 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world.border; +package org.geysermc.connector.network.translators.java.level.border; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.border.ServerInitializeBorderPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundInitializeBorderPacket; import com.nukkitx.math.vector.Vector2d; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.cache.WorldBorder; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerInitializeBorderPacket.class) -public class JavaInitializeBorderTranslator extends PacketTranslator { +@Translator(packet = ClientboundInitializeBorderPacket.class) +public class JavaInitializeBorderTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerInitializeBorderPacket packet) { + public void translate(GeyserSession session, ClientboundInitializeBorderPacket packet) { WorldBorder worldBorder = session.getWorldBorder(); worldBorder.setCenter(Vector2d.from(packet.getNewCenterX(), packet.getNewCenterZ())); worldBorder.setOldDiameter(packet.getOldSize()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderCenterTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderCenterTranslator.java similarity index 82% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderCenterTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderCenterTranslator.java index 3d755fce1..85ad2512e 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderCenterTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderCenterTranslator.java @@ -23,20 +23,20 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world.border; +package org.geysermc.connector.network.translators.java.level.border; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.border.ServerSetBorderCenterPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundSetBorderCenterPacket; import com.nukkitx.math.vector.Vector2d; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.cache.WorldBorder; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerSetBorderCenterPacket.class) -public class JavaSetBorderCenterTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetBorderCenterPacket.class) +public class JavaSetBorderCenterTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSetBorderCenterPacket packet) { + public void translate(GeyserSession session, ClientboundSetBorderCenterPacket packet) { WorldBorder worldBorder = session.getWorldBorder(); worldBorder.setCenter(Vector2d.from(packet.getNewCenterX(), packet.getNewCenterZ())); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderLerpSizeTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderLerpSizeTranslator.java similarity index 82% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderLerpSizeTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderLerpSizeTranslator.java index b54a67b31..bfead0466 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderLerpSizeTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderLerpSizeTranslator.java @@ -23,19 +23,19 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world.border; +package org.geysermc.connector.network.translators.java.level.border; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.border.ServerSetBorderLerpSizePacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundSetBorderLerpSizePacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.cache.WorldBorder; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerSetBorderLerpSizePacket.class) -public class JavaSetBorderLerpSizeTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetBorderLerpSizePacket.class) +public class JavaSetBorderLerpSizeTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSetBorderLerpSizePacket packet) { + public void translate(GeyserSession session, ClientboundSetBorderLerpSizePacket packet) { WorldBorder worldBorder = session.getWorldBorder(); worldBorder.setOldDiameter(packet.getOldSize()); worldBorder.setNewDiameter(packet.getNewSize()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderSizeTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderSizeTranslator.java similarity index 83% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderSizeTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderSizeTranslator.java index 3b90019ad..0de9f339c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderSizeTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderSizeTranslator.java @@ -23,19 +23,19 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world.border; +package org.geysermc.connector.network.translators.java.level.border; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.border.ServerSetBorderSizePacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundSetBorderSizePacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.cache.WorldBorder; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerSetBorderSizePacket.class) -public class JavaSetBorderSizeTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetBorderSizePacket.class) +public class JavaSetBorderSizeTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSetBorderSizePacket packet) { + public void translate(GeyserSession session, ClientboundSetBorderSizePacket packet) { WorldBorder worldBorder = session.getWorldBorder(); worldBorder.setOldDiameter(packet.getSize()); worldBorder.setNewDiameter(packet.getSize()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderWarningDelayTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderWarningDelayTranslator.java similarity index 81% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderWarningDelayTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderWarningDelayTranslator.java index b3b718b30..850a7186e 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderWarningDelayTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderWarningDelayTranslator.java @@ -23,19 +23,19 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world.border; +package org.geysermc.connector.network.translators.java.level.border; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.border.ServerSetBorderWarningDelayPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundSetBorderWarningDelayPacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.cache.WorldBorder; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerSetBorderWarningDelayPacket.class) -public class JavaSetBorderWarningDelayTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetBorderWarningDelayPacket.class) +public class JavaSetBorderWarningDelayTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSetBorderWarningDelayPacket packet) { + public void translate(GeyserSession session, ClientboundSetBorderWarningDelayPacket packet) { WorldBorder worldBorder = session.getWorldBorder(); worldBorder.setWarningDelay(packet.getWarningDelay()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderWarningDistanceTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderWarningDistanceTranslator.java similarity index 80% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderWarningDistanceTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderWarningDistanceTranslator.java index 21d1d9209..33a984357 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderWarningDistanceTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderWarningDistanceTranslator.java @@ -23,19 +23,19 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world.border; +package org.geysermc.connector.network.translators.java.level.border; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.border.ServerSetBorderWarningDistancePacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundSetBorderWarningDistancePacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.cache.WorldBorder; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerSetBorderWarningDistancePacket.class) -public class JavaSetBorderWarningDistanceTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetBorderWarningDistancePacket.class) +public class JavaSetBorderWarningDistanceTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSetBorderWarningDistancePacket packet) { + public void translate(GeyserSession session, ClientboundSetBorderWarningDistancePacket packet) { WorldBorder worldBorder = session.getWorldBorder(); worldBorder.setWarningBlocks(packet.getWarningBlocks()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaDisplayScoreboardTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaDisplayScoreboardTranslator.java index a56e59fe7..27544b94c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaDisplayScoreboardTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaDisplayScoreboardTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.java.scoreboard; -import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerDisplayScoreboardPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.scoreboard.ClientboundSetDisplayObjectivePacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.cache.WorldCache; import org.geysermc.connector.network.translators.PacketTranslator; @@ -33,11 +33,11 @@ import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.scoreboard.Scoreboard; import org.geysermc.connector.scoreboard.ScoreboardUpdater; -@Translator(packet = ServerDisplayScoreboardPacket.class) -public class JavaDisplayScoreboardTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetDisplayObjectivePacket.class) +public class JavaDisplayScoreboardTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerDisplayScoreboardPacket packet) { + public void translate(GeyserSession session, ClientboundSetDisplayObjectivePacket packet) { WorldCache worldCache = session.getWorldCache(); Scoreboard scoreboard = worldCache.getScoreboard(); int pps = worldCache.increaseAndGetScoreboardPacketsPerSecond(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaScoreboardObjectiveTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaScoreboardObjectiveTranslator.java index 09e5df391..ad7069503 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaScoreboardObjectiveTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaScoreboardObjectiveTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.connector.network.translators.java.scoreboard; import com.github.steveice10.mc.protocol.data.game.scoreboard.ObjectiveAction; import com.github.steveice10.mc.protocol.data.game.scoreboard.ScoreboardPosition; -import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerScoreboardObjectivePacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.scoreboard.ClientboundSetObjectivePacket; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.GeyserLogger; import org.geysermc.connector.entity.player.PlayerEntity; @@ -41,12 +41,12 @@ import org.geysermc.connector.scoreboard.Scoreboard; import org.geysermc.connector.scoreboard.ScoreboardUpdater; import org.geysermc.connector.scoreboard.UpdateType; -@Translator(packet = ServerScoreboardObjectivePacket.class) -public class JavaScoreboardObjectiveTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetObjectivePacket.class) +public class JavaScoreboardObjectiveTranslator extends PacketTranslator { private final GeyserLogger logger = GeyserConnector.getInstance().getLogger(); @Override - public void translate(GeyserSession session, ServerScoreboardObjectivePacket packet) { + public void translate(GeyserSession session, ClientboundSetObjectivePacket packet) { WorldCache worldCache = session.getWorldCache(); Scoreboard scoreboard = worldCache.getScoreboard(); int pps = worldCache.increaseAndGetScoreboardPacketsPerSecond(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java index 95ea9be73..5de4abe83 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.connector.network.translators.java.scoreboard; import com.github.steveice10.mc.protocol.data.game.scoreboard.NameTagVisibility; import com.github.steveice10.mc.protocol.data.game.scoreboard.TeamAction; import com.github.steveice10.mc.protocol.data.game.scoreboard.TeamColor; -import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerTeamPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.scoreboard.ClientboundSetPlayerTeamPacket; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.GeyserLogger; import org.geysermc.connector.network.session.GeyserSession; @@ -43,12 +43,12 @@ import org.geysermc.connector.scoreboard.UpdateType; import java.util.Arrays; import java.util.Set; -@Translator(packet = ServerTeamPacket.class) -public class JavaTeamTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetPlayerTeamPacket.class) +public class JavaTeamTranslator extends PacketTranslator { private final GeyserLogger logger = GeyserConnector.getInstance().getLogger(); @Override - public void translate(GeyserSession session, ServerTeamPacket packet) { + public void translate(GeyserSession session, ClientboundSetPlayerTeamPacket packet) { if (logger.isDebug()) { logger.debug("Team packet " + packet.getTeamName() + " " + packet.getAction() + " " + Arrays.toString(packet.getPlayers())); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaUpdateScoreTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaUpdateScoreTranslator.java index 79d625fc7..c4d5b8ec3 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaUpdateScoreTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaUpdateScoreTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.connector.network.translators.java.scoreboard; import com.github.steveice10.mc.protocol.data.game.scoreboard.ScoreboardAction; import com.github.steveice10.mc.protocol.data.game.scoreboard.ScoreboardPosition; -import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerUpdateScorePacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.scoreboard.ClientboundSetScorePacket; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.packet.SetEntityDataPacket; import org.geysermc.connector.GeyserConnector; @@ -42,8 +42,8 @@ import org.geysermc.connector.scoreboard.Scoreboard; import org.geysermc.connector.scoreboard.ScoreboardUpdater; import org.geysermc.connector.utils.LanguageUtils; -@Translator(packet = ServerUpdateScorePacket.class) -public class JavaUpdateScoreTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetScorePacket.class) +public class JavaUpdateScoreTranslator extends PacketTranslator { private final GeyserLogger logger; public JavaUpdateScoreTranslator() { @@ -51,7 +51,7 @@ public class JavaUpdateScoreTranslator extends PacketTranslator { +@Translator(packet = ClientboundClearTitlesPacket.class) +public class JavaClearTitlesTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerClearTitlesPacket packet) { + public void translate(GeyserSession session, ClientboundClearTitlesPacket packet) { SetTitlePacket titlePacket = new SetTitlePacket(); // TODO handle packet.isResetTimes() titlePacket.setType(SetTitlePacket.Type.CLEAR); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetActionBarTextTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetActionBarTextTranslator.java index 516568b37..207599770 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetActionBarTextTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetActionBarTextTranslator.java @@ -25,18 +25,18 @@ package org.geysermc.connector.network.translators.java.title; -import com.github.steveice10.mc.protocol.packet.ingame.server.title.ServerSetActionBarTextPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.title.ClientboundSetActionBarTextPacket; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.chat.MessageTranslator; -@Translator(packet = ServerSetActionBarTextPacket.class) -public class JavaSetActionBarTextTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetActionBarTextPacket.class) +public class JavaSetActionBarTextTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSetActionBarTextPacket packet) { + public void translate(GeyserSession session, ClientboundSetActionBarTextPacket packet) { String text; if (packet.getText() == null) { //TODO 1.17 can this happen? text = " "; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetSubtitleTextTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetSubtitleTextTranslator.java index ee246ea11..e17debf6b 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetSubtitleTextTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetSubtitleTextTranslator.java @@ -25,18 +25,18 @@ package org.geysermc.connector.network.translators.java.title; -import com.github.steveice10.mc.protocol.packet.ingame.server.title.ServerSetSubtitleTextPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.title.ClientboundSetSubtitleTextPacket; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.chat.MessageTranslator; -@Translator(packet = ServerSetSubtitleTextPacket.class) -public class JavaSetSubtitleTextTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetSubtitleTextPacket.class) +public class JavaSetSubtitleTextTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSetSubtitleTextPacket packet) { + public void translate(GeyserSession session, ClientboundSetSubtitleTextPacket packet) { String text; if (packet.getText() == null) { //TODO 1.17 can this happen? text = " "; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitleTextTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitleTextTranslator.java index ddaa5b677..fb335fc76 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitleTextTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitleTextTranslator.java @@ -25,18 +25,18 @@ package org.geysermc.connector.network.translators.java.title; -import com.github.steveice10.mc.protocol.packet.ingame.server.title.ServerSetTitleTextPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.title.ClientboundSetTitleTextPacket; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.chat.MessageTranslator; -@Translator(packet = ServerSetTitleTextPacket.class) -public class JavaSetTitleTextTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetTitleTextPacket.class) +public class JavaSetTitleTextTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSetTitleTextPacket packet) { + public void translate(GeyserSession session, ClientboundSetTitleTextPacket packet) { String text; if (packet.getText() == null) { // This can happen, see https://github.com/KyoriPowered/adventure/issues/447 text = " "; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitlesAnimationTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitlesAnimationTranslator.java index 7514eef4c..20dcc9b3c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitlesAnimationTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitlesAnimationTranslator.java @@ -25,17 +25,17 @@ package org.geysermc.connector.network.translators.java.title; -import com.github.steveice10.mc.protocol.packet.ingame.server.title.ServerSetTitlesAnimationPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.title.ClientboundSetTitlesAnimationPacket; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerSetTitlesAnimationPacket.class) -public class JavaSetTitlesAnimationTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetTitlesAnimationPacket.class) +public class JavaSetTitlesAnimationTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSetTitlesAnimationPacket packet) { + public void translate(GeyserSession session, ClientboundSetTitlesAnimationPacket packet) { SetTitlePacket titlePacket = new SetTitlePacket(); titlePacket.setType(SetTitlePacket.Type.TIMES); titlePacket.setText(""); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaCloseWindowTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaCloseWindowTranslator.java index 419f4fc50..096e90684 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaCloseWindowTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaCloseWindowTranslator.java @@ -25,17 +25,17 @@ package org.geysermc.connector.network.translators.java.window; -import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerCloseWindowPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.window.ClientboundContainerClosePacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.utils.InventoryUtils; -@Translator(packet = ServerCloseWindowPacket.class) -public class JavaCloseWindowTranslator extends PacketTranslator { +@Translator(packet = ClientboundContainerClosePacket.class) +public class JavaCloseWindowTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerCloseWindowPacket packet) { + public void translate(GeyserSession session, ClientboundContainerClosePacket packet) { // Sometimes the server can request a window close of ID 0... when the window isn't even open // Don't confirm in this instance InventoryUtils.closeInventory(session, packet.getWindowId(), (session.getOpenInventory() != null && session.getOpenInventory().getId() == packet.getWindowId())); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaOpenHorseWindowTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaOpenHorseWindowTranslator.java index ecd74332b..aea462509 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaOpenHorseWindowTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaOpenHorseWindowTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.java.window; -import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerOpenHorseWindowPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.window.ClientboundHorseScreenOpenPacket; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.nbt.NbtType; @@ -49,8 +49,8 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -@Translator(packet = ServerOpenHorseWindowPacket.class) -public class JavaOpenHorseWindowTranslator extends PacketTranslator { +@Translator(packet = ClientboundHorseScreenOpenPacket.class) +public class JavaOpenHorseWindowTranslator extends PacketTranslator { private static final NbtMap ARMOR_SLOT; private static final NbtMap CARPET_SLOT; @@ -98,7 +98,7 @@ public class JavaOpenHorseWindowTranslator extends PacketTranslator { +@Translator(packet = ClientboundOpenScreenPacket.class) +public class JavaOpenWindowTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerOpenWindowPacket packet) { + public void translate(GeyserSession session, ClientboundOpenScreenPacket packet) { if (packet.getWindowId() == 0) { return; } InventoryTranslator newTranslator = InventoryTranslator.INVENTORY_TRANSLATORS.get(packet.getType()); Inventory openInventory = session.getOpenInventory(); - //No translator exists for this window type. Close all windows and return. + // No translator exists for this window type. Close all windows and return. if (newTranslator == null) { if (openInventory != null) { InventoryUtils.closeInventory(session, openInventory.getId(), true); } - ClientCloseWindowPacket closeWindowPacket = new ClientCloseWindowPacket(packet.getWindowId()); + ServerboundContainerClosePacket closeWindowPacket = new ServerboundContainerClosePacket(packet.getWindowId()); session.sendDownstreamPacket(closeWindowPacket); return; } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaSetSlotTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaSetSlotTranslator.java index 27f932c98..388d19984 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaSetSlotTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaSetSlotTranslator.java @@ -31,7 +31,7 @@ import com.github.steveice10.mc.protocol.data.game.recipe.Recipe; import com.github.steveice10.mc.protocol.data.game.recipe.RecipeType; import com.github.steveice10.mc.protocol.data.game.recipe.data.ShapedRecipeData; import com.github.steveice10.mc.protocol.data.game.recipe.data.ShapelessRecipeData; -import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerSetSlotPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.window.ClientboundContainerSetSlotPacket; import com.nukkitx.protocol.bedrock.data.inventory.ContainerId; import com.nukkitx.protocol.bedrock.data.inventory.CraftingData; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; @@ -54,11 +54,11 @@ import java.util.Objects; import java.util.UUID; import java.util.concurrent.TimeUnit; -@Translator(packet = ServerSetSlotPacket.class) -public class JavaSetSlotTranslator extends PacketTranslator { +@Translator(packet = ClientboundContainerSetSlotPacket.class) +public class JavaSetSlotTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSetSlotPacket packet) { + public void translate(GeyserSession session, ClientboundContainerSetSlotPacket packet) { if (packet.getWindowId() == 255) { //cursor GeyserItemStack newItem = GeyserItemStack.from(packet.getItem()); session.getPlayerInventory().setCursor(newItem, session); @@ -92,7 +92,7 @@ public class JavaSetSlotTranslator extends PacketTranslator } } - private static void updateCraftingGrid(GeyserSession session, ServerSetSlotPacket packet, Inventory inventory, InventoryTranslator translator) { + private static void updateCraftingGrid(GeyserSession session, ClientboundContainerSetSlotPacket packet, Inventory inventory, InventoryTranslator translator) { if (packet.getSlot() == 0) { int gridSize; if (translator instanceof PlayerInventoryTranslator) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaTradeListTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaTradeListTranslator.java similarity index 94% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaTradeListTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaTradeListTranslator.java index 556f8b95d..546c1ddfc 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaTradeListTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaTradeListTranslator.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.window; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.window.VillagerTrade; -import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerTradeListPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.window.ClientboundMerchantOffersPacket; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.nbt.NbtType; @@ -47,11 +47,11 @@ import org.geysermc.connector.registry.type.ItemMapping; import java.util.ArrayList; import java.util.List; -@Translator(packet = ServerTradeListPacket.class) -public class JavaTradeListTranslator extends PacketTranslator { +@Translator(packet = ClientboundMerchantOffersPacket.class) +public class JavaTradeListTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerTradeListPacket packet) { + public void translate(GeyserSession session, ClientboundMerchantOffersPacket packet) { Inventory openInventory = session.getOpenInventory(); if (!(openInventory instanceof MerchantContainer merchantInventory && openInventory.getId() == packet.getWindowId())) { return; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowItemsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowItemsTranslator.java index 542001dfb..589f0f6bb 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowItemsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowItemsTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.java.window; -import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerWindowItemsPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.window.ClientboundContainerSetContentPacket; import org.geysermc.connector.inventory.GeyserItemStack; import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.network.session.GeyserSession; @@ -34,11 +34,11 @@ import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.inventory.InventoryTranslator; import org.geysermc.connector.utils.InventoryUtils; -@Translator(packet = ServerWindowItemsPacket.class) -public class JavaWindowItemsTranslator extends PacketTranslator { +@Translator(packet = ClientboundContainerSetContentPacket.class) +public class JavaWindowItemsTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerWindowItemsPacket packet) { + public void translate(GeyserSession session, ClientboundContainerSetContentPacket packet) { Inventory inventory = InventoryUtils.getInventory(session, packet.getWindowId()); if (inventory == null) return; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowPropertyTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowPropertyTranslator.java index 512c797d2..7ce45b086 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowPropertyTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowPropertyTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.java.window; -import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerWindowPropertyPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.window.ClientboundContainerSetDataPacket; import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; @@ -33,11 +33,11 @@ import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.inventory.InventoryTranslator; import org.geysermc.connector.utils.InventoryUtils; -@Translator(packet = ServerWindowPropertyPacket.class) -public class JavaWindowPropertyTranslator extends PacketTranslator { +@Translator(packet = ClientboundContainerSetDataPacket.class) +public class JavaWindowPropertyTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerWindowPropertyPacket packet) { + public void translate(GeyserSession session, ClientboundContainerSetDataPacket packet) { Inventory inventory = InventoryUtils.getInventory(session, packet.getWindowId()); if (inventory == null) return; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/GeyserWorldManager.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/GeyserWorldManager.java index b797232dc..52d9c9b4a 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/GeyserWorldManager.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/GeyserWorldManager.java @@ -27,7 +27,7 @@ package org.geysermc.connector.network.translators.world; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.setting.Difficulty; -import com.github.steveice10.mc.protocol.packet.ingame.client.ClientChatPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundChatPacket; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; import it.unimi.dsi.fastutil.objects.Object2ObjectMap; @@ -82,7 +82,7 @@ public class GeyserWorldManager extends WorldManager { @Override public void setGameRule(GeyserSession session, String name, Object value) { - session.sendDownstreamPacket(new ClientChatPacket("/gamerule " + name + " " + value)); + session.sendDownstreamPacket(new ServerboundChatPacket("/gamerule " + name + " " + value)); gameruleCache.put(name, String.valueOf(value)); } @@ -108,12 +108,12 @@ public class GeyserWorldManager extends WorldManager { @Override public void setPlayerGameMode(GeyserSession session, GameMode gameMode) { - session.sendDownstreamPacket(new ClientChatPacket("/gamemode " + gameMode.name().toLowerCase())); + session.sendDownstreamPacket(new ServerboundChatPacket("/gamemode " + gameMode.name().toLowerCase())); } @Override public void setDifficulty(GeyserSession session, Difficulty difficulty) { - session.sendDownstreamPacket(new ClientChatPacket("/difficulty " + difficulty.name().toLowerCase())); + session.sendDownstreamPacket(new ServerboundChatPacket("/difficulty " + difficulty.name().toLowerCase())); } @Override diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntity.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntity.java index b255fa5d7..f698d43f2 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntity.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntity.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.world.block.entity; -import com.github.steveice10.mc.protocol.data.game.world.block.value.PistonValueType; +import com.github.steveice10.mc.protocol.data.game.level.block.value.PistonValueType; import com.nukkitx.math.vector.Vector3d; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3i; diff --git a/connector/src/main/java/org/geysermc/connector/registry/Registries.java b/connector/src/main/java/org/geysermc/connector/registry/Registries.java index 3447bdfc8..7487d5723 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/Registries.java +++ b/connector/src/main/java/org/geysermc/connector/registry/Registries.java @@ -27,8 +27,8 @@ package org.geysermc.connector.registry; import com.github.steveice10.mc.protocol.data.game.recipe.Recipe; import com.github.steveice10.mc.protocol.data.game.recipe.RecipeType; -import com.github.steveice10.mc.protocol.data.game.world.effect.SoundEffect; -import com.github.steveice10.mc.protocol.data.game.world.particle.ParticleType; +import com.github.steveice10.mc.protocol.data.game.level.effect.SoundEffect; +import com.github.steveice10.mc.protocol.data.game.level.particle.ParticleType; import com.nukkitx.nbt.NbtMap; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.data.inventory.CraftingData; diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/ParticleTypesRegistryLoader.java b/connector/src/main/java/org/geysermc/connector/registry/loader/ParticleTypesRegistryLoader.java index 4284506f9..9de4b946f 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/loader/ParticleTypesRegistryLoader.java +++ b/connector/src/main/java/org/geysermc/connector/registry/loader/ParticleTypesRegistryLoader.java @@ -26,7 +26,7 @@ package org.geysermc.connector.registry.loader; import com.fasterxml.jackson.databind.JsonNode; -import com.github.steveice10.mc.protocol.data.game.world.particle.ParticleType; +import com.github.steveice10.mc.protocol.data.game.level.particle.ParticleType; import com.nukkitx.protocol.bedrock.data.LevelEventType; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.geysermc.connector.registry.type.ParticleMapping; diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/SoundEffectsRegistryLoader.java b/connector/src/main/java/org/geysermc/connector/registry/loader/SoundEffectsRegistryLoader.java index 4e44ac095..93f1e3fc4 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/loader/SoundEffectsRegistryLoader.java +++ b/connector/src/main/java/org/geysermc/connector/registry/loader/SoundEffectsRegistryLoader.java @@ -26,7 +26,7 @@ package org.geysermc.connector.registry.loader; import com.fasterxml.jackson.databind.JsonNode; -import com.github.steveice10.mc.protocol.data.game.world.effect.SoundEffect; +import com.github.steveice10.mc.protocol.data.game.level.effect.SoundEffect; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.data.SoundEvent; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; diff --git a/connector/src/main/java/org/geysermc/connector/utils/BedrockMapIcon.java b/connector/src/main/java/org/geysermc/connector/utils/BedrockMapIcon.java index 95e0f809d..8b9a5dca3 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/BedrockMapIcon.java +++ b/connector/src/main/java/org/geysermc/connector/utils/BedrockMapIcon.java @@ -25,7 +25,7 @@ package org.geysermc.connector.utils; -import com.github.steveice10.mc.protocol.data.game.world.map.MapIconType; +import com.github.steveice10.mc.protocol.data.game.level.map.MapIconType; import lombok.Getter; public enum BedrockMapIcon { diff --git a/connector/src/main/java/org/geysermc/connector/utils/BlockUtils.java b/connector/src/main/java/org/geysermc/connector/utils/BlockUtils.java index 723d0bd99..86b40093e 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/BlockUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/BlockUtils.java @@ -196,7 +196,7 @@ public class BlockUtils { /** * Given a position, return the position if a block were located on the specified block face. * @param blockPos the block position - * @param face the face of the block - see {@link com.github.steveice10.mc.protocol.data.game.world.block.BlockFace} + * @param face the face of the block - see {@link com.github.steveice10.mc.protocol.data.game.level.block.BlockFace} * @return the block position with the block face accounted for */ public static Vector3i getBlockPosition(Vector3i blockPos, int face) { diff --git a/connector/src/main/java/org/geysermc/connector/utils/DimensionUtils.java b/connector/src/main/java/org/geysermc/connector/utils/DimensionUtils.java index 632e17280..a1668acf0 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/DimensionUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/DimensionUtils.java @@ -119,8 +119,8 @@ public class DimensionUtils { } /** - * Determines the new dimension based on the {@link CompoundTag} sent by either the {@link com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket} - * or {@link com.github.steveice10.mc.protocol.packet.ingame.server.ServerRespawnPacket}. + * Determines the new dimension based on the {@link CompoundTag} sent by either the {@link com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundLoginPacket} + * or {@link com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundRespawnPacket}. * * @param dimensionTag the packet's dimension tag. * @return the dimension identifier. diff --git a/connector/src/main/java/org/geysermc/connector/utils/Direction.java b/connector/src/main/java/org/geysermc/connector/utils/Direction.java index 7cde4a0ac..5a6bea349 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/Direction.java +++ b/connector/src/main/java/org/geysermc/connector/utils/Direction.java @@ -25,7 +25,7 @@ package org.geysermc.connector.utils; -import com.github.steveice10.mc.protocol.data.game.world.block.value.PistonValue; +import com.github.steveice10.mc.protocol.data.game.level.block.value.PistonValue; import com.nukkitx.math.vector.Vector3i; import lombok.Getter; diff --git a/connector/src/main/java/org/geysermc/connector/utils/EffectUtils.java b/connector/src/main/java/org/geysermc/connector/utils/EffectUtils.java index b79476e9c..692b26d85 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/EffectUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/EffectUtils.java @@ -25,7 +25,7 @@ package org.geysermc.connector.utils; -import com.github.steveice10.mc.protocol.data.game.world.particle.ParticleType; +import com.github.steveice10.mc.protocol.data.game.level.particle.ParticleType; import com.nukkitx.protocol.bedrock.data.LevelEventType; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.registry.Registries; diff --git a/connector/src/main/java/org/geysermc/connector/utils/InventoryUtils.java b/connector/src/main/java/org/geysermc/connector/utils/InventoryUtils.java index d5978a7f5..3d61d428a 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/InventoryUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/InventoryUtils.java @@ -27,8 +27,8 @@ package org.geysermc.connector.utils; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; -import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientCreativeInventoryActionPacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientMoveItemToHotbarPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundPickItemPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundSetCreativeModeSlotPacket; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; @@ -210,7 +210,7 @@ public class InventoryUtils { } // If this is the item we're looking for if (geyserItem.getJavaId() == itemStack.getId() && Objects.equals(geyserItem.getNbt(), itemStack.getNbt())) { - ClientMoveItemToHotbarPacket packetToSend = new ClientMoveItemToHotbarPacket(i); // https://wiki.vg/Protocol#Pick_Item + ServerboundPickItemPacket packetToSend = new ServerboundPickItemPacket(i); // https://wiki.vg/Protocol#Pick_Item session.sendDownstreamPacket(packetToSend); return; } @@ -220,7 +220,7 @@ public class InventoryUtils { if (session.getGameMode() == GameMode.CREATIVE) { int slot = findEmptyHotbarSlot(inventory); - ClientCreativeInventoryActionPacket actionPacket = new ClientCreativeInventoryActionPacket(slot, + ServerboundSetCreativeModeSlotPacket actionPacket = new ServerboundSetCreativeModeSlotPacket(slot, itemStack); if ((slot - 36) != inventory.getHeldItemSlot()) { setHotbarItem(session, slot); @@ -275,7 +275,7 @@ public class InventoryUtils { continue; } - ClientMoveItemToHotbarPacket packetToSend = new ClientMoveItemToHotbarPacket(i); // https://wiki.vg/Protocol#Pick_Item + ServerboundPickItemPacket packetToSend = new ServerboundPickItemPacket(i); // https://wiki.vg/Protocol#Pick_Item session.sendDownstreamPacket(packetToSend); return; } @@ -286,7 +286,7 @@ public class InventoryUtils { ItemMapping mapping = session.getItemMappings().getMapping(itemName); if (mapping != null) { - ClientCreativeInventoryActionPacket actionPacket = new ClientCreativeInventoryActionPacket(slot, + ServerboundSetCreativeModeSlotPacket actionPacket = new ServerboundSetCreativeModeSlotPacket(slot, new ItemStack(mapping.getJavaId())); if ((slot - 36) != inventory.getHeldItemSlot()) { setHotbarItem(session, slot); diff --git a/connector/src/main/java/org/geysermc/connector/utils/PluginMessageUtils.java b/connector/src/main/java/org/geysermc/connector/utils/PluginMessageUtils.java index a914f699e..686dadd17 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/PluginMessageUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/PluginMessageUtils.java @@ -25,7 +25,7 @@ package org.geysermc.connector.utils; -import com.github.steveice10.mc.protocol.packet.ingame.client.ClientPluginMessagePacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCustomPayloadPacket; import com.google.common.base.Charsets; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.network.session.GeyserSession; @@ -74,7 +74,7 @@ public class PluginMessageUtils { } public static void sendMessage(GeyserSession session, String channel, byte[] data) { - session.sendDownstreamPacket(new ClientPluginMessagePacket(channel, data)); + session.sendDownstreamPacket(new ServerboundCustomPayloadPacket(channel, data)); } private static byte[] writeVarInt(int value) {