From abba018da3c2c8011b1485ee8e9e5b2690659c76 Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Sat, 14 Oct 2017 21:40:34 +0500 Subject: 2017-10-14 --- src/Chat.cpp | 36 ++++++++ src/Chat.hpp | 24 +++++ src/Event.hpp | 14 ++- src/GameState.cpp | 6 +- src/GlobalState.cpp | 5 +- src/Network.cpp | 8 +- src/NetworkClient.cpp | 2 +- src/Packet.hpp | 42 ++++++++- src/Render.cpp | 242 +++++++++++++++++++++++++++++--------------------- src/Render.hpp | 4 +- src/Stream.cpp | 33 ++++--- src/Stream.hpp | 19 ++-- src/Utility.hpp | 2 +- 13 files changed, 296 insertions(+), 141 deletions(-) create mode 100644 src/Chat.cpp create mode 100644 src/Chat.hpp (limited to 'src') diff --git a/src/Chat.cpp b/src/Chat.cpp new file mode 100644 index 0000000..0857d6c --- /dev/null +++ b/src/Chat.cpp @@ -0,0 +1,36 @@ +#include "Chat.hpp" + +#include +#include + +Chat::Chat(const std::string &str) { + using nlohmann::json; + json j = json::parse(str); + + /*LOG(WARNING) << j.dump(4); + + std::function iterating = [&](json::iterator iter) { + json val = *iter; + + if (val.is_object() && val.find("text") != val.end()) { + text.append(val["text"].get()); + } + + if (val.is_array() || val.is_object()) { + for (auto it = val.begin(); it != val.end(); ++it) { + iterating(it); + } + } + }; + + for (auto it = j.begin(); it != j.end(); ++it) { + iterating(it); + }*/ + + text = j.dump(4); +} + +std::string Chat::ToJson() const { + throw std::logic_error("Chat not deserealizable"); + return text; +} \ No newline at end of file diff --git a/src/Chat.hpp b/src/Chat.hpp new file mode 100644 index 0000000..4d147be --- /dev/null +++ b/src/Chat.hpp @@ -0,0 +1,24 @@ +#pragma once + +#include + +struct TextModifier { + size_t offset; + size_t length; + enum { + Italic, + Bold, + Underline, + } type; +}; + +struct Chat { + std::vector modifiers; + std::string text; + + Chat(const std::string &str); + + Chat() = default; + + std::string ToJson() const; +}; \ No newline at end of file diff --git a/src/Event.hpp b/src/Event.hpp index 9ee445a..d2ddb15 100644 --- a/src/Event.hpp +++ b/src/Event.hpp @@ -43,6 +43,8 @@ enum class EventType { BlockChange, RendererWorkerTask, ChunkDeleted, + ChatMessageReceived, + SendChatMessage, }; struct EchoData { @@ -165,13 +167,23 @@ struct ChunkDeletedData { Vector pos; }; +struct ChatMessageReceivedData { + Chat message; + unsigned char position; +}; + +struct SendChatMessageData { + std::string message; +}; + using EventData = std::variant; + BlockChangeData, RendererWorkerTaskData, ChunkDeletedData, ChatMessageReceivedData, + SendChatMessageData>; struct Event { EventType type; diff --git a/src/GameState.cpp b/src/GameState.cpp index 3020bde..945824f 100644 --- a/src/GameState.cpp +++ b/src/GameState.cpp @@ -113,8 +113,12 @@ void GameState::UpdatePacket(NetworkClient *nc) break; case TabCompleteCB: break; - case ChatMessageCB: + case ChatMessageCB: { + auto packet = std::static_pointer_cast(ptr); + LOG(INFO) << "Message (" << int(packet->Position) << "): " << packet->JsonData.text; + EventAgregator::PushEvent(EventType::ChatMessageReceived, ChatMessageReceivedData{ packet->JsonData,packet->Position }); break; + } case MultiBlockChange: { auto packet = std::static_pointer_cast(ptr); world.ParseChunkData(packet); diff --git a/src/GlobalState.cpp b/src/GlobalState.cpp index 49dbf2b..78fba0e 100644 --- a/src/GlobalState.cpp +++ b/src/GlobalState.cpp @@ -78,13 +78,16 @@ void InitEvents() { }); listener.RegisterHandler(EventType::Disconnected, [](EventData eventData) { - std::this_thread::sleep_for(std::chrono::milliseconds(500)); if (!gs) return; isPhysRunning = false; threadPhys.join(); gs.reset(); }); + + listener.RegisterHandler(EventType::SendChatMessage, [](EventData eventData) { + nc->SendPacket(std::make_shared(std::get(eventData).message)); + }); } void PhysExec() { diff --git a/src/Network.cpp b/src/Network.cpp index 9cb2097..2c14327 100644 --- a/src/Network.cpp +++ b/src/Network.cpp @@ -93,11 +93,7 @@ void Network::SendPacket(Packet &packet, int compressionThreshold) { stream->WriteVarInt(packet.GetPacketId()); packet.ToStream(stream); } else { - throw std::runtime_error("Compressing data"); - /*StreamBuffer buffer(packetSize.GetCountedSize()); - packet.ToStream(&buffer); - - z_stream stream;*/ + throw std::runtime_error("Compressing send data not supported"); } } else { @@ -177,7 +173,7 @@ std::shared_ptr Network::ParsePacketPlay(PacketNamePlayCB id) { case TabCompleteCB: break; case ChatMessageCB: - break; + return std::make_shared(); case MultiBlockChange: return std::make_shared(); case ConfirmTransactionCB: diff --git a/src/NetworkClient.cpp b/src/NetworkClient.cpp index dd467e8..36c6912 100644 --- a/src/NetworkClient.cpp +++ b/src/NetworkClient.cpp @@ -13,7 +13,7 @@ NetworkClient::NetworkClient(std::string address, unsigned short port, std::stri state = Login; PacketLoginStart loginStart; - loginStart.Username = "HelloOne"; + loginStart.Username = username; network.SendPacket(loginStart); diff --git a/src/Packet.hpp b/src/Packet.hpp index 0470015..f31fa59 100644 --- a/src/Packet.hpp +++ b/src/Packet.hpp @@ -241,7 +241,7 @@ struct PacketDisconnectPlay : Packet { } void FromStream(StreamInput *stream) override { - Reason = stream->ReadChat(); + Reason = stream->ReadChat().text; } int GetPacketId() override { @@ -861,7 +861,7 @@ struct PacketOpenWindow : Packet { void FromStream(StreamInput *stream) override { WindowId = stream->ReadUByte(); WindowType = stream->ReadString(); - WindowTitle = stream->ReadChat(); + WindowTitle = stream->ReadChat().text; NumberOfSlots = stream->ReadUByte(); if (WindowType == "EntityHorse") @@ -1032,7 +1032,7 @@ struct PacketDisconnect : Packet { } void FromStream(StreamInput *stream) override { - Reason = stream->ReadChat(); + Reason = stream->ReadChat().text; } int GetPacketId() override { @@ -1056,4 +1056,40 @@ struct PacketSetCompression : Packet { } int Threshold; +}; + +struct PacketChatMessageCB : Packet { + void ToStream(StreamOutput *stream) override { + + } + + void FromStream(StreamInput *stream) override { + JsonData = stream->ReadChat(); + Position = stream->ReadByte(); + } + + int GetPacketId() override { + return PacketNamePlayCB::ChatMessageCB; + } + + Chat JsonData; + unsigned char Position; +}; + +struct PacketChatMessageSB : Packet { + void ToStream(StreamOutput *stream) override { + stream->WriteString(Message); + } + + void FromStream(StreamInput *stream) override { + + } + + int GetPacketId() override { + return PacketNamePlaySB::ChatMessageSB; + } + + std::string Message; + + PacketChatMessageSB(const std::string msg) : Message(msg) {}; }; \ No newline at end of file diff --git a/src/Render.cpp b/src/Render.cpp index 6bf3eb3..316efec 100644 --- a/src/Render.cpp +++ b/src/Render.cpp @@ -154,9 +154,8 @@ void Render::HandleEvents() { case SDL_WINDOWEVENT_FOCUS_LOST: HasFocus = false; SetMouseCapture(false); - if (state == GameState::Playing) + if (state == GameState::Inventory || state == GameState::Playing || state == GameState::Chat) state = GameState::Paused; - isDisplayInventory = false; break; } break; @@ -164,26 +163,49 @@ void Render::HandleEvents() { case SDL_KEYDOWN: switch (event.key.keysym.scancode) { case SDL_SCANCODE_ESCAPE: - if (state == GameState::Playing) { + switch (state) { + case GameState::Playing: state = GameState::Paused; SetMouseCapture(false); - isDisplayInventory = false; - } - else if (state == GameState::Paused) { + break; + case GameState::Inventory: state = GameState::Playing; SetMouseCapture(true); - } - else if (state == GameState::MainMenu) { + break; + case GameState::Paused: + state = GameState::Playing; + SetMouseCapture(true); + break; + case GameState::MainMenu: LOG(INFO) << "Received close event by esc"; isRunning = false; - } + break; + } break; case SDL_SCANCODE_E: - if (state != GameState::Playing) - return; - isDisplayInventory = !isDisplayInventory; - SetMouseCapture(!isDisplayInventory); - break; + switch (state) { + case GameState::Playing: + state = GameState::Inventory; + SetMouseCapture(false); + break; + case GameState::Inventory: + state = GameState::Playing; + SetMouseCapture(true); + break; + } + break; + case SDL_SCANCODE_T: + switch (state) { + case GameState::Playing: + state = GameState::Chat; + SetMouseCapture(false); + break; + case GameState::Chat: + state = GameState::Playing; + SetMouseCapture(true); + break; + } + break; } break; case SDL_MOUSEMOTION: @@ -264,6 +286,12 @@ void Render::ExecuteRenderLoop() { state = GameState::Loading; }); + listener.RegisterHandler(EventType::ChatMessageReceived, [this](EventData eventData) { + auto data = std::get(eventData); + std::string msg = "(" + std::to_string((int)data.position) + ") " + data.message.text; + chatMessages.push_back(msg); + }); + state = GameState::MainMenu; while (isRunning) { @@ -290,21 +318,21 @@ void Render::RenderGui() { } const ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings; - //ImGui::ShowTestWindow(); + ImGui::ShowTestWindow(); ImGui::SetNextWindowPos(ImVec2(10, 10)); ImGui::Begin("DebugInfo", 0, ImVec2(0, 0), 0.4f, windowFlags); ImGui::Text("Debug Info:"); ImGui::Separator(); ImGui::Text("State: %s", stateString.c_str()); - ImGui::Text("FPS: %.1f (%.3fms)", ImGui::GetIO().Framerate, 1000.0f / ImGui::GetIO().Framerate); - float gameTime = DebugInfo::gameThreadTime / 100.0f; + ImGui::Text("FPS: %.1f (%.3fms)", ImGui::GetIO().Framerate, 1000.0f / ImGui::GetIO().Framerate); + float gameTime = DebugInfo::gameThreadTime / 100.0f; if (world) { ImGui::Text("TPS: %.1f (%.2fms)", 1000.0f / gameTime, gameTime); ImGui::Text("Sections loaded: %d", (int)DebugInfo::totalSections); ImGui::Text("SectionsRenderer: %d (%d)", (int)DebugInfo::renderSections, (int)DebugInfo::readyRenderer); ImGui::Text("Culled sections: %d", (int)DebugInfo::renderSections - world->culledSections); - ImGui::Text("Player pos: %.1f %.1f %.1f OnGround=%d", world->GameStatePtr()->player->pos.x, world->GameStatePtr()->player->pos.y, world->GameStatePtr()->player->pos.z,world->GameStatePtr()->player->onGround); + ImGui::Text("Player pos: %.1f %.1f %.1f OnGround=%d", world->GameStatePtr()->player->pos.x, world->GameStatePtr()->player->pos.y, world->GameStatePtr()->player->pos.z, world->GameStatePtr()->player->onGround); ImGui::Text("Player vel: %.1f %.1f %.1f", world->GameStatePtr()->player->vel.x, world->GameStatePtr()->player->vel.y, world->GameStatePtr()->player->vel.z); ImGui::Text("Player health: %.1f/%.1f", world->GameStatePtr()->g_PlayerHealth, 20.0f); } @@ -314,7 +342,7 @@ void Render::RenderGui() { switch (state) { case GameState::MainMenu: { ImGui::SetNextWindowPosCenter(); - ImGui::Begin("Menu",0, windowFlags); + ImGui::Begin("Menu", 0, windowFlags); static char buff[512] = "127.0.0.1"; static int port = 25565; static char buffName[512] = "HelloOne"; @@ -323,7 +351,7 @@ void Render::RenderGui() { } ImGui::InputText("Username", buffName, 512); ImGui::InputText("Address", buff, 512); - ImGui::InputInt("Port", &port); + ImGui::InputInt("Port", &port); ImGui::Separator(); if (ImGui::Button("Exit")) isRunning = false; @@ -332,96 +360,112 @@ void Render::RenderGui() { } case GameState::Loading: break; - case GameState::Playing: - if (isDisplayInventory) { - auto renderSlot = [](const SlotData &slot, int i) -> bool { - return ImGui::Button(((slot.BlockId == -1 ? " ##" : - AssetManager::Instance().GetAssetNameByBlockId(BlockId{ (unsigned short)slot.BlockId,0 }) +" x"+std::to_string(slot.ItemCount) + "##") - + std::to_string(i)).c_str()); - }; - ImGui::SetNextWindowPosCenter(); - ImGui::Begin("Inventory", 0, windowFlags); - Window& inventory = world->GameStatePtr()->playerInventory; - //Hand and drop slots - if (renderSlot(inventory.handSlot, -1)) { + case GameState::Chat: { + ImGui::SetNextWindowPosCenter(); + ImGui::Begin("Chat", 0, windowFlags); + for (const auto& msg : chatMessages) { + ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1,1,1,1)); + ImGui::TextWrapped("%s", msg.c_str()); + } + static char buff[256]; + ImGui::InputText("", buff, 256); + ImGui::SameLine(); + if (ImGui::Button("Send")) { + EventAgregator::PushEvent(EventType::SendChatMessage, SendChatMessageData{ buff }); + } + ImGui::End(); + break; + } + case GameState::Inventory: { + auto renderSlot = [](const SlotData &slot, int i) -> bool { + return ImGui::Button(((slot.BlockId == -1 ? " ##" : + AssetManager::Instance().GetAssetNameByBlockId(BlockId{ (unsigned short)slot.BlockId,0 }) + " x" + std::to_string(slot.ItemCount) + "##") + + std::to_string(i)).c_str()); + }; + ImGui::SetNextWindowPosCenter(); + ImGui::Begin("Inventory", 0, windowFlags); + Window& inventory = world->GameStatePtr()->playerInventory; + //Hand and drop slots + if (renderSlot(inventory.handSlot, -1)) { + } + ImGui::SameLine(); + if (ImGui::Button("Drop")) { + inventory.MakeClick(-1, true, true); + } + ImGui::SameLine(); + ImGui::Text("Hand slot and drop mode"); + ImGui::Separator(); + //Crafting + if (renderSlot(inventory.slots[1], 1)) { + inventory.MakeClick(1, true); + } + ImGui::SameLine(); + if (renderSlot(inventory.slots[2], 2)) { + inventory.MakeClick(2, true); + } + //Crafting result + ImGui::SameLine(); + ImGui::Text("Result"); + ImGui::SameLine(); + if (renderSlot(inventory.slots[0], 0)) { + inventory.MakeClick(0, true); + } + //Crafting second line + if (renderSlot(inventory.slots[3], 3)) { + inventory.MakeClick(3, true); + } + ImGui::SameLine(); + if (renderSlot(inventory.slots[4], 4)) { + inventory.MakeClick(4, true); + } + ImGui::Separator(); + //Armor and offhand + for (int i = 5; i < 8 + 1; i++) { + if (renderSlot(inventory.slots[i], i)) { + inventory.MakeClick(i, true); } ImGui::SameLine(); - if (ImGui::Button("Drop")) { - inventory.MakeClick(-1, true, true); - } - ImGui::SameLine(); - ImGui::Text("Hand slot and drop mode"); - ImGui::Separator(); - //Crafting - if (renderSlot(inventory.slots[1], 1)) { - inventory.MakeClick(1, true); + } + if (renderSlot(inventory.slots[45], 45)) { + inventory.MakeClick(45, true); + } + ImGui::SameLine(); + ImGui::Text("Armor and offhand"); + ImGui::Separator(); + for (int i = 36; i < 44 + 1; i++) { + if (renderSlot(inventory.slots[i], i)) { + inventory.MakeClick(i, true); } ImGui::SameLine(); - if (renderSlot(inventory.slots[2], 2)) { - inventory.MakeClick(2, true); + } + ImGui::Text("Hotbar"); + ImGui::Separator(); + ImGui::Text("Main inventory"); + for (int i = 9; i < 17 + 1; i++) { + if (renderSlot(inventory.slots[i], i)) { + inventory.MakeClick(i, true); } - //Crafting result - ImGui::SameLine(); - ImGui::Text("Result"); ImGui::SameLine(); - if (renderSlot(inventory.slots[0], 0)) { - inventory.MakeClick(0, true); - } - //Crafting second line - if (renderSlot(inventory.slots[3], 3)) { - inventory.MakeClick(3, true); + } + ImGui::Text(""); + for (int i = 18; i < 26 + 1; i++) { + if (renderSlot(inventory.slots[i], i)) { + inventory.MakeClick(i, true); } ImGui::SameLine(); - if (renderSlot(inventory.slots[4], 4)) { - inventory.MakeClick(4, true); - } - ImGui::Separator(); - //Armor and offhand - for (int i = 5; i < 8+1; i++) { - if (renderSlot(inventory.slots[i], i)) { - inventory.MakeClick(i, true); - } - ImGui::SameLine(); - } - if (renderSlot(inventory.slots[45], 45)) { - inventory.MakeClick(45, true); + } + ImGui::Text(""); + for (int i = 27; i < 35 + 1; i++) { + if (renderSlot(inventory.slots[i], i)) { + inventory.MakeClick(i, true); } ImGui::SameLine(); - ImGui::Text("Armor and offhand"); - ImGui::Separator(); - for (int i = 36; i < 44+1; i++) { - if (renderSlot(inventory.slots[i], i)) { - inventory.MakeClick(i, true); - } - ImGui::SameLine(); - } - ImGui::Text("Hotbar"); - ImGui::Separator(); - ImGui::Text("Main inventory"); - for (int i = 9; i < 17 + 1; i++) { - if (renderSlot(inventory.slots[i], i)) { - inventory.MakeClick(i, true); - } - ImGui::SameLine(); - } - ImGui::Text(""); - for (int i = 18; i < 26 + 1; i++) { - if (renderSlot(inventory.slots[i], i)) { - inventory.MakeClick(i, true); - } - ImGui::SameLine(); - } - ImGui::Text(""); - for (int i = 27; i < 35 + 1; i++) { - if (renderSlot(inventory.slots[i], i)) { - inventory.MakeClick(i, true); - } - ImGui::SameLine(); - } - ImGui::End(); } + ImGui::End(); + break; + } case GameState::Paused: { ImGui::SetNextWindowPosCenter(); ImGui::Begin("Pause Menu", 0, windowFlags); @@ -453,10 +497,10 @@ void Render::RenderGui() { sensetivity = sense; isWireframe = wireframe; - timer.SetDelayLength(std::chrono::duration(1.0/targetFps * 1000.0)); + timer.SetDelayLength(std::chrono::duration(1.0 / targetFps * 1000.0)); } ImGui::Separator(); - + if (ImGui::Button("Disconnect")) { EventAgregator::PushEvent(EventType::Disconnect, DisconnectData{ "Disconnected by user" }); } diff --git a/src/Render.hpp b/src/Render.hpp index f9d3497..f35d90c 100644 --- a/src/Render.hpp +++ b/src/Render.hpp @@ -22,7 +22,7 @@ class Render { bool HasFocus=true; float sensetivity = 0.1f; bool isWireframe = false; - bool isDisplayInventory = false; + std::vector chatMessages; enum GameState { InitialLoading, @@ -30,6 +30,8 @@ class Render { Loading, Playing, Paused, + Inventory, + Chat, } state = InitialLoading; std::string stateString; diff --git a/src/Stream.cpp b/src/Stream.cpp index c7935e6..6237451 100644 --- a/src/Stream.cpp +++ b/src/Stream.cpp @@ -74,8 +74,8 @@ std::string StreamInput::ReadString() { return str; } -std::string StreamInput::ReadChat() { - std::string str, jsonStr = ReadString(); +Chat StreamInput::ReadChat() { + /*std::string str, jsonStr = ReadString(); nlohmann::json json; try { json = nlohmann::json::parse(jsonStr); @@ -89,7 +89,8 @@ std::string StreamInput::ReadChat() { return "kicked by operator"; for (auto &it:json["extra"]) { str += it["text"].get(); - } + }*/ + Chat str(ReadString()); return str; } @@ -226,13 +227,13 @@ void StreamOutput::WriteDouble(double value) { WriteData((unsigned char *) &value, 8); } -void StreamOutput::WriteString(std::string value) { +void StreamOutput::WriteString(const std::string &value) { WriteVarInt(value.size()); WriteData((unsigned char *) value.data(), value.size()); } -void StreamOutput::WriteChat(std::string value) { - WriteString(value); +void StreamOutput::WriteChat(const Chat &value) { + WriteString(value.ToJson()); } void StreamOutput::WriteVarInt(int value) { @@ -265,29 +266,24 @@ void StreamOutput::WriteVarLong(long long value) { WriteData(buff, len); } -void StreamOutput::WriteEntityMetadata(std::vector value) { +void StreamOutput::WriteEntityMetadata(const std::vector &value) { LOG(FATAL) << "Used unimplemented WriteEntityMetadata: " << value.size(); } -void StreamOutput::WriteSlot(SlotData value) { +void StreamOutput::WriteSlot(const SlotData &value) { WriteShort(value.BlockId); if (value.BlockId == -1) return; WriteByte(value.ItemCount); WriteShort(value.ItemDamage); - /*unsigned char nbt[] = { - //0x0a, 0x00, 0x02, 0x68, 0x69, 0x00, - 0x01, 0x04, 0xCA, 0xFE, 0xBA, 0xBE, - }; - WriteByteArray(std::vector(nbt,nbt + sizeof(nbt)));*/ WriteByte(0); } -void StreamOutput::WriteNbtTag(std::vector value) { +void StreamOutput::WriteNbtTag(const std::vector &value) { LOG(FATAL) << "Used unimplemented WriteNbtTag " << value.size(); } -void StreamOutput::WritePosition(Vector value) { +void StreamOutput::WritePosition(const Vector &value) { LOG(FATAL) << "Used unimplemented Position: " << value.x << ", " << value.y << " " << value.z; } @@ -295,12 +291,13 @@ void StreamOutput::WriteAngle(unsigned char value) { WriteUByte(value); } -void StreamOutput::WriteUuid(Uuid value) { +void StreamOutput::WriteUuid(const Uuid &value) { WriteByteArray(value); } -void StreamOutput::WriteByteArray(std::vector value) { - WriteData(value.data(), value.size()); +void StreamOutput::WriteByteArray(const std::vector &value) { + auto& val = const_cast&>(value); + WriteData(val.data(), val.size()); } void StreamBuffer::ReadData(unsigned char *buffPtr, size_t buffLen) { diff --git a/src/Stream.hpp b/src/Stream.hpp index e2ba5cf..3fb92df 100644 --- a/src/Stream.hpp +++ b/src/Stream.hpp @@ -12,6 +12,7 @@ #include "Socket.hpp" #include "Vector.hpp" #include "Utility.hpp" +#include "Chat.hpp" struct SlotData { short BlockId = -1; @@ -39,7 +40,7 @@ public: float ReadFloat(); double ReadDouble(); std::string ReadString(); - std::string ReadChat(); + Chat ReadChat(); int ReadVarInt(); long long ReadVarLong(); std::vector ReadEntityMetadata(); @@ -64,17 +65,17 @@ public: void WriteLong(long long value); void WriteFloat(float value); void WriteDouble(double value); - void WriteString(std::string value); - void WriteChat(std::string value); + void WriteString(const std::string &value); + void WriteChat(const Chat &value); void WriteVarInt(int value); void WriteVarLong(long long value); - void WriteEntityMetadata(std::vector value); - void WriteSlot(SlotData value); - void WriteNbtTag(std::vector value); - void WritePosition(Vector value); + void WriteEntityMetadata(const std::vector &value); + void WriteSlot(const SlotData &value); + void WriteNbtTag(const std::vector &value); + void WritePosition(const Vector &value); void WriteAngle(unsigned char value); - void WriteUuid(Uuid value); - void WriteByteArray(std::vector value); + void WriteUuid(const Uuid &value); + void WriteByteArray(const std::vector &value); }; class StreamBuffer : public StreamInput, public StreamOutput { diff --git a/src/Utility.hpp b/src/Utility.hpp index 8333052..893f38e 100644 --- a/src/Utility.hpp +++ b/src/Utility.hpp @@ -7,7 +7,7 @@ #include #include -using Uuid = std::vector; +using Uuid = std::vector; template void endswap(T *objp) { -- cgit v1.2.3