Skip to content

Commit

Permalink
Sorted packets
Browse files Browse the repository at this point in the history
  • Loading branch information
Nelonn committed Feb 18, 2024
1 parent c8906f6 commit 5fd83d5
Show file tree
Hide file tree
Showing 124 changed files with 206 additions and 222 deletions.
36 changes: 18 additions & 18 deletions Source/Runtime/Core/listeners/login_packet_listener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@

#include "../daft_hash.h"
#include "../network/pipeline/handlers.h"
#include "../network/protocol/clientbound_change_difficulty.h"
#include "../network/protocol/clientbound_chunk_data.h"
#include "../network/protocol/clientbound_commands.h"
#include "../network/protocol/clientbound_encryption_request.h"
#include "../network/protocol/clientbound_initialize_world_border.h"
#include "../network/protocol/clientbound_keepalive.h"
#include "../network/protocol/clientbound_login.h"
#include "../network/protocol/clientbound_login_disconnect.h"
#include "../network/protocol/clientbound_login_success.h"
#include "../network/protocol/clientbound_player_abilities.h"
#include "../network/protocol/clientbound_plugin_message.h"
#include "../network/protocol/clientbound_set_center_chunk.h"
#include "../network/protocol/clientbound_set_compression.h"
#include "../network/protocol/clientbound_set_default_spawn_position.h"
#include "../network/protocol/clientbound_synchronize_player_position.h"
#include "../network/protocol/clientbound_system_message.h"
#include "../network/protocol/common/clientbound_custom_payload.h"
#include "../network/protocol/common/clientbound_keepalive.h"
#include "../network/protocol/game/clientbound_change_difficulty.h"
#include "../network/protocol/game/clientbound_chunk_data.h"
#include "../network/protocol/game/clientbound_commands.h"
#include "../network/protocol/game/clientbound_initialize_world_border.h"
#include "../network/protocol/game/clientbound_player_abilities.h"
#include "../network/protocol/game/clientbound_set_center_chunk.h"
#include "../network/protocol/game/clientbound_set_default_spawn_position.h"
#include "../network/protocol/game/clientbound_synchronize_player_position.h"
#include "../network/protocol/game/clientbound_system_message.h"
#include "../network/protocol/login/clientbound_encryption_request.h"
#include "../network/protocol/login/clientbound_login.h"
#include "../network/protocol/login/clientbound_login_disconnect.h"
#include "../network/protocol/login/clientbound_login_success.h"
#include "../network/protocol/login/clientbound_set_compression.h"
#include "../network/protocol/plugin_channels.h"
#include "../registry_codec.h"
#include "../world/level/world.h"
#include "../time.h"
#include "../world/level/world.h"
#include "play_packet_listener.h"

using namespace std::chrono_literals;
Expand Down Expand Up @@ -151,7 +151,7 @@ static void continueLogin(ConnectionContext* ctx) {
ctx->write(login);
delete login;

auto* brandMessage = new ClientboundPluginMessage();
auto* brandMessage = new ClientboundCustomPayload();
brandMessage->channel = BRAND_CHANNEL;
brandMessage->data.writeString("Mycelium");// TODO: ctx->gameServer->getBrand();
ctx->write(brandMessage);
Expand Down
4 changes: 2 additions & 2 deletions Source/Runtime/Core/listeners/login_packet_listener.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once

#include "../connection_context.h"
#include "../network/protocol/serverbound_encryption_response.h"
#include "../network/protocol/serverbound_login_start.h"
#include "../network/protocol/login/serverbound_encryption_response.h"
#include "../network/protocol/login/serverbound_login_start.h"

class LoginPacketListener {
public:
Expand Down
34 changes: 17 additions & 17 deletions Source/Runtime/Core/listeners/play_packet_listener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,29 @@

#include "play_packet_listener.h"

#include "../network/protocol/clientbound_ack_block_change.h"
#include "../network/protocol/clientbound_block_update.h"
#include "../network/protocol/clientbound_chunk_data.h"
#include "../network/protocol/clientbound_entity_animation.h"
#include "../network/protocol/clientbound_set_center_chunk.h"
#include "../network/protocol/clientbound_set_entity_metadata.h"
#include "../network/protocol/clientbound_set_head_rotation.h"
#include "../network/protocol/clientbound_suggestions_response.h"
#include "../network/protocol/clientbound_system_message.h"
#include "../network/protocol/clientbound_unload_chunk.h"
#include "../network/protocol/clientbound_update_entity_position.h"
#include "../network/protocol/clientbound_update_entity_position_rotation.h"
#include "../network/protocol/clientbound_update_entity_rotation.h"
#include <iostream>
#include <nlohmann/json.hpp>
#include <regex>

#include "../network/protocol/game/clientbound_ack_block_change.h"
#include "../network/protocol/game/clientbound_block_update.h"
#include "../network/protocol/game/clientbound_chunk_data.h"
#include "../network/protocol/game/clientbound_entity_animation.h"
#include "../network/protocol/game/clientbound_set_center_chunk.h"
#include "../network/protocol/game/clientbound_set_entity_metadata.h"
#include "../network/protocol/game/clientbound_set_head_rotation.h"
#include "../network/protocol/game/clientbound_suggestions_response.h"
#include "../network/protocol/game/clientbound_system_message.h"
#include "../network/protocol/game/clientbound_unload_chunk.h"
#include "../network/protocol/game/clientbound_update_entity_position.h"
#include "../network/protocol/game/clientbound_update_entity_position_rotation.h"
#include "../network/protocol/game/clientbound_update_entity_rotation.h"
#include "../network/protocol/plugin_channels.h"
#include "../server/dimension.h"
#include "../world/entity/metadata/player_metadata.h"
#include "../world/item/builtin/block_item.h"
#include "../world/item/builtin/item_registry.h"

#include <iostream>
#include <regex>
#include <nlohmann/json.hpp>

PlayPacketListener::PlayPacketListener() = default;
PlayPacketListener::~PlayPacketListener() = default;

Expand Down
33 changes: 17 additions & 16 deletions Source/Runtime/Core/listeners/play_packet_listener.h
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
#pragma once

#include <unordered_set>

#include "../connection_context.h"
#include "../network/protocol/serverbound_chat_command.h"
#include "../network/protocol/serverbound_chat_message.h"
#include "../network/protocol/serverbound_click_container.h"
#include "../network/protocol/serverbound_client_information.h"
#include "../network/protocol/serverbound_command_suggestion_request.h"
#include "../network/protocol/serverbound_confirm_teleportation.h"
#include "../network/protocol/serverbound_player_action.h"
#include "../network/protocol/serverbound_plugin_message.h"
#include "../network/protocol/serverbound_set_creative_mode_slot.h"
#include "../network/protocol/serverbound_set_held_item.h"
#include "../network/protocol/serverbound_set_player_position.h"
#include "../network/protocol/serverbound_set_player_position_rotation.h"
#include "../network/protocol/serverbound_set_player_rotation.h"
#include "../network/protocol/serverbound_swing_arm.h"
#include "../network/protocol/serverbound_use_item_on.h"
#include "../network/protocol/common/serverbound_client_information.h"
#include "../network/protocol/game/serverbound_chat_command.h"
#include "../network/protocol/game/serverbound_chat_message.h"
#include "../network/protocol/game/serverbound_click_container.h"
#include "../network/protocol/game/serverbound_command_suggestion_request.h"
#include "../network/protocol/game/serverbound_confirm_teleportation.h"
#include "../network/protocol/game/serverbound_player_action.h"
#include "../network/protocol/game/serverbound_plugin_message.h"
#include "../network/protocol/game/serverbound_set_creative_mode_slot.h"
#include "../network/protocol/game/serverbound_set_held_item.h"
#include "../network/protocol/game/serverbound_set_player_position.h"
#include "../network/protocol/game/serverbound_set_player_position_rotation.h"
#include "../network/protocol/game/serverbound_set_player_rotation.h"
#include "../network/protocol/game/serverbound_swing_arm.h"
#include "../network/protocol/game/serverbound_use_item_on.h"
#include "../world/level/world.h"
#include <unordered_set>

class PlayPacketListener {
public:
Expand Down
4 changes: 2 additions & 2 deletions Source/Runtime/Core/listeners/status_packet_listener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

#include <iostream>

#include "../network/protocol/clientbound_ping_response.h"
#include "../network/protocol/clientbound_status_response.h"
#include "../network/protocol/status/clientbound_ping_response.h"
#include "../network/protocol/status/clientbound_status_response.h"

StatusPacketListener::StatusPacketListener() = default;
StatusPacketListener::~StatusPacketListener() = default;
Expand Down
4 changes: 2 additions & 2 deletions Source/Runtime/Core/listeners/status_packet_listener.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once

#include "../connection_context.h"
#include "../network/protocol/serverbound_ping_request.h"
#include "../network/protocol/serverbound_status_request.h"
#include "../network/protocol/status/serverbound_ping_request.h"
#include "../network/protocol/status/serverbound_status_request.h"

class StatusPacketListener {
public:
Expand Down
17 changes: 0 additions & 17 deletions Source/Runtime/Core/network/byte_buffer.h
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
// Mycelium
// Copyright (C) 2022 - 2023 JNNGL
// Copyright (C) 2024 Michael Neonov
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

#pragma once

#include <filesystem>
Expand Down
2 changes: 1 addition & 1 deletion Source/Runtime/Core/network/pipeline/packet_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "../../listeners/login_packet_listener.h"
#include "../../listeners/play_packet_listener.h"
#include "../../listeners/status_packet_listener.h"
#include "../protocol/clientbound_system_message.h"
#include "../protocol/game/clientbound_system_message.h"
#include "../protocol/packet.h"
#include "handlers.h"

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@


#include "clientbound_custom_payload.h"

ClientboundCustomPayload::ClientboundCustomPayload() = default;
ClientboundCustomPayload::~ClientboundCustomPayload() = default;

void ClientboundCustomPayload::write(ByteBuffer& out) {
out.writeString(channel);
out.writeBytes(data);
}

int ClientboundCustomPayload::getPacketID() const {
return 0x16;
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#pragma once

#include "packet.h"
#include "../packet.h"

class ClientboundPluginMessage : public ClientboundPacket {
class ClientboundCustomPayload : public ClientboundPacket {
public:
ClientboundPluginMessage();
~ClientboundPluginMessage();
ClientboundCustomPayload();
~ClientboundCustomPayload();

public:
void write(ByteBuffer&) override;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "packet.h"
#include "../packet.h"

class ClientboundDisconnect : public ClientboundPacket {
public:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "packet.h"
#include "../packet.h"

class ClientboundKeepAlive : public ClientboundPacket {
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "serverbound_client_information.h"

#include "../../listeners/play_packet_listener.h"
#include "../../../listeners/play_packet_listener.h"

ServerboundClientInformation::ServerboundClientInformation() = default;
ServerboundClientInformation::~ServerboundClientInformation() = default;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "packet.h"
#include "../packet.h"

class ServerboundClientInformation : public ServerboundPacket {
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "serverbound_keepalive.h"

#include "clientbound_player_info.h"
#include "../game/clientbound_player_info.h"

ServerboundKeepAlive::ServerboundKeepAlive() = default;
ServerboundKeepAlive::~ServerboundKeepAlive() = default;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "packet.h"
#include "../packet.h"

class ServerboundKeepAlive : public ServerboundPacket {
public:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "packet.h"
#include "../packet.h"

class ClientboundAckBlockChange : public ClientboundPacket {
public:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "packet.h"
#include "../packet.h"

class ClientboundBlockUpdate : public ClientboundPacket {
public:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include "../../server/difficulty.h"
#include "packet.h"
#include "../../../server/difficulty.h"
#include "../packet.h"

class ClientboundChangeDifficulty : public ClientboundPacket {
public:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include "../../world/level/chunk.h"
#include "packet.h"
#include "../../../world/level/chunk.h"
#include "../packet.h"

class ClientboundChunkData : public ClientboundPacket {
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "clientbound_commands.h"

#include "../../server/command/command_graph.h"
#include "../../../server/command/command_graph.h"

ClientboundCommands::ClientboundCommands() = default;
ClientboundCommands::~ClientboundCommands() = default;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "packet.h"
#include "../packet.h"

class ClientboundCommands : public ClientboundPacket {
public:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "packet.h"
#include "../packet.h"

class ClientboundEntityAnimation : public ClientboundPacket {
public:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include "../../world/level/world_border.h"
#include "packet.h"
#include "../../../world/level/world_border.h"
#include "../packet.h"

class ClientboundInitializeWorldBorder : public ClientboundPacket {
public:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "packet.h"
#include "../packet.h"

class ClientboundPlayerAbilities : public ClientboundPacket {
public:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once

#include "../../server/gamemode.h"
#include "packet.h"
#include "signature_data.h"
#include "../../../server/gamemode.h"
#include "../packet.h"
#include "../signature_data.h"

class ClientboundPlayerInfo : public ClientboundPacket {
public:
Expand Down
Loading

0 comments on commit 5fd83d5

Please sign in to comment.