summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-12-07 00:47:07 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-12-07 00:47:07 +0100
commit30ead790490f04248b861db79fddde9148b552f4 (patch)
treed514486213ab0cf99d33d0580718fd058c3cbc51
parentFixed bed leave animation (diff)
downloadcuberite-30ead790490f04248b861db79fddde9148b552f4.tar
cuberite-30ead790490f04248b861db79fddde9148b552f4.tar.gz
cuberite-30ead790490f04248b861db79fddde9148b552f4.tar.bz2
cuberite-30ead790490f04248b861db79fddde9148b552f4.tar.lz
cuberite-30ead790490f04248b861db79fddde9148b552f4.tar.xz
cuberite-30ead790490f04248b861db79fddde9148b552f4.tar.zst
cuberite-30ead790490f04248b861db79fddde9148b552f4.zip
-rw-r--r--src/Bindings.cpp43
-rw-r--r--src/Bindings.h2
-rw-r--r--src/Chunk.cpp4
-rw-r--r--src/Chunk.h2
-rw-r--r--src/ChunkMap.cpp6
-rw-r--r--src/ChunkMap.h2
-rw-r--r--src/ClientHandle.cpp14
-rw-r--r--src/ClientHandle.h2
-rw-r--r--src/Entities/Player.cpp6
-rw-r--r--src/Plugin.h2
-rw-r--r--src/PluginLua.cpp8
-rw-r--r--src/PluginLua.h2
-rw-r--r--src/PluginManager.cpp6
-rw-r--r--src/PluginManager.h4
-rw-r--r--src/Protocol/Protocol.h2
-rw-r--r--src/Protocol/Protocol125.cpp4
-rw-r--r--src/Protocol/Protocol125.h2
-rw-r--r--src/Protocol/Protocol17x.cpp4
-rw-r--r--src/Protocol/Protocol17x.h2
-rw-r--r--src/Protocol/ProtocolRecognizer.cpp4
-rw-r--r--src/Protocol/ProtocolRecognizer.h2
-rw-r--r--src/World.cpp4
-rw-r--r--src/World.h2
23 files changed, 82 insertions, 47 deletions
diff --git a/src/Bindings.cpp b/src/Bindings.cpp
index 6bee7d71d..51a1dbd71 100644
--- a/src/Bindings.cpp
+++ b/src/Bindings.cpp
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 11/30/13 15:42:56.
+** Generated automatically by tolua++-1.0.92 on 12/06/13 23:06:37.
*/
#ifndef __cplusplus
@@ -11803,6 +11803,38 @@ static int tolua_AllToLua_cWorld_IsDeepSnowEnabled00(lua_State* tolua_S)
}
#endif //#ifndef TOLUA_DISABLE
+/* method: ShouldLavaSpawnFire of class cWorld */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_ShouldLavaSpawnFire00
+static int tolua_AllToLua_cWorld_ShouldLavaSpawnFire00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,2,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0);
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ShouldLavaSpawnFire'", NULL);
+#endif
+ {
+ bool tolua_ret = (bool) self->ShouldLavaSpawnFire();
+ tolua_pushboolean(tolua_S,(bool)tolua_ret);
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'ShouldLavaSpawnFire'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
/* method: GetDimension of class cWorld */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetDimension00
static int tolua_AllToLua_cWorld_GetDimension00(lua_State* tolua_S)
@@ -12193,7 +12225,8 @@ static int tolua_AllToLua_cWorld_QueueSetBlock00(lua_State* tolua_S)
!tolua_isnumber(tolua_S,5,0,&tolua_err) ||
!tolua_isnumber(tolua_S,6,0,&tolua_err) ||
!tolua_isnumber(tolua_S,7,0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,8,&tolua_err)
+ !tolua_isnumber(tolua_S,8,1,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,9,&tolua_err)
)
goto tolua_lerror;
else
@@ -12206,11 +12239,12 @@ static int tolua_AllToLua_cWorld_QueueSetBlock00(lua_State* tolua_S)
unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0));
unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,6,0));
int a_TickDelay = ((int) tolua_tonumber(tolua_S,7,0));
+ unsigned char a_PreviousBlockType = (( unsigned char) tolua_tonumber(tolua_S,8,E_BLOCK_AIR));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'QueueSetBlock'", NULL);
#endif
{
- self->QueueSetBlock(a_BlockX,a_BLockY,a_BlockZ,a_BlockType,a_BlockMeta,a_TickDelay);
+ self->QueueSetBlock(a_BlockX,a_BLockY,a_BlockZ,a_BlockType,a_BlockMeta,a_TickDelay,a_PreviousBlockType);
}
}
return 0;
@@ -30765,6 +30799,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_constant(tolua_S,"HOOK_COLLECTING_PICKUP",cPluginManager::HOOK_COLLECTING_PICKUP);
tolua_constant(tolua_S,"HOOK_CRAFTING_NO_RECIPE",cPluginManager::HOOK_CRAFTING_NO_RECIPE);
tolua_constant(tolua_S,"HOOK_DISCONNECT",cPluginManager::HOOK_DISCONNECT);
+ tolua_constant(tolua_S,"HOOK_ENTITY_ANIMATION",cPluginManager::HOOK_ENTITY_ANIMATION);
tolua_constant(tolua_S,"HOOK_EXECUTE_COMMAND",cPluginManager::HOOK_EXECUTE_COMMAND);
tolua_constant(tolua_S,"HOOK_EXPLODED",cPluginManager::HOOK_EXPLODED);
tolua_constant(tolua_S,"HOOK_EXPLODING",cPluginManager::HOOK_EXPLODING);
@@ -30773,7 +30808,6 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_constant(tolua_S,"HOOK_HOPPER_PUSHING_ITEM",cPluginManager::HOOK_HOPPER_PUSHING_ITEM);
tolua_constant(tolua_S,"HOOK_KILLING",cPluginManager::HOOK_KILLING);
tolua_constant(tolua_S,"HOOK_LOGIN",cPluginManager::HOOK_LOGIN);
- tolua_constant(tolua_S,"HOOK_PLAYER_ANIMATION",cPluginManager::HOOK_PLAYER_ANIMATION);
tolua_constant(tolua_S,"HOOK_PLAYER_BREAKING_BLOCK",cPluginManager::HOOK_PLAYER_BREAKING_BLOCK);
tolua_constant(tolua_S,"HOOK_PLAYER_BROKEN_BLOCK",cPluginManager::HOOK_PLAYER_BROKEN_BLOCK);
tolua_constant(tolua_S,"HOOK_PLAYER_EATING",cPluginManager::HOOK_PLAYER_EATING);
@@ -30855,6 +30889,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_function(tolua_S,"IsGameModeAdventure",tolua_AllToLua_cWorld_IsGameModeAdventure00);
tolua_function(tolua_S,"IsPVPEnabled",tolua_AllToLua_cWorld_IsPVPEnabled00);
tolua_function(tolua_S,"IsDeepSnowEnabled",tolua_AllToLua_cWorld_IsDeepSnowEnabled00);
+ tolua_function(tolua_S,"ShouldLavaSpawnFire",tolua_AllToLua_cWorld_ShouldLavaSpawnFire00);
tolua_function(tolua_S,"GetDimension",tolua_AllToLua_cWorld_GetDimension00);
tolua_function(tolua_S,"GetHeight",tolua_AllToLua_cWorld_GetHeight00);
tolua_function(tolua_S,"BroadcastChat",tolua_AllToLua_cWorld_BroadcastChat00);
diff --git a/src/Bindings.h b/src/Bindings.h
index 4b6fbb322..f199b58b1 100644
--- a/src/Bindings.h
+++ b/src/Bindings.h
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 11/30/13 15:42:57.
+** Generated automatically by tolua++-1.0.92 on 12/06/13 23:06:38.
*/
/* Exported function */
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index 53c7f3a82..1c03753c7 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -2668,7 +2668,7 @@ void cChunk::BroadcastEntityVelocity(const cEntity & a_Entity, const cClientHand
-void cChunk::BroadcastPlayerAnimation(const cPlayer & a_Player, char a_Animation, const cClientHandle * a_Exclude)
+void cChunk::BroadcastEntityAnimation(const cEntity & a_Entity, char a_Animation, const cClientHandle * a_Exclude)
{
for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr )
{
@@ -2676,7 +2676,7 @@ void cChunk::BroadcastPlayerAnimation(const cPlayer & a_Player, char a_Animation
{
continue;
}
- (*itr)->SendPlayerAnimation(a_Player, a_Animation);
+ (*itr)->SendEntityAnimation(a_Entity, a_Animation);
} // for itr - LoadedByClient[]
}
diff --git a/src/Chunk.h b/src/Chunk.h
index 7ff14024c..9e5d117c5 100644
--- a/src/Chunk.h
+++ b/src/Chunk.h
@@ -271,7 +271,7 @@ public:
void BroadcastEntityRelMoveLook (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, const cClientHandle * a_Exclude = NULL);
void BroadcastEntityStatus (const cEntity & a_Entity, char a_Status, const cClientHandle * a_Exclude = NULL);
void BroadcastEntityVelocity (const cEntity & a_Entity, const cClientHandle * a_Exclude = NULL);
- void BroadcastPlayerAnimation (const cPlayer & a_Player, char a_Animation, const cClientHandle * a_Exclude = NULL);
+ void BroadcastEntityAnimation (const cEntity & a_Entity, char a_Animation, const cClientHandle * a_Exclude = NULL);
void BroadcastSoundEffect (const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude = NULL); // a_Src coords are Block * 8
void BroadcastSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data, const cClientHandle * a_Exclude = NULL);
void BroadcastSpawnEntity (cEntity & a_Entity, const cClientHandle * a_Exclude = NULL);
diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp
index f3241bd54..3ad02ac0e 100644
--- a/src/ChunkMap.cpp
+++ b/src/ChunkMap.cpp
@@ -573,16 +573,16 @@ void cChunkMap::BroadcastEntityVelocity(const cEntity & a_Entity, const cClientH
-void cChunkMap::BroadcastPlayerAnimation(const cPlayer & a_Player, char a_Animation, const cClientHandle * a_Exclude)
+void cChunkMap::BroadcastEntityAnimation(const cEntity & a_Entity, char a_Animation, const cClientHandle * a_Exclude)
{
cCSLock Lock(m_CSLayers);
- cChunkPtr Chunk = GetChunkNoGen(a_Player.GetChunkX(), ZERO_CHUNK_Y, a_Player.GetChunkZ());
+ cChunkPtr Chunk = GetChunkNoGen(a_Entity.GetChunkX(), ZERO_CHUNK_Y, a_Entity.GetChunkZ());
if (Chunk == NULL)
{
return;
}
// It's perfectly legal to broadcast packets even to invalid chunks!
- Chunk->BroadcastPlayerAnimation(a_Player, a_Animation, a_Exclude);
+ Chunk->BroadcastEntityAnimation(a_Entity, a_Animation, a_Exclude);
}
diff --git a/src/ChunkMap.h b/src/ChunkMap.h
index 2a529f43d..ef070194b 100644
--- a/src/ChunkMap.h
+++ b/src/ChunkMap.h
@@ -70,7 +70,7 @@ public:
void BroadcastEntityRelMoveLook(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, const cClientHandle * a_Exclude = NULL);
void BroadcastEntityStatus(const cEntity & a_Entity, char a_Status, const cClientHandle * a_Exclude = NULL);
void BroadcastEntityVelocity(const cEntity & a_Entity, const cClientHandle * a_Exclude = NULL);
- void BroadcastPlayerAnimation(const cPlayer & a_Player, char a_Animation, const cClientHandle * a_Exclude = NULL);
+ void BroadcastEntityAnimation(const cEntity & a_Entity, char a_Animation, const cClientHandle * a_Exclude = NULL);
void BroadcastSoundEffect(const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude = NULL); // a_Src coords are Block * 8
void BroadcastSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data, const cClientHandle * a_Exclude = NULL);
void BroadcastSpawnEntity(cEntity & a_Entity, const cClientHandle * a_Exclude = NULL);
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 7511ab8b5..f11b7b85f 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -1053,13 +1053,13 @@ void cClientHandle::HandlePlayerMoveLook(double a_PosX, double a_PosY, double a_
void cClientHandle::HandleAnimation(char a_Animation)
{
- if (cPluginManager::Get()->CallHookPlayerAnimation(*m_Player, a_Animation))
+ if (cPluginManager::Get()->CallHookEntityAnimation(*m_Player, a_Animation))
{
// Plugin disagrees, bail out
return;
}
- m_Player->GetWorld()->BroadcastPlayerAnimation(*m_Player, a_Animation, this);
+ m_Player->GetWorld()->BroadcastEntityAnimation(*m_Player, a_Animation, this);
}
@@ -1264,19 +1264,19 @@ void cClientHandle::HandleEntityAction(int a_EntityID, char a_ActionID)
switch (a_ActionID)
{
- case 1: // crouch
+ case 1: // Crouch
{
m_Player->SetCrouch(true);
break;
}
- case 2: // uncrouch
+ case 2: // Uncrouch
{
m_Player->SetCrouch(false);
break;
}
case 3: // Leave bed
{
- m_Player->GetWorld()->BroadcastPlayerAnimation(*m_Player, 2);
+ m_Player->GetWorld()->BroadcastEntityAnimation(*m_Player, 2);
break;
}
case 4: // Start sprinting
@@ -1813,9 +1813,9 @@ void cClientHandle::SendPickupSpawn(const cPickup & a_Pickup)
-void cClientHandle::SendPlayerAnimation(const cPlayer & a_Player, char a_Animation)
+void cClientHandle::SendEntityAnimation(const cEntity & a_Entity, char a_Animation)
{
- m_Protocol->SendPlayerAnimation(a_Player, a_Animation);
+ m_Protocol->SendEntityAnimation(a_Entity, a_Animation);
}
diff --git a/src/ClientHandle.h b/src/ClientHandle.h
index b3550110d..4498c15c2 100644
--- a/src/ClientHandle.h
+++ b/src/ClientHandle.h
@@ -114,7 +114,7 @@ public:
void SendHealth (void);
void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item);
void SendPickupSpawn (const cPickup & a_Pickup);
- void SendPlayerAnimation (const cPlayer & a_Player, char a_Animation);
+ void SendEntityAnimation (const cEntity & a_Entity, char a_Animation);
void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline);
void SendPlayerMaxSpeed (void); ///< Informs the client of the maximum player speed (1.6.1+)
void SendPlayerMoveLook (void);
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index a0cf24325..4684567e6 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -572,7 +572,7 @@ void cPlayer::StartEating(void)
m_EatingFinishTick = m_World->GetWorldAge() + EATING_TICKS;
// Send the packets:
- m_World->BroadcastPlayerAnimation(*this, 3);
+ m_World->BroadcastEntityAnimation(*this, 3);
m_World->BroadcastEntityMetadata(*this);
}
@@ -587,7 +587,7 @@ void cPlayer::FinishEating(void)
// Send the packets:
m_ClientHandle->SendEntityStatus(*this, ENTITY_STATUS_EATING_ACCEPTED);
- m_World->BroadcastPlayerAnimation(*this, 0);
+ m_World->BroadcastEntityAnimation(*this, 0);
m_World->BroadcastEntityMetadata(*this);
// consume the item:
@@ -616,7 +616,7 @@ void cPlayer::FinishEating(void)
void cPlayer::AbortEating(void)
{
m_EatingFinishTick = -1;
- m_World->BroadcastPlayerAnimation(*this, 0);
+ m_World->BroadcastEntityAnimation(*this, 0);
m_World->BroadcastEntityMetadata(*this);
}
diff --git a/src/Plugin.h b/src/Plugin.h
index ec55e256d..8dd68e6f1 100644
--- a/src/Plugin.h
+++ b/src/Plugin.h
@@ -65,7 +65,7 @@ public:
virtual bool OnHopperPushingItem (cWorld & a_World, cHopperEntity & a_Hopper, int a_SrcSlotNum, cBlockEntityWithItems & a_DstEntity, int a_DstSlotNum) = 0;
virtual bool OnKilling (cEntity & a_Victim, cEntity * a_Killer) = 0;
virtual bool OnLogin (cClientHandle * a_Client, int a_ProtocolVersion, const AString & a_Username) = 0;
- virtual bool OnPlayerAnimation (cPlayer & a_Player, int a_Animation) = 0;
+ virtual bool OnEntityAnimation (cEntity & a_Entity, int a_Animation) = 0;
virtual bool OnPlayerBreakingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) = 0;
virtual bool OnPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) = 0;
virtual bool OnPlayerEating (cPlayer & a_Player) = 0;
diff --git a/src/PluginLua.cpp b/src/PluginLua.cpp
index 110010087..7fc7bc5f1 100644
--- a/src/PluginLua.cpp
+++ b/src/PluginLua.cpp
@@ -550,14 +550,14 @@ bool cPluginLua::OnLogin(cClientHandle * a_Client, int a_ProtocolVersion, const
-bool cPluginLua::OnPlayerAnimation(cPlayer & a_Player, int a_Animation)
+bool cPluginLua::OnEntityAnimation(cEntity & a_Entity, int a_Animation)
{
cCSLock Lock(m_CriticalSection);
bool res = false;
- cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_ANIMATION];
+ cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_ENTITY_ANIMATION];
for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr)
{
- m_LuaState.Call((int)(**itr), &a_Player, a_Animation, cLuaState::Return, res);
+ m_LuaState.Call((int)(**itr), &a_Entity, a_Animation, cLuaState::Return, res);
if (res)
{
return true;
@@ -1287,11 +1287,11 @@ const char * cPluginLua::GetHookFnName(int a_HookType)
case cPluginManager::HOOK_COLLECTING_PICKUP: return "OnCollectingPickup";
case cPluginManager::HOOK_CRAFTING_NO_RECIPE: return "OnCraftingNoRecipe";
case cPluginManager::HOOK_DISCONNECT: return "OnDisconnect";
+ case cPluginManager::HOOK_ENTITY_ANIMATION: return "OnEntityAnimation";
case cPluginManager::HOOK_EXECUTE_COMMAND: return "OnExecuteCommand";
case cPluginManager::HOOK_HANDSHAKE: return "OnHandshake";
case cPluginManager::HOOK_KILLING: return "OnKilling";
case cPluginManager::HOOK_LOGIN: return "OnLogin";
- case cPluginManager::HOOK_PLAYER_ANIMATION: return "OnPlayerAnimation";
case cPluginManager::HOOK_PLAYER_BREAKING_BLOCK: return "OnPlayerBreakingBlock";
case cPluginManager::HOOK_PLAYER_BROKEN_BLOCK: return "OnPlayerBrokenBlock";
case cPluginManager::HOOK_PLAYER_EATING: return "OnPlayerEating";
diff --git a/src/PluginLua.h b/src/PluginLua.h
index 6d135ab75..95e7e789f 100644
--- a/src/PluginLua.h
+++ b/src/PluginLua.h
@@ -61,7 +61,7 @@ public:
virtual bool OnHopperPushingItem (cWorld & a_World, cHopperEntity & a_Hopper, int a_SrcSlotNum, cBlockEntityWithItems & a_DstEntity, int a_DstSlotNum) override;
virtual bool OnKilling (cEntity & a_Victim, cEntity * a_Killer) override;
virtual bool OnLogin (cClientHandle * a_Client, int a_ProtocolVersion, const AString & a_Username) override;
- virtual bool OnPlayerAnimation (cPlayer & a_Player, int a_Animation) override;
+ virtual bool OnEntityAnimation (cEntity & a_Entity, int a_Animation) override;
virtual bool OnPlayerBreakingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override;
virtual bool OnPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override;
virtual bool OnPlayerEating (cPlayer & a_Player) override;
diff --git a/src/PluginManager.cpp b/src/PluginManager.cpp
index b57a9d7d8..5bf8a0232 100644
--- a/src/PluginManager.cpp
+++ b/src/PluginManager.cpp
@@ -603,16 +603,16 @@ bool cPluginManager::CallHookLogin(cClientHandle * a_Client, int a_ProtocolVersi
-bool cPluginManager::CallHookPlayerAnimation(cPlayer & a_Player, int a_Animation)
+bool cPluginManager::CallHookEntityAnimation(cEntity & a_Entity, int a_Animation)
{
- HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_ANIMATION);
+ HookMap::iterator Plugins = m_Hooks.find(HOOK_ENTITY_ANIMATION);
if (Plugins == m_Hooks.end())
{
return false;
}
for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr)
{
- if ((*itr)->OnPlayerAnimation(a_Player, a_Animation))
+ if ((*itr)->OnEntityAnimation(a_Entity, a_Animation))
{
return true;
}
diff --git a/src/PluginManager.h b/src/PluginManager.h
index 12e4da71b..d2694e818 100644
--- a/src/PluginManager.h
+++ b/src/PluginManager.h
@@ -68,6 +68,7 @@ public: // tolua_export
HOOK_COLLECTING_PICKUP,
HOOK_CRAFTING_NO_RECIPE,
HOOK_DISCONNECT,
+ HOOK_ENTITY_ANIMATION,
HOOK_EXECUTE_COMMAND,
HOOK_EXPLODED,
HOOK_EXPLODING,
@@ -76,7 +77,6 @@ public: // tolua_export
HOOK_HOPPER_PUSHING_ITEM,
HOOK_KILLING,
HOOK_LOGIN,
- HOOK_PLAYER_ANIMATION,
HOOK_PLAYER_BREAKING_BLOCK,
HOOK_PLAYER_BROKEN_BLOCK,
HOOK_PLAYER_EATING,
@@ -162,7 +162,7 @@ public: // tolua_export
bool CallHookHopperPushingItem (cWorld & a_World, cHopperEntity & a_Hopper, int a_SrcSlotNum, cBlockEntityWithItems & a_DstEntity, int a_DstSlotNum);
bool CallHookKilling (cEntity & a_Victim, cEntity * a_Killer);
bool CallHookLogin (cClientHandle * a_Client, int a_ProtocolVersion, const AString & a_Username);
- bool CallHookPlayerAnimation (cPlayer & a_Player, int a_Animation);
+ bool CallHookEntityAnimation (cEntity & a_Entity, int a_Animation);
bool CallHookPlayerBreakingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
bool CallHookPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
bool CallHookPlayerEating (cPlayer & a_Player);
diff --git a/src/Protocol/Protocol.h b/src/Protocol/Protocol.h
index 9d8183361..ff6541aeb 100644
--- a/src/Protocol/Protocol.h
+++ b/src/Protocol/Protocol.h
@@ -79,7 +79,7 @@ public:
virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) = 0;
virtual void SendPickupSpawn (const cPickup & a_Pickup) = 0;
virtual void SendPlayerAbilities (void) = 0;
- virtual void SendPlayerAnimation (const cPlayer & a_Player, char a_Animation) = 0;
+ virtual void SendEntityAnimation (const cEntity & a_Entity, char a_Animation) = 0;
virtual void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline) = 0;
virtual void SendPlayerMaxSpeed (void) = 0; ///< Informs the client of the maximum player speed (1.6.1+)
virtual void SendPlayerMoveLook (void) = 0;
diff --git a/src/Protocol/Protocol125.cpp b/src/Protocol/Protocol125.cpp
index b1dd17ea1..9334e6f2d 100644
--- a/src/Protocol/Protocol125.cpp
+++ b/src/Protocol/Protocol125.cpp
@@ -578,11 +578,11 @@ void cProtocol125::SendPickupSpawn(const cPickup & a_Pickup)
-void cProtocol125::SendPlayerAnimation(const cPlayer & a_Player, char a_Animation)
+void cProtocol125::SendEntityAnimation(const cEntity & a_Entity, char a_Animation)
{
cCSLock Lock(m_CSPacket);
WriteByte(PACKET_ANIMATION);
- WriteInt (a_Player.GetUniqueID());
+ WriteInt (a_Entity.GetUniqueID());
WriteByte(a_Animation);
Flush();
}
diff --git a/src/Protocol/Protocol125.h b/src/Protocol/Protocol125.h
index 5a9218f5b..32efef4e8 100644
--- a/src/Protocol/Protocol125.h
+++ b/src/Protocol/Protocol125.h
@@ -55,7 +55,7 @@ public:
virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override;
virtual void SendPickupSpawn (const cPickup & a_Pickup) override;
virtual void SendPlayerAbilities (void) override {} // This protocol doesn't support such message
- virtual void SendPlayerAnimation (const cPlayer & a_Player, char a_Animation) override;
+ virtual void SendEntityAnimation (const cEntity & a_Entity, char a_Animation) override;
virtual void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline) override;
virtual void SendPlayerMaxSpeed (void) override;
virtual void SendPlayerMoveLook (void) override;
diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp
index 5f5864f2a..68f15cb69 100644
--- a/src/Protocol/Protocol17x.cpp
+++ b/src/Protocol/Protocol17x.cpp
@@ -489,10 +489,10 @@ void cProtocol172::SendPlayerAbilities(void)
-void cProtocol172::SendPlayerAnimation(const cPlayer & a_Player, char a_Animation)
+void cProtocol172::SendEntityAnimation(const cEntity & a_Entity, char a_Animation)
{
cPacketizer Pkt(*this, 0x0b); // Animation packet
- Pkt.WriteVarInt(a_Player.GetUniqueID());
+ Pkt.WriteVarInt(a_Entity.GetUniqueID());
Pkt.WriteChar(a_Animation);
}
diff --git a/src/Protocol/Protocol17x.h b/src/Protocol/Protocol17x.h
index 9c1eaa99a..9a189ab24 100644
--- a/src/Protocol/Protocol17x.h
+++ b/src/Protocol/Protocol17x.h
@@ -64,7 +64,7 @@ public:
virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override;
virtual void SendPickupSpawn (const cPickup & a_Pickup) override;
virtual void SendPlayerAbilities (void) override;
- virtual void SendPlayerAnimation (const cPlayer & a_Player, char a_Animation) override;
+ virtual void SendEntityAnimation (const cEntity & a_Entity, char a_Animation) override;
virtual void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline) override;
virtual void SendPlayerMaxSpeed (void) override;
virtual void SendPlayerMoveLook (void) override;
diff --git a/src/Protocol/ProtocolRecognizer.cpp b/src/Protocol/ProtocolRecognizer.cpp
index 489149d74..683700d37 100644
--- a/src/Protocol/ProtocolRecognizer.cpp
+++ b/src/Protocol/ProtocolRecognizer.cpp
@@ -396,10 +396,10 @@ void cProtocolRecognizer::SendPlayerAbilities(void)
-void cProtocolRecognizer::SendPlayerAnimation(const cPlayer & a_Player, char a_Animation)
+void cProtocolRecognizer::SendEntityAnimation(const cEntity & a_Entity, char a_Animation)
{
ASSERT(m_Protocol != NULL);
- m_Protocol->SendPlayerAnimation(a_Player, a_Animation);
+ m_Protocol->SendEntityAnimation(a_Entity, a_Animation);
}
diff --git a/src/Protocol/ProtocolRecognizer.h b/src/Protocol/ProtocolRecognizer.h
index 9ca0c1c88..83fc23c22 100644
--- a/src/Protocol/ProtocolRecognizer.h
+++ b/src/Protocol/ProtocolRecognizer.h
@@ -90,7 +90,7 @@ public:
virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override;
virtual void SendPickupSpawn (const cPickup & a_Pickup) override;
virtual void SendPlayerAbilities (void) override;
- virtual void SendPlayerAnimation (const cPlayer & a_Player, char a_Animation) override;
+ virtual void SendEntityAnimation (const cEntity & a_Entity, char a_Animation) override;
virtual void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline) override;
virtual void SendPlayerMaxSpeed (void) override;
virtual void SendPlayerMoveLook (void) override;
diff --git a/src/World.cpp b/src/World.cpp
index 0cf34b861..2da4a89be 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -1858,9 +1858,9 @@ void cWorld::BroadcastEntityVelocity(const cEntity & a_Entity, const cClientHand
-void cWorld::BroadcastPlayerAnimation(const cPlayer & a_Player, char a_Animation, const cClientHandle * a_Exclude)
+void cWorld::BroadcastEntityAnimation(const cEntity & a_Entity, char a_Animation, const cClientHandle * a_Exclude)
{
- m_ChunkMap->BroadcastPlayerAnimation(a_Player, a_Animation, a_Exclude);
+ m_ChunkMap->BroadcastEntityAnimation(a_Entity, a_Animation, a_Exclude);
}
diff --git a/src/World.h b/src/World.h
index c865bb73f..fadb8aac6 100644
--- a/src/World.h
+++ b/src/World.h
@@ -159,7 +159,7 @@ public:
void BroadcastEntityRelMoveLook (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, const cClientHandle * a_Exclude = NULL);
void BroadcastEntityStatus (const cEntity & a_Entity, char a_Status, const cClientHandle * a_Exclude = NULL);
void BroadcastEntityVelocity (const cEntity & a_Entity, const cClientHandle * a_Exclude = NULL);
- void BroadcastPlayerAnimation (const cPlayer & a_Player, char a_Animation, const cClientHandle * a_Exclude = NULL);
+ void BroadcastEntityAnimation (const cEntity & a_Entity, char a_Animation, const cClientHandle * a_Exclude = NULL);
void BroadcastPlayerListItem (const cPlayer & a_Player, bool a_IsOnline, const cClientHandle * a_Exclude = NULL);
void BroadcastSoundEffect (const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude = NULL); // tolua_export a_Src coords are Block * 8
void BroadcastSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data, const cClientHandle * a_Exclude = NULL); // tolua_export