summaryrefslogtreecommitdiffstats
path: root/src/Items/ItemThrowable.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/ItemThrowable.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 '')
-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;
}
-
};