Cuberite
A lightweight, fast and extensible game server for Minecraft
LeashKnot.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include "HangingEntity.h"
5 
6 
7 class cWorldInterface;
8 
9 
10 
11 
12 // tolua_begin
13 class cLeashKnot :
14  public cHangingEntity
15 {
16  // tolua_end
18 
19 public: // tolua_export
20 
22 
23  cLeashKnot(eBlockFace a_BlockFace, Vector3d a_Pos);
24 
26  void TiePlayersLeashedMobs(cPlayer & a_Player, bool a_ShouldBroadCast);
27 
29 
31  static cLeashKnot * FindKnotAtPos(cWorldInterface & a_WorldInterface, Vector3i a_BlockPos);
32 
33 private:
34 
38 
39  virtual void OnRightClicked(cPlayer & a_Player) override;
40  virtual void KilledBy(TakeDamageInfo & a_TDI) override;
41  virtual void GetDrops(cItems & a_Items, cEntity * a_Killer) override;
42  virtual void SpawnOn(cClientHandle & a_ClientHandle) override;
43  virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
44 
45 }; // tolua_export
46 
47 
48 
49 
eBlockFace
Block face constants, used in PlayerDigging and PlayerBlockPlacement packets and bbox collision calc.
Definition: Defines.h:38
#define CLASS_PROTODEF(classname)
Definition: Entity.h:13
Definition: Chunk.h:36
Definition: Entity.h:76
cHangingEntity(eEntityType a_EntityType, eBlockFace a_BlockFace, Vector3d a_Pos)
virtual void SpawnOn(cClientHandle &a_ClientHandle) override
Descendants override this function to send a command to the specified client to spawn the entity on t...
Definition: LeashKnot.cpp:106
void TiePlayersLeashedMobs(cPlayer &a_Player, bool a_ShouldBroadCast)
Looks for mobs leashed to a player and ties them to this knot.
Definition: LeashKnot.cpp:41
bool m_ShouldSelfDestroy
When a fence is destroyed, the knot on it gets destroyed after a while.
Definition: LeashKnot.h:36
virtual void OnRightClicked(cPlayer &a_Player) override
Called when the specified player right-clicks this entity.
Definition: LeashKnot.cpp:28
void SetShouldSelfDestroy()
Definition: LeashKnot.h:28
cLeashKnot(eBlockFace a_BlockFace, Vector3d a_Pos)
Definition: LeashKnot.cpp:17
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
Definition: LeashKnot.cpp:117
virtual void GetDrops(cItems &a_Items, cEntity *a_Killer) override
Returns the list of drops for this pawn when it is killed.
Definition: LeashKnot.cpp:94
int m_TicksToSelfDestroy
Definition: LeashKnot.h:37
virtual void KilledBy(TakeDamageInfo &a_TDI) override
Called when the health drops below zero.
Definition: LeashKnot.cpp:83
static cLeashKnot * FindKnotAtPos(cWorldInterface &a_WorldInterface, Vector3i a_BlockPos)
Returns the leash knot entity representing the knot at the specified position.
Definition: LeashKnot.cpp:142
Definition: Player.h:29
This class bridges a vector of cItem for safe access via Lua.
Definition: Item.h:215