From 2d2bfcdbd8a80fd5f7c74d34479ff1e2ca6d02fb Mon Sep 17 00:00:00 2001 From: Lukas Pioch Date: Thu, 3 Aug 2017 11:14:53 +0200 Subject: Fixed nbt content lost on open creative inventory and alpha shorted --- src/Bindings/PluginLua.cpp | 4 ++-- src/Bindings/PluginManager.h | 4 ++-- src/Protocol/Protocol_1_9.cpp | 6 ++++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp index 7d00b9fcf..2a4fb4494 100644 --- a/src/Bindings/PluginLua.cpp +++ b/src/Bindings/PluginLua.cpp @@ -1080,6 +1080,8 @@ const char * cPluginLua::GetHookFnName(int a_HookType) case cPluginManager::HOOK_PLAYER_BREAKING_BLOCK: return "OnPlayerBreakingBlock"; case cPluginManager::HOOK_PLAYER_BROKEN_BLOCK: return "OnPlayerBrokenBlock"; case cPluginManager::HOOK_PLAYER_EATING: return "OnPlayerEating"; + case cPluginManager::HOOK_PLAYER_EDITED_BOOK: return "OnPlayerEditedBook"; + case cPluginManager::HOOK_PLAYER_EDITING_BOOK: return "OnPlayerSigningdBook"; case cPluginManager::HOOK_PLAYER_JOINED: return "OnPlayerJoined"; case cPluginManager::HOOK_PLAYER_LEFT_CLICK: return "OnPlayerLeftClick"; case cPluginManager::HOOK_PLAYER_MOVING: return "OnPlayerMoving"; @@ -1088,8 +1090,6 @@ const char * cPluginLua::GetHookFnName(int a_HookType) case cPluginManager::HOOK_PLAYER_PLACING_BLOCK: return "OnPlayerPlacingBlock"; case cPluginManager::HOOK_PLAYER_RIGHT_CLICK: return "OnPlayerRightClick"; case cPluginManager::HOOK_PLAYER_RIGHT_CLICKING_ENTITY: return "OnPlayerRightClickingEntity"; - case cPluginManager::HOOK_PLAYER_EDITED_BOOK: return "OnPlayerEditedBook"; - case cPluginManager::HOOK_PLAYER_EDITING_BOOK: return "OnPlayerSigningdBook"; case cPluginManager::HOOK_PLAYER_SHOOTING: return "OnPlayerShooting"; case cPluginManager::HOOK_PLAYER_SPAWNED: return "OnPlayerSpawned"; case cPluginManager::HOOK_PLAYER_TOSSING_ITEM: return "OnPlayerTossingItem"; diff --git a/src/Bindings/PluginManager.h b/src/Bindings/PluginManager.h index 9552f3f86..5f765fd03 100644 --- a/src/Bindings/PluginManager.h +++ b/src/Bindings/PluginManager.h @@ -107,6 +107,8 @@ public: HOOK_PLAYER_BROKEN_BLOCK, HOOK_PLAYER_DESTROYED, HOOK_PLAYER_EATING, + HOOK_PLAYER_EDITING_BOOK, + HOOK_PLAYER_EDITED_BOOK, HOOK_PLAYER_FISHED, HOOK_PLAYER_FISHING, HOOK_PLAYER_FOOD_LEVEL_CHANGE, @@ -118,8 +120,6 @@ public: HOOK_PLAYER_PLACING_BLOCK, HOOK_PLAYER_RIGHT_CLICK, HOOK_PLAYER_RIGHT_CLICKING_ENTITY, - HOOK_PLAYER_EDITING_BOOK, - HOOK_PLAYER_EDITED_BOOK, HOOK_PLAYER_SHOOTING, HOOK_PLAYER_SPAWNED, HOOK_ENTITY_TELEPORT, diff --git a/src/Protocol/Protocol_1_9.cpp b/src/Protocol/Protocol_1_9.cpp index aba0a9d01..1ee0f450e 100644 --- a/src/Protocol/Protocol_1_9.cpp +++ b/src/Protocol/Protocol_1_9.cpp @@ -3066,6 +3066,12 @@ void cProtocol_1_9_0::ParseItemMetadata(cItem & a_Item, const AString & a_Metada return; } + if ((a_Item.m_ItemType == E_ITEM_WRITTEN_BOOK) || (a_Item.m_ItemType == E_ITEM_BOOK_AND_QUILL)) + { + cBookContent::ParseFromNBT(0, a_Item.m_BookContent, NBT); + return; + } + // Load enchantments and custom display names from the NBT data: for (int tag = NBT.GetFirstChild(NBT.GetRoot()); tag >= 0; tag = NBT.GetNextSibling(tag)) { -- cgit v1.2.3