4 #include "../Entities/Floater.h"
5 #include "../Entities/Entity.h"
26 auto & Floater =
static_cast<cFloater &
>(a_Entity);
28 m_Pos = Floater.GetPosition();
69 const cItem & a_HeldItem,
81 ReelIn(*a_World, *a_Player);
88 auto Floater = std::make_unique<cFloater>(
93 auto FloaterPtr = Floater.get();
94 if (!FloaterPtr->Initialize(std::move(Floater), *a_World))
162 const int TreasureChances[] = {50, 71, 92, 113};
163 const int JunkChances[] = {100, 81, 61, 42};
170 switch (Random.RandInt(5))
214 int Junk = Random.RandInt(82);
266 int FishType = Random.RandInt(99);
271 else if (FishType <= 12)
275 else if (FishType <= 24)
287 auto Experience = Random.RandInt(1, 6);
290 if (
cRoot::Get()->GetPluginManager()->CallHookPlayerFishing(a_Player, Drops, Experience))
296 auto FloaterPos = a_FloaterBitePos.
addedY(0.5);
297 const float FISH_SPEED_MULT = 2.25f;
bool IsBlockWater(BLOCKTYPE a_BlockType)
@ E_META_RAW_FISH_PUFFERFISH
@ E_META_RAW_FISH_CLOWNFISH
eBlockFace
Block face constants, used in PlayerDigging and PlayerBlockPlacement packets and bbox collision calc.
MTRand & GetRandomProvider()
Returns the current thread's random number source.
bool CallHookPlayerFished(cPlayer &a_Player, const cItems &a_Reward, const int ExperienceAmount)
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.
void AddSpeed(double a_AddSpeedX, double a_AddSpeedY, double a_AddSpeedZ)
static const UInt32 INVALID_ID
Special ID that is considered an "invalid value", signifying no entity.
UInt32 GetUniqueID(void) const
const Vector3d & GetPosition(void) const
Exported in ManualBindings.
Vector3d GetLookVector(void) const
StatisticsManager & GetStatistics()
Return the associated statistic and achievement manager.
const cItem & GetEquippedItem(void) const
void SetIsFishing(bool a_IsFishing, UInt32 a_FloaterID=cEntity::INVALID_ID)
bool IsFishing(void) const
Returns true if the player has thrown out a floater.
UInt32 GetFloaterID(void) const
Vector3d GetEyePosition(void) const
void UseEquippedItem(short a_Damage=1)
Damage the player's equipped item by a_Damage, possibly less if the equipped item is enchanted.
cEnchantments m_Enchantments
bool EnchantByXPLevels(unsigned a_NumXPLevels, MTRand &a_Random)
Randomly enchants the item using the specified number of XP levels.
This class bridges a vector of cItem for safe access via Lua.
void Add(const cItem &a_Item)
Vector3d GetPos(void) const
bool CanPickup(void) const
bool operator()(cEntity &a_Entity)
bool IsAttached(void) const
Vector3d GetBitePos(void) const
UInt32 GetAttachedMobID(void) const
void ReelInEntity(cWorld &a_World, cPlayer &a_Player, UInt32 a_EntityID) const
Reels back the entity, specified by the ID, and damages the fishing rod accordingly.
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).
void ReelIn(cWorld &a_World, cPlayer &a_Player) const
Reels back the fishing line, reeling any attached mob, or creating fished loot, or just breaking the ...
void ReelInLoot(cWorld &a_World, cPlayer &a_Player, const Vector3d a_FloaterBitePos) const
constexpr cItemHandler(int a_ItemType)
cPluginManager * GetPluginManager(void)
std::unordered_map< CustomStatistic, StatValue > Custom
Vector3< T > addedY(T a_AddY) const
Returns a copy of this vector moved by the specified amount on the y axis.
UInt32 SpawnExperienceOrb(Vector3d a_Pos, int a_Reward)
Spawns an experience orb at the given location with the given reward.
BLOCKTYPE GetBlock(Vector3i a_BlockPos) const
Returns the block type at the specified position.
bool DoWithEntityByID(UInt32 a_UniqueID, cEntityCallback a_Callback)
Calls the callback if the entity with the specified ID is found, with the entity object as the callba...
void SpawnItemPickups(const cItems &a_Pickups, Vector3i a_BlockPos, double a_FlyAwaySpeed=1.0, bool a_IsPlayerCreated=false)
Spawns item pickups for each item in the list.