diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-09-11 23:17:27 +0200 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-09-11 23:17:27 +0200 |
commit | c7044fa1dd77a04c57780443a5dc88165c2d2ca1 (patch) | |
tree | cece37f27c6b32f4c5669a3467d8f0af17f75ac4 | |
parent | Removed GetProtocolVersion() from the protocols. (diff) | |
download | cuberite-c7044fa1dd77a04c57780443a5dc88165c2d2ca1.tar cuberite-c7044fa1dd77a04c57780443a5dc88165c2d2ca1.tar.gz cuberite-c7044fa1dd77a04c57780443a5dc88165c2d2ca1.tar.bz2 cuberite-c7044fa1dd77a04c57780443a5dc88165c2d2ca1.tar.lz cuberite-c7044fa1dd77a04c57780443a5dc88165c2d2ca1.tar.xz cuberite-c7044fa1dd77a04c57780443a5dc88165c2d2ca1.tar.zst cuberite-c7044fa1dd77a04c57780443a5dc88165c2d2ca1.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Protocol/Protocol18x.cpp | 5 | ||||
-rw-r--r-- | src/UI/Window.cpp | 28 | ||||
-rw-r--r-- | src/UI/Window.h | 3 |
3 files changed, 32 insertions, 4 deletions
diff --git a/src/Protocol/Protocol18x.cpp b/src/Protocol/Protocol18x.cpp index 142cae6a5..04af848dc 100644 --- a/src/Protocol/Protocol18x.cpp +++ b/src/Protocol/Protocol18x.cpp @@ -1515,10 +1515,9 @@ void cProtocol180::SendWindowOpen(const cWindow & a_Window) cPacketizer Pkt(*this, 0x2d); Pkt.WriteChar(a_Window.GetWindowID()); - Pkt.WriteChar(a_Window.GetWindowType()); - Pkt.WriteString(a_Window.GetWindowTitle()); + Pkt.WriteString(a_Window.GetWindowTypeName()); + Pkt.WriteString(Printf("{\"text\":\"%s\"}", a_Window.GetWindowTitle().c_str())); Pkt.WriteChar(a_Window.GetNumNonInventorySlots()); - Pkt.WriteBool(true); if (a_Window.GetWindowType() == cWindow::wtAnimalChest) { Pkt.WriteInt(0); // TODO: The animal's EntityID diff --git a/src/UI/Window.cpp b/src/UI/Window.cpp index 66900269f..1b7b07f77 100644 --- a/src/UI/Window.cpp +++ b/src/UI/Window.cpp @@ -57,6 +57,34 @@ cWindow::~cWindow() +const AString cWindow::GetWindowTypeName(void) const +{ + switch (m_WindowType) + { + case wtChest: return "minecraft:chest"; + case wtWorkbench: return "minecraft:crafting_table"; + case wtFurnace: return "minecraft:furnace"; + case wtDropSpenser: return "minecraft:dispenser"; + case wtEnchantment: return "minecraft:enchanting_table"; + case wtBrewery: return "minecraft:brewing_stand"; + case wtNPCTrade: return "minecraft:villager"; + case wtBeacon: return "minecraft:beacon"; + case wtAnvil: return "minecraft:anvil"; + case wtHopper: return "minecraft:hopper"; + case wtDropper: return "minecraft:dropper"; + case wtAnimalChest: return "EntityHorse"; + default: + { + ASSERT(!"Unknown inventory type!"); + return ""; + } + } +} + + + + + int cWindow::GetNumSlots(void) const { int res = 0; diff --git a/src/UI/Window.h b/src/UI/Window.h index 3d860407f..bc5becf11 100644 --- a/src/UI/Window.h +++ b/src/UI/Window.h @@ -63,7 +63,7 @@ public: wtBeacon = 7, wtAnvil = 8, wtHopper = 9, - // Unknown: 10 + wtDropper = 10, wtAnimalChest = 11, }; @@ -76,6 +76,7 @@ public: char GetWindowID(void) const { return m_WindowID; } // tolua_export int GetWindowType(void) const { return m_WindowType; } // tolua_export + const AString GetWindowTypeName(void) const; // tolua_export cWindowOwner * GetOwner(void) { return m_Owner; } void SetOwner( cWindowOwner * a_Owner) { m_Owner = a_Owner; } |