diff options
author | Alexander Harkness <me@bearbin.net> | 2024-11-02 22:27:47 +0100 |
---|---|---|
committer | Alexander Harkness <me@bearbin.net> | 2024-11-02 22:27:47 +0100 |
commit | cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a (patch) | |
tree | f647b20e1823f1846af88e832cf82a4a02e96e69 /src/Blocks/BlockEnchantingTable.h | |
parent | Improve clang-format config file, remove automatically enforced code style from contrib guide. (diff) | |
download | cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.gz cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.bz2 cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.lz cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.xz cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.zst cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.zip |
Diffstat (limited to 'src/Blocks/BlockEnchantingTable.h')
-rw-r--r-- | src/Blocks/BlockEnchantingTable.h | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/src/Blocks/BlockEnchantingTable.h b/src/Blocks/BlockEnchantingTable.h index ba3932e5c..17db41cc4 100644 --- a/src/Blocks/BlockEnchantingTable.h +++ b/src/Blocks/BlockEnchantingTable.h @@ -11,17 +11,14 @@ -class cBlockEnchantingTableHandler final : - public cBlockHandler +class cBlockEnchantingTableHandler final : public cBlockHandler { using Super = cBlockHandler; -public: - + public: using Super::Super; -private: - + private: virtual bool OnUse( cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, @@ -32,19 +29,22 @@ private: ) const override { AString WindowName = "Enchant"; - a_WorldInterface.DoWithBlockEntityAt(a_BlockPos, [&WindowName](cBlockEntity & a_Entity) - { - ASSERT(a_Entity.GetBlockType() == E_BLOCK_ENCHANTMENT_TABLE); - - const auto & EnchantingTable = static_cast<cEnchantingTableEntity &>(a_Entity); - const auto & CustomName = EnchantingTable.GetCustomName(); - if (!CustomName.empty()) + a_WorldInterface.DoWithBlockEntityAt( + a_BlockPos, + [&WindowName](cBlockEntity & a_Entity) { - WindowName = CustomName; - } + ASSERT(a_Entity.GetBlockType() == E_BLOCK_ENCHANTMENT_TABLE); - return false; - }); + const auto & EnchantingTable = static_cast<cEnchantingTableEntity &>(a_Entity); + const auto & CustomName = EnchantingTable.GetCustomName(); + if (!CustomName.empty()) + { + WindowName = CustomName; + } + + return false; + } + ); cWindow * Window = new cEnchantingWindow(a_BlockPos, std::move(WindowName)); a_Player.OpenWindow(*Window); @@ -53,10 +53,7 @@ private: } - virtual bool IsUseable(void) const override - { - return true; - } + virtual bool IsUseable(void) const override { return true; } virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override |