summaryrefslogtreecommitdiffstats
path: root/src/Items/ItemEnchantingTable.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Items/ItemEnchantingTable.h32
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;
+ }
} ;