diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2021-05-05 15:25:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-05 15:25:10 +0200 |
commit | a62b2b1be2103d7de2fd66c7304b7473e369be3c (patch) | |
tree | a44f2b43fd90f5c79af5e308b554349e6dc546af /src/Items/ItemEnchantingTable.h | |
parent | Rename files to match code (diff) | |
download | cuberite-a62b2b1be2103d7de2fd66c7304b7473e369be3c.tar cuberite-a62b2b1be2103d7de2fd66c7304b7473e369be3c.tar.gz cuberite-a62b2b1be2103d7de2fd66c7304b7473e369be3c.tar.bz2 cuberite-a62b2b1be2103d7de2fd66c7304b7473e369be3c.tar.lz cuberite-a62b2b1be2103d7de2fd66c7304b7473e369be3c.tar.xz cuberite-a62b2b1be2103d7de2fd66c7304b7473e369be3c.tar.zst cuberite-a62b2b1be2103d7de2fd66c7304b7473e369be3c.zip |
Diffstat (limited to 'src/Items/ItemEnchantingTable.h')
-rw-r--r-- | src/Items/ItemEnchantingTable.h | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/src/Items/ItemEnchantingTable.h b/src/Items/ItemEnchantingTable.h index 12835cb4a..29a6eeef6 100644 --- a/src/Items/ItemEnchantingTable.h +++ b/src/Items/ItemEnchantingTable.h @@ -20,40 +20,32 @@ public: private: - virtual bool IsPlaceable(void) override - { - return true; - } - - - virtual bool OnPlayerPlace( - cWorld & a_World, - cPlayer & a_Player, - const cItem & a_EquippedItem, - const Vector3i a_ClickedBlockPos, - eBlockFace a_ClickedBlockFace, - const Vector3i a_CursorPos - ) override + virtual bool CommitPlacement(cPlayer & a_Player, const cItem & a_HeldItem, const Vector3i a_PlacePosition, const eBlockFace a_ClickedBlockFace, const Vector3i a_CursorPosition) override { - if (!Super::OnPlayerPlace(a_World, a_Player, a_EquippedItem, a_ClickedBlockPos, a_ClickedBlockFace, a_CursorPos)) + if (!Super::CommitPlacement(a_Player, a_HeldItem, a_PlacePosition, a_ClickedBlockFace, a_CursorPosition)) { return false; } - if (a_EquippedItem.IsCustomNameEmpty()) + if (a_HeldItem.IsCustomNameEmpty()) { return true; } - const auto PlacePos = AddFaceDirection(a_ClickedBlockPos, a_ClickedBlockFace); - a_World.DoWithBlockEntityAt(PlacePos, [&a_EquippedItem](cBlockEntity & a_Entity) + a_Player.GetWorld()->DoWithBlockEntityAt(a_PlacePosition, [&a_HeldItem](cBlockEntity & a_BlockEntity) { - ASSERT(a_Entity.GetBlockType() == E_BLOCK_ENCHANTMENT_TABLE); + ASSERT(a_BlockEntity.GetBlockType() == E_BLOCK_ENCHANTMENT_TABLE); - static_cast<cEnchantingTableEntity &>(a_Entity).SetCustomName(a_EquippedItem.m_CustomName); + static_cast<cEnchantingTableEntity &>(a_BlockEntity).SetCustomName(a_HeldItem.m_CustomName); return false; }); return true; } + + + virtual bool IsPlaceable(void) override + { + return true; + } } ; |