diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2020-09-29 00:38:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-29 00:38:10 +0200 |
commit | c9fbb43ac7a619f54b2de13bd59d37dbcc939d35 (patch) | |
tree | c273e105b5db511ff3e04cfb9efc497ff93696a4 | |
parent | Fortune Drops (#4932) (diff) | |
download | cuberite-c9fbb43ac7a619f54b2de13bd59d37dbcc939d35.tar cuberite-c9fbb43ac7a619f54b2de13bd59d37dbcc939d35.tar.gz cuberite-c9fbb43ac7a619f54b2de13bd59d37dbcc939d35.tar.bz2 cuberite-c9fbb43ac7a619f54b2de13bd59d37dbcc939d35.tar.lz cuberite-c9fbb43ac7a619f54b2de13bd59d37dbcc939d35.tar.xz cuberite-c9fbb43ac7a619f54b2de13bd59d37dbcc939d35.tar.zst cuberite-c9fbb43ac7a619f54b2de13bd59d37dbcc939d35.zip |
Diffstat (limited to '')
-rw-r--r-- | src/ClientHandle.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 6b9729090..27b34eeec 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -792,11 +792,8 @@ void cClientHandle::HandleEnchantItem(UInt8 a_WindowID, UInt8 a_Enchantment) return; } - // Creative players can always enchant: - if (m_Player->IsGameModeCreative()) + const auto SetEnchantAndBroadcast = [this, &Item, Window] { - Broadcast: - // Set the item slot to our new enchanted item: Window->m_SlotArea->SetSlot(0, *m_Player, Item); Window->BroadcastWholeWindow(); @@ -805,6 +802,12 @@ void cClientHandle::HandleEnchantItem(UInt8 a_WindowID, UInt8 a_Enchantment) Window->SetProperty(0, 0, *m_Player); Window->SetProperty(1, 0, *m_Player); Window->SetProperty(2, 0, *m_Player); + }; + + // Creative players can always enchant: + if (m_Player->IsGameModeCreative()) + { + SetEnchantAndBroadcast(); return; } @@ -836,7 +839,7 @@ void cClientHandle::HandleEnchantItem(UInt8 a_WindowID, UInt8 a_Enchantment) LapisStack.AddCount(-LapisRequired); Window->m_SlotArea->SetSlot(1, *m_Player, LapisStack); - goto Broadcast; + SetEnchantAndBroadcast(); } } |