summaryrefslogtreecommitdiffstats
path: root/src/Items/ItemThrowable.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Items/ItemThrowable.h')
-rw-r--r--src/Items/ItemThrowable.h39
1 files changed, 20 insertions, 19 deletions
diff --git a/src/Items/ItemThrowable.h b/src/Items/ItemThrowable.h
index 606f655e9..ed4d73316 100644
--- a/src/Items/ItemThrowable.h
+++ b/src/Items/ItemThrowable.h
@@ -14,7 +14,7 @@ class cItemThrowableHandler:
public:
- cItemThrowableHandler(int a_ItemType, cProjectileEntity::eKind a_ProjectileKind, double a_SpeedCoeff):
+ constexpr cItemThrowableHandler(int a_ItemType, cProjectileEntity::eKind a_ProjectileKind, double a_SpeedCoeff):
Super(a_ItemType),
m_ProjectileKind(a_ProjectileKind),
m_SpeedCoeff(a_SpeedCoeff)
@@ -32,7 +32,7 @@ public:
const cItem & a_HeldItem,
const Vector3i a_ClickedBlockPos,
eBlockFace a_ClickedBlockFace
- ) override
+ ) const override
{
auto Pos = a_Player->GetThrowStartPos();
auto Speed = a_Player->GetLookVector() * m_SpeedCoeff;
@@ -62,21 +62,23 @@ protected:
/** The speed multiplier (to the player's normalized look vector) to set for the new projectile. */
double m_SpeedCoeff;
+
+ ~cItemThrowableHandler() = default;
} ;
-class cItemEggHandler:
+class cItemEggHandler final:
public cItemThrowableHandler
{
using Super = cItemThrowableHandler;
public:
- cItemEggHandler():
- Super(E_ITEM_EGG, cProjectileEntity::pkEgg, 30)
+ constexpr cItemEggHandler(int a_ItemType):
+ Super(a_ItemType, cProjectileEntity::pkEgg, 30)
{
}
} ;
@@ -84,15 +86,15 @@ public:
-class cItemSnowballHandler:
+class cItemSnowballHandler final:
public cItemThrowableHandler
{
using Super = cItemThrowableHandler;
public:
- cItemSnowballHandler():
- Super(E_ITEM_SNOWBALL, cProjectileEntity::pkSnowball, 30)
+ constexpr cItemSnowballHandler(int a_ItemType):
+ Super(a_ItemType, cProjectileEntity::pkSnowball, 30)
{
}
} ;
@@ -101,15 +103,15 @@ public:
-class cItemEnderPearlHandler:
+class cItemEnderPearlHandler final:
public cItemThrowableHandler
{
using Super = cItemThrowableHandler;
public:
- cItemEnderPearlHandler():
- Super(E_ITEM_ENDER_PEARL, cProjectileEntity::pkEnderPearl, 30)
+ constexpr cItemEnderPearlHandler(int a_ItemType):
+ Super(a_ItemType, cProjectileEntity::pkEnderPearl, 30)
{
}
} ;
@@ -118,15 +120,15 @@ public:
-class cItemBottleOEnchantingHandler:
+class cItemBottleOEnchantingHandler final :
public cItemThrowableHandler
{
using Super = cItemThrowableHandler;
public:
- cItemBottleOEnchantingHandler():
- Super(E_ITEM_BOTTLE_O_ENCHANTING, cProjectileEntity::pkExpBottle, 14)
+ constexpr cItemBottleOEnchantingHandler(int a_ItemType):
+ Super(a_ItemType, cProjectileEntity::pkExpBottle, 14)
{
}
};
@@ -135,15 +137,15 @@ public:
-class cItemFireworkHandler:
+class cItemFireworkHandler final:
public cItemThrowableHandler
{
using Super = cItemThrowableHandler;
public:
- cItemFireworkHandler():
- Super(E_ITEM_FIREWORK_ROCKET, cProjectileEntity::pkFirework, 0)
+ constexpr cItemFireworkHandler(int a_ItemType):
+ Super(a_ItemType, cProjectileEntity::pkFirework, 0)
{
}
@@ -158,7 +160,7 @@ public:
const cItem & a_HeldItem,
const Vector3i a_ClickedBlockPos,
eBlockFace a_ClickedBlockFace
- ) override
+ ) const override
{
if (a_World->GetBlock(a_ClickedBlockPos) == E_BLOCK_AIR)
{
@@ -177,5 +179,4 @@ public:
return true;
}
-
};