4 #include "../Entities/ArrowEntity.h"
28 const cItem & a_HeldItem,
33 ASSERT(a_Player !=
nullptr);
51 ASSERT(a_Player !=
nullptr);
54 double Force =
static_cast<double>(BowCharge) / 20.0;
55 Force = (Force * Force + 2.0 * Force) / 3.0;
61 Force = std::min(Force, 1.0);
70 auto Arrow = std::make_unique<cArrowEntity>(*a_Player, Force * 2);
71 auto ArrowPtr =
Arrow.get();
72 if (!ArrowPtr->Initialize(std::move(
Arrow), *a_Player->
GetWorld()))
80 static_cast<float>(Force)
97 ArrowPtr->StartBurning(100);
eBlockFace
Block face constants, used in PlayerDigging and PlayerBlockPlacement packets and bbox collision calc.
This interface is used to decouple block handlers from the cPluginManager dependency through cWorld.
unsigned int GetLevel(int a_EnchantmentID) const
Returns the level for the specified enchantment; 0 if not stored.
const Vector3d & GetPosition(void) const
Exported in ManualBindings.
cWorld * GetWorld(void) const
const cItem & GetEquippedItem(void) const
int FinishChargingBow(void)
Finishes charging the current bow.
void StartChargingBow(void)
Starts charging the equipped bow.
bool IsGameModeCreative(void) const
Returns true if the player is in Creative mode, either explicitly, or by inheriting from current worl...
cInventory & GetInventory(void)
void UseEquippedItem(short a_Damage=1)
Damage the player's equipped item by a_Damage, possibly less if the equipped item is enchanted.
bool HasItems(const cItem &a_ItemStack)
Returns true if there are at least as many items of type a_ItemStack as in a_ItemStack.
int RemoveItem(const cItem &a_ItemStack)
Removes the specified item from the inventory, as many as possible, up to a_ItemStack....
cEnchantments m_Enchantments
virtual void OnItemShoot(cPlayer *a_Player, const Vector3i a_BlockPos, eBlockFace a_BlockFace) const override
Called when the client sends the SHOOT status in the lclk packet (releasing the bow).
virtual bool OnItemUse(cWorld *a_World, cPlayer *a_Player, cBlockPluginInterface &a_PluginInterface, const cItem &a_HeldItem, const Vector3i a_ClickedBlockPos, eBlockFace a_ClickedBlockFace) const override
Called when the player tries to use the item (right mouse button).
constexpr cItemHandler(int a_ItemType)
virtual void BroadcastSoundEffect(const AString &a_SoundName, Vector3d a_Position, float a_Volume, float a_Pitch, const cClientHandle *a_Exclude=nullptr) override