summaryrefslogtreecommitdiffstats
path: root/src/Items/ItemMobHead.h
diff options
context:
space:
mode:
authorx12xx12x <44411062+12xx12@users.noreply.github.com>2021-12-02 00:31:10 +0100
committerGitHub <noreply@github.com>2021-12-02 00:31:10 +0100
commit3ff57559e36d3254c64e334fbe3bdd47398fe16f (patch)
tree30a73d405640285863bfa9932afbee482f36b50c /src/Items/ItemMobHead.h
parentAdded ExperienceAmount variable to HOOK_PLAYER_FISHING and HOOK_PLAYER_FISHED (#5345) (diff)
downloadcuberite-3ff57559e36d3254c64e334fbe3bdd47398fe16f.tar
cuberite-3ff57559e36d3254c64e334fbe3bdd47398fe16f.tar.gz
cuberite-3ff57559e36d3254c64e334fbe3bdd47398fe16f.tar.bz2
cuberite-3ff57559e36d3254c64e334fbe3bdd47398fe16f.tar.lz
cuberite-3ff57559e36d3254c64e334fbe3bdd47398fe16f.tar.xz
cuberite-3ff57559e36d3254c64e334fbe3bdd47398fe16f.tar.zst
cuberite-3ff57559e36d3254c64e334fbe3bdd47398fe16f.zip
Diffstat (limited to 'src/Items/ItemMobHead.h')
-rw-r--r--src/Items/ItemMobHead.h21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/Items/ItemMobHead.h b/src/Items/ItemMobHead.h
index 3d6f1d7aa..aa4189589 100644
--- a/src/Items/ItemMobHead.h
+++ b/src/Items/ItemMobHead.h
@@ -9,23 +9,20 @@
-class cItemMobHeadHandler:
+class cItemMobHeadHandler final :
public cItemHandler
{
using Super = cItemHandler;
public:
- cItemMobHeadHandler(int a_ItemType):
- Super(a_ItemType)
- {
- }
+ using Super::Super;
- virtual bool CommitPlacement(cPlayer & a_Player, const cItem & a_HeldItem, const Vector3i a_PlacePosition, const eBlockFace a_ClickedBlockFace, const Vector3i a_CursorPosition) override
+ virtual bool CommitPlacement(cPlayer & a_Player, const cItem & a_HeldItem, const Vector3i a_PlacePosition, const eBlockFace a_ClickedBlockFace, const Vector3i a_CursorPosition) const override
{
// Cannot place a head at "no face" and from the bottom:
if ((a_ClickedBlockFace == BLOCK_FACE_NONE) || (a_ClickedBlockFace == BLOCK_FACE_BOTTOM))
@@ -58,7 +55,7 @@ public:
/** Called after placing a regular head block with no mob spawning.
Adjusts the mob head entity based on the equipped item's data. */
- void RegularHeadPlaced(const cPlayer & a_Player, const cItem & a_HeldItem, const Vector3i a_PlacePosition, const eBlockFace a_ClickedBlockFace)
+ void RegularHeadPlaced(const cPlayer & a_Player, const cItem & a_HeldItem, const Vector3i a_PlacePosition, const eBlockFace a_ClickedBlockFace) const
{
const auto HeadType = static_cast<eMobHeadType>(a_HeldItem.m_ItemDamage);
const auto BlockMeta = static_cast<NIBBLETYPE>(a_ClickedBlockFace);
@@ -88,7 +85,7 @@ public:
/** Spawns a wither if the wither skull placed at the specified coords completes wither's spawning formula.
Returns true if the wither was created. */
- bool TrySpawnWitherAround(cPlayer & a_Player, const Vector3i a_BlockPos)
+ bool TrySpawnWitherAround(cPlayer & a_Player, const Vector3i a_BlockPos) const
{
// No wither can be created at Y < 2 - not enough space for the formula:
if (a_BlockPos.y < 2)
@@ -131,7 +128,7 @@ public:
cWorld & a_World, cPlayer & a_Player,
Vector3i a_PlacedHeadPos,
int a_OffsetX, int a_OffsetZ
- )
+ ) const
{
// Image for the wither at the X axis:
static const sSetBlock ImageWitherX[] =
@@ -189,7 +186,7 @@ public:
cWorld & a_World, cPlayer & a_Player, const sSetBlock (& a_Image)[9],
Vector3i a_PlacedHeadPos,
int a_OffsetX, int a_OffsetZ
- )
+ ) const
{
std::array<Vector3i, 9> PositionsToClear;
@@ -280,7 +277,7 @@ public:
/** Awards the achievement to all players close to the specified point. */
- void AwardSpawnWitherAchievement(cWorld & a_World, Vector3i a_BlockPos)
+ void AwardSpawnWitherAchievement(cWorld & a_World, Vector3i a_BlockPos) const
{
Vector3f Pos(a_BlockPos);
a_World.ForEachPlayer([=](cPlayer & a_Player)
@@ -323,7 +320,7 @@ public:
- virtual bool IsPlaceable(void) override
+ virtual bool IsPlaceable(void) const override
{
return true;
}