Prefer static_cast to reinterpret_cast (#4223)
* Change reinterpret_cast -> static_cast wherever possible * Remove more unnecessary `const_cast`s. reinterpret_casts should be avoided for the same reason as c-style casts - they don't do any type-checking. reinterpret_cast was mainly being used for down-casting in inheritance hierarchies but static_cast works just as well while also making sure that there is actually an inheritance relationship there.
This commit is contained in:
parent
86a8fdf3fe
commit
a4dbb5c582
@ -245,7 +245,7 @@ local function OutputLuaStateHelpers(a_Package)
|
|||||||
f:write("\ttolua_Error err;\n")
|
f:write("\ttolua_Error err;\n")
|
||||||
f:write("\tif (tolua_isusertype(m_LuaState, a_StackPos, \"" .. item.name .. "\", false, &err))\n")
|
f:write("\tif (tolua_isusertype(m_LuaState, a_StackPos, \"" .. item.name .. "\", false, &err))\n")
|
||||||
f:write("\t{\n")
|
f:write("\t{\n")
|
||||||
f:write("\t\ta_ReturnedVal = *(reinterpret_cast<" .. item.name .. " **>(lua_touserdata(m_LuaState, a_StackPos)));\n")
|
f:write("\t\ta_ReturnedVal = *(static_cast<" .. item.name .. " **>(lua_touserdata(m_LuaState, a_StackPos)));\n")
|
||||||
f:write("\t\treturn true;\n");
|
f:write("\t\treturn true;\n");
|
||||||
f:write("\t}\n")
|
f:write("\t}\n")
|
||||||
f:write("\treturn false;\n")
|
f:write("\treturn false;\n")
|
||||||
@ -258,7 +258,7 @@ local function OutputLuaStateHelpers(a_Package)
|
|||||||
f:write("\ttolua_Error err;\n")
|
f:write("\ttolua_Error err;\n")
|
||||||
f:write("\tif (tolua_isusertype(m_LuaState, a_StackPos, \"const " .. item.name .. "\", false, &err))\n")
|
f:write("\tif (tolua_isusertype(m_LuaState, a_StackPos, \"const " .. item.name .. "\", false, &err))\n")
|
||||||
f:write("\t{\n")
|
f:write("\t{\n")
|
||||||
f:write("\t\ta_ReturnedVal = *(reinterpret_cast<const " .. item.name .. " **>(lua_touserdata(m_LuaState, a_StackPos)));\n")
|
f:write("\t\ta_ReturnedVal = *(static_cast<const " .. item.name .. " **>(lua_touserdata(m_LuaState, a_StackPos)));\n")
|
||||||
f:write("\t\treturn true;\n");
|
f:write("\t\treturn true;\n");
|
||||||
f:write("\t}\n")
|
f:write("\t}\n")
|
||||||
f:write("\treturn false;\n")
|
f:write("\treturn false;\n")
|
||||||
|
@ -305,7 +305,7 @@ void cLuaState::cTrackedRef::Invalidate(void)
|
|||||||
if (!m_Ref.IsValid())
|
if (!m_Ref.IsValid())
|
||||||
{
|
{
|
||||||
LOGD("%s: Inconsistent callback at %p, has a CS but an invalid Ref. This should not happen",
|
LOGD("%s: Inconsistent callback at %p, has a CS but an invalid Ref. This should not happen",
|
||||||
__FUNCTION__, reinterpret_cast<void *>(this)
|
__FUNCTION__, static_cast<void *>(this)
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2391,7 +2391,7 @@ void cLuaState::TrackRef(cTrackedRef & a_Ref)
|
|||||||
auto canonState = QueryCanonLuaState();
|
auto canonState = QueryCanonLuaState();
|
||||||
if (canonState == nullptr)
|
if (canonState == nullptr)
|
||||||
{
|
{
|
||||||
LOGWARNING("%s: Lua state %p has invalid CanonLuaState!", __FUNCTION__, reinterpret_cast<void *>(m_LuaState));
|
LOGWARNING("%s: Lua state %p has invalid CanonLuaState!", __FUNCTION__, static_cast<void *>(m_LuaState));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2410,7 +2410,7 @@ void cLuaState::UntrackRef(cTrackedRef & a_Ref)
|
|||||||
auto canonState = QueryCanonLuaState();
|
auto canonState = QueryCanonLuaState();
|
||||||
if (canonState == nullptr)
|
if (canonState == nullptr)
|
||||||
{
|
{
|
||||||
LOGWARNING("%s: Lua state %p has invalid CanonLuaState!", __FUNCTION__, reinterpret_cast<void *>(m_LuaState));
|
LOGWARNING("%s: Lua state %p has invalid CanonLuaState!", __FUNCTION__, static_cast<void *>(m_LuaState));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,7 +372,7 @@ static AString GetLogMessage(lua_State * tolua_S)
|
|||||||
tolua_Error err;
|
tolua_Error err;
|
||||||
if (tolua_isusertype(tolua_S, 1, "cCompositeChat", false, &err))
|
if (tolua_isusertype(tolua_S, 1, "cCompositeChat", false, &err))
|
||||||
{
|
{
|
||||||
return reinterpret_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr))->ExtractText();
|
return static_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr))->ExtractText();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -405,7 +405,7 @@ static int tolua_LOG(lua_State * tolua_S)
|
|||||||
tolua_Error err;
|
tolua_Error err;
|
||||||
if (tolua_isusertype(tolua_S, 1, "cCompositeChat", false, &err))
|
if (tolua_isusertype(tolua_S, 1, "cCompositeChat", false, &err))
|
||||||
{
|
{
|
||||||
LogLevel = cCompositeChat::MessageTypeToLogLevel(reinterpret_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr))->GetMessageType());
|
LogLevel = cCompositeChat::MessageTypeToLogLevel(static_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr))->GetMessageType());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log the message:
|
// Log the message:
|
||||||
@ -525,7 +525,7 @@ cPluginLua * cManualBindings::GetLuaPlugin(lua_State * L)
|
|||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
cPluginLua * Plugin = reinterpret_cast<cPluginLua *>(const_cast<void*>(lua_topointer(L, -1)));
|
cPluginLua * Plugin = static_cast<cPluginLua *>(const_cast<void*>(lua_topointer(L, -1)));
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
|
|
||||||
return Plugin;
|
return Plugin;
|
||||||
@ -1088,7 +1088,7 @@ static int tolua_cPluginManager_AddHook_DefFn(cPluginManager * a_PluginManager,
|
|||||||
// The arg types have already been checked
|
// The arg types have already been checked
|
||||||
|
|
||||||
// Retrieve and check the cPlugin parameter
|
// Retrieve and check the cPlugin parameter
|
||||||
cPluginLua * Plugin = reinterpret_cast<cPluginLua *>(tolua_tousertype(S, a_ParamIdx, nullptr));
|
cPluginLua * Plugin = static_cast<cPluginLua *>(tolua_tousertype(S, a_ParamIdx, nullptr));
|
||||||
if (Plugin == nullptr)
|
if (Plugin == nullptr)
|
||||||
{
|
{
|
||||||
LOGWARNING("cPluginManager.AddHook(): Invalid Plugin parameter, expected a valid cPlugin object. Hook not added");
|
LOGWARNING("cPluginManager.AddHook(): Invalid Plugin parameter, expected a valid cPlugin object. Hook not added");
|
||||||
@ -1162,7 +1162,7 @@ static int tolua_cPluginManager_AddHook(lua_State * tolua_S)
|
|||||||
if (tolua_isusertype(S, 1, "cPluginManager", 0, &err))
|
if (tolua_isusertype(S, 1, "cPluginManager", 0, &err))
|
||||||
{
|
{
|
||||||
// Style 2 or 3, retrieve the PlgMgr instance
|
// Style 2 or 3, retrieve the PlgMgr instance
|
||||||
PlgMgr = reinterpret_cast<cPluginManager *>(tolua_tousertype(S, 1, nullptr));
|
PlgMgr = static_cast<cPluginManager *>(tolua_tousertype(S, 1, nullptr));
|
||||||
if (PlgMgr == nullptr)
|
if (PlgMgr == nullptr)
|
||||||
{
|
{
|
||||||
LOGWARNING("Malformed plugin, use cPluginManager.AddHook(HOOK_TYPE, CallbackFunction). Fixing the call for you.");
|
LOGWARNING("Malformed plugin, use cPluginManager.AddHook(HOOK_TYPE, CallbackFunction). Fixing the call for you.");
|
||||||
@ -1582,7 +1582,7 @@ static int tolua_cPlayer_GetPermissions(lua_State * tolua_S)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the params:
|
// Get the params:
|
||||||
cPlayer * self = reinterpret_cast<cPlayer *>(tolua_tousertype(tolua_S, 1, nullptr));
|
cPlayer * self = static_cast<cPlayer *>(tolua_tousertype(tolua_S, 1, nullptr));
|
||||||
if (self == nullptr)
|
if (self == nullptr)
|
||||||
{
|
{
|
||||||
LOGWARNING("%s: invalid self (%p)", __FUNCTION__, static_cast<void *>(self));
|
LOGWARNING("%s: invalid self (%p)", __FUNCTION__, static_cast<void *>(self));
|
||||||
@ -1613,7 +1613,7 @@ static int tolua_cPlayer_GetRestrictions(lua_State * tolua_S)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the params:
|
// Get the params:
|
||||||
cPlayer * self = reinterpret_cast<cPlayer *>(tolua_tousertype(tolua_S, 1, nullptr));
|
cPlayer * self = static_cast<cPlayer *>(tolua_tousertype(tolua_S, 1, nullptr));
|
||||||
if (self == nullptr)
|
if (self == nullptr)
|
||||||
{
|
{
|
||||||
LOGWARNING("%s: invalid self (%p)", __FUNCTION__, static_cast<void *>(self));
|
LOGWARNING("%s: invalid self (%p)", __FUNCTION__, static_cast<void *>(self));
|
||||||
@ -1970,14 +1970,14 @@ static int tolua_get_HTTPRequest_FormData(lua_State* a_LuaState)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto & FormData = self->FormData;
|
auto & FormData = self->FormData;
|
||||||
lua_newtable(a_LuaState);
|
lua_newtable(a_LuaState);
|
||||||
int top = lua_gettop(a_LuaState);
|
int top = lua_gettop(a_LuaState);
|
||||||
for (auto itr = FormData.cbegin(); itr != FormData.cend(); ++itr)
|
for (auto & Data : FormData)
|
||||||
{
|
{
|
||||||
lua_pushstring(a_LuaState, itr->first.c_str());
|
lua_pushstring(a_LuaState, Data.first.c_str());
|
||||||
tolua_pushusertype(a_LuaState, const_cast<void *>(reinterpret_cast<const void *>(&(itr->second))), "HTTPFormData");
|
tolua_pushusertype(a_LuaState, &Data.second, "HTTPFormData");
|
||||||
// lua_pushlstring(a_LuaState, it->second.Value.c_str(), it->second.Value.size()); // Might contain binary data
|
// lua_pushlstring(a_LuaState, Data.second.Value.c_str(), Data.second.Value.size()); // Might contain binary data
|
||||||
lua_settable(a_LuaState, top);
|
lua_settable(a_LuaState, top);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2339,7 +2339,7 @@ static int tolua_cClientHandle_SendPluginMessage(lua_State * L)
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
cClientHandle * Client = reinterpret_cast<cClientHandle *>(tolua_tousertype(L, 1, nullptr));
|
cClientHandle * Client = static_cast<cClientHandle *>(tolua_tousertype(L, 1, nullptr));
|
||||||
if (Client == nullptr)
|
if (Client == nullptr)
|
||||||
{
|
{
|
||||||
LOGWARNING("ClientHandle is nil in cClientHandle:SendPluginMessage()");
|
LOGWARNING("ClientHandle is nil in cClientHandle:SendPluginMessage()");
|
||||||
@ -2789,7 +2789,7 @@ static int Lua_ItemGrid_GetSlotCoords(lua_State * L)
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const cItemGrid * self = reinterpret_cast<const cItemGrid *>(tolua_tousertype(L, 1, nullptr));
|
const cItemGrid * self = static_cast<const cItemGrid *>(tolua_tousertype(L, 1, nullptr));
|
||||||
int SlotNum = static_cast<int>(tolua_tonumber(L, 2, 0));
|
int SlotNum = static_cast<int>(tolua_tonumber(L, 2, 0));
|
||||||
if (self == nullptr)
|
if (self == nullptr)
|
||||||
{
|
{
|
||||||
@ -3442,7 +3442,7 @@ static int tolua_cScoreboard_GetTeamNames(lua_State * L)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the groups:
|
// Get the groups:
|
||||||
cScoreboard * Scoreboard = reinterpret_cast<cScoreboard *>(tolua_tousertype(L, 1, nullptr));
|
cScoreboard * Scoreboard = static_cast<cScoreboard *>(tolua_tousertype(L, 1, nullptr));
|
||||||
AStringVector Teams = Scoreboard->GetTeamNames();
|
AStringVector Teams = Scoreboard->GetTeamNames();
|
||||||
|
|
||||||
// Push the results:
|
// Push the results:
|
||||||
@ -3468,7 +3468,7 @@ static int tolua_cHopperEntity_GetOutputBlockPos(lua_State * tolua_S)
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
cHopperEntity * self = reinterpret_cast<cHopperEntity *>(tolua_tousertype(tolua_S, 1, nullptr));
|
cHopperEntity * self = static_cast<cHopperEntity *>(tolua_tousertype(tolua_S, 1, nullptr));
|
||||||
if (self == nullptr)
|
if (self == nullptr)
|
||||||
{
|
{
|
||||||
tolua_error(tolua_S, "invalid 'self' in function 'cHopperEntity::GetOutputBlockPos()'", nullptr);
|
tolua_error(tolua_S, "invalid 'self' in function 'cHopperEntity::GetOutputBlockPos()'", nullptr);
|
||||||
@ -3688,7 +3688,7 @@ static int tolua_cCompositeChat_AddRunCommandPart(lua_State * tolua_S)
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
cCompositeChat * self = reinterpret_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr));
|
cCompositeChat * self = static_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr));
|
||||||
if (self == nullptr)
|
if (self == nullptr)
|
||||||
{
|
{
|
||||||
tolua_error(tolua_S, "invalid 'self' in function 'cCompositeChat:AddRunCommandPart'", nullptr);
|
tolua_error(tolua_S, "invalid 'self' in function 'cCompositeChat:AddRunCommandPart'", nullptr);
|
||||||
@ -3725,7 +3725,7 @@ static int tolua_cCompositeChat_AddSuggestCommandPart(lua_State * tolua_S)
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
cCompositeChat * self = reinterpret_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr));
|
cCompositeChat * self = static_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr));
|
||||||
if (self == nullptr)
|
if (self == nullptr)
|
||||||
{
|
{
|
||||||
tolua_error(tolua_S, "invalid 'self' in function 'cCompositeChat:AddSuggestCommandPart'", nullptr);
|
tolua_error(tolua_S, "invalid 'self' in function 'cCompositeChat:AddSuggestCommandPart'", nullptr);
|
||||||
@ -3762,7 +3762,7 @@ static int tolua_cCompositeChat_AddTextPart(lua_State * tolua_S)
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
cCompositeChat * self = reinterpret_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr));
|
cCompositeChat * self = static_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr));
|
||||||
if (self == nullptr)
|
if (self == nullptr)
|
||||||
{
|
{
|
||||||
tolua_error(tolua_S, "invalid 'self' in function 'cCompositeChat:AddTextPart'", nullptr);
|
tolua_error(tolua_S, "invalid 'self' in function 'cCompositeChat:AddTextPart'", nullptr);
|
||||||
@ -3798,7 +3798,7 @@ static int tolua_cCompositeChat_AddUrlPart(lua_State * tolua_S)
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
cCompositeChat * self = reinterpret_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr));
|
cCompositeChat * self = static_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr));
|
||||||
if (self == nullptr)
|
if (self == nullptr)
|
||||||
{
|
{
|
||||||
tolua_error(tolua_S, "invalid 'self' in function 'cCompositeChat:AddUrlPart'", nullptr);
|
tolua_error(tolua_S, "invalid 'self' in function 'cCompositeChat:AddUrlPart'", nullptr);
|
||||||
@ -3835,7 +3835,7 @@ static int tolua_cCompositeChat_Clear(lua_State * tolua_S)
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
cCompositeChat * self = reinterpret_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr));
|
cCompositeChat * self = static_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr));
|
||||||
if (self == nullptr)
|
if (self == nullptr)
|
||||||
{
|
{
|
||||||
tolua_error(tolua_S, "invalid 'self' in function 'cCompositeChat:ParseText'", nullptr);
|
tolua_error(tolua_S, "invalid 'self' in function 'cCompositeChat:ParseText'", nullptr);
|
||||||
@ -3868,7 +3868,7 @@ static int tolua_cCompositeChat_ParseText(lua_State * tolua_S)
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
cCompositeChat * self = reinterpret_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr));
|
cCompositeChat * self = static_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr));
|
||||||
if (self == nullptr)
|
if (self == nullptr)
|
||||||
{
|
{
|
||||||
tolua_error(tolua_S, "invalid 'self' in function 'cCompositeChat:ParseText'", nullptr);
|
tolua_error(tolua_S, "invalid 'self' in function 'cCompositeChat:ParseText'", nullptr);
|
||||||
@ -3903,7 +3903,7 @@ static int tolua_cCompositeChat_SetMessageType(lua_State * tolua_S)
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
cCompositeChat * self = reinterpret_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr));
|
cCompositeChat * self = static_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr));
|
||||||
if (self == nullptr)
|
if (self == nullptr)
|
||||||
{
|
{
|
||||||
tolua_error(tolua_S, "invalid 'self' in function 'cCompositeChat:SetMessageType'", nullptr);
|
tolua_error(tolua_S, "invalid 'self' in function 'cCompositeChat:SetMessageType'", nullptr);
|
||||||
@ -3935,7 +3935,7 @@ static int tolua_cCompositeChat_UnderlineUrls(lua_State * tolua_S)
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
cCompositeChat * self = reinterpret_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr));
|
cCompositeChat * self = static_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr));
|
||||||
if (self == nullptr)
|
if (self == nullptr)
|
||||||
{
|
{
|
||||||
tolua_error(tolua_S, "invalid 'self' in function 'cCompositeChat:UnderlineUrls'", nullptr);
|
tolua_error(tolua_S, "invalid 'self' in function 'cCompositeChat:UnderlineUrls'", nullptr);
|
||||||
@ -4009,7 +4009,7 @@ static int tolua_cEntity_GetPosition(lua_State * tolua_S)
|
|||||||
cLuaState L(tolua_S);
|
cLuaState L(tolua_S);
|
||||||
|
|
||||||
// Get the params:
|
// Get the params:
|
||||||
cEntity * self = reinterpret_cast<cEntity *>(tolua_tousertype(tolua_S, 1, nullptr));
|
cEntity * self = static_cast<cEntity *>(tolua_tousertype(tolua_S, 1, nullptr));
|
||||||
if (self == nullptr)
|
if (self == nullptr)
|
||||||
{
|
{
|
||||||
LOGWARNING("%s: invalid self (%p)", __FUNCTION__, static_cast<void *>(self));
|
LOGWARNING("%s: invalid self (%p)", __FUNCTION__, static_cast<void *>(self));
|
||||||
@ -4031,7 +4031,7 @@ static int tolua_cEntity_GetSpeed(lua_State * tolua_S)
|
|||||||
cLuaState L(tolua_S);
|
cLuaState L(tolua_S);
|
||||||
|
|
||||||
// Get the params:
|
// Get the params:
|
||||||
cEntity * self = reinterpret_cast<cEntity *>(tolua_tousertype(tolua_S, 1, nullptr));
|
cEntity * self = static_cast<cEntity *>(tolua_tousertype(tolua_S, 1, nullptr));
|
||||||
if (self == nullptr)
|
if (self == nullptr)
|
||||||
{
|
{
|
||||||
LOGWARNING("%s: invalid self (%p)", __FUNCTION__, static_cast<void *>(self));
|
LOGWARNING("%s: invalid self (%p)", __FUNCTION__, static_cast<void *>(self));
|
||||||
|
@ -848,7 +848,7 @@ public:
|
|||||||
|
|
||||||
virtual void OnBodyData(const void * a_Data, size_t a_Size) override
|
virtual void OnBodyData(const void * a_Data, size_t a_Size) override
|
||||||
{
|
{
|
||||||
m_Callbacks->CallTableFnWithSelf("OnBodyData", AString(reinterpret_cast<const char *>(a_Data), a_Size));
|
m_Callbacks->CallTableFnWithSelf("OnBodyData", AString(static_cast<const char *>(a_Data), a_Size));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -907,7 +907,7 @@ public:
|
|||||||
|
|
||||||
virtual void OnBodyData(const void * a_Data, size_t a_Size) override
|
virtual void OnBodyData(const void * a_Data, size_t a_Size) override
|
||||||
{
|
{
|
||||||
m_ResponseBody.append(reinterpret_cast<const char *>(a_Data), a_Size);
|
m_ResponseBody.append(static_cast<const char *>(a_Data), a_Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ static int tolua_cWorld_ForEachLoadedChunk(lua_State * tolua_S)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Read the params:
|
// Read the params:
|
||||||
cWorld * World = reinterpret_cast<cWorld *>(tolua_tousertype(tolua_S, 1, nullptr));
|
cWorld * World = static_cast<cWorld *>(tolua_tousertype(tolua_S, 1, nullptr));
|
||||||
if (World == nullptr)
|
if (World == nullptr)
|
||||||
{
|
{
|
||||||
LOGWARNING("World:ForEachLoadedChunk(): invalid world parameter");
|
LOGWARNING("World:ForEachLoadedChunk(): invalid world parameter");
|
||||||
|
@ -414,15 +414,15 @@ bool cPluginLua::OnExploded(cWorld & a_World, double a_ExplosionSize, bool a_Can
|
|||||||
{
|
{
|
||||||
switch (a_Source)
|
switch (a_Source)
|
||||||
{
|
{
|
||||||
case esBed: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, reinterpret_cast<Vector3i *> (a_SourceData), cLuaState::Return, res); break;
|
case esBed: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, static_cast<Vector3i *> (a_SourceData), cLuaState::Return, res); break;
|
||||||
case esEnderCrystal: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, reinterpret_cast<cEntity *> (a_SourceData), cLuaState::Return, res); break;
|
case esEnderCrystal: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, static_cast<cEntity *> (a_SourceData), cLuaState::Return, res); break;
|
||||||
case esGhastFireball: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, reinterpret_cast<cGhastFireballEntity *>(a_SourceData), cLuaState::Return, res); break;
|
case esGhastFireball: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, static_cast<cGhastFireballEntity *>(a_SourceData), cLuaState::Return, res); break;
|
||||||
case esMonster: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, reinterpret_cast<cMonster *> (a_SourceData), cLuaState::Return, res); break;
|
case esMonster: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, static_cast<cMonster *> (a_SourceData), cLuaState::Return, res); break;
|
||||||
case esOther: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, cLuaState::Return, res); break;
|
case esOther: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, cLuaState::Return, res); break;
|
||||||
case esPlugin: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, cLuaState::Return, res); break;
|
case esPlugin: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, cLuaState::Return, res); break;
|
||||||
case esPrimedTNT: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, reinterpret_cast<cTNTEntity *> (a_SourceData), cLuaState::Return, res); break;
|
case esPrimedTNT: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, static_cast<cTNTEntity *> (a_SourceData), cLuaState::Return, res); break;
|
||||||
case esWitherBirth: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, reinterpret_cast<cMonster *> (a_SourceData), cLuaState::Return, res); break;
|
case esWitherBirth: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, static_cast<cMonster *> (a_SourceData), cLuaState::Return, res); break;
|
||||||
case esWitherSkull: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, reinterpret_cast<cWitherSkullEntity *> (a_SourceData), cLuaState::Return, res); break;
|
case esWitherSkull: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, static_cast<cWitherSkullEntity *> (a_SourceData), cLuaState::Return, res); break;
|
||||||
case esMax:
|
case esMax:
|
||||||
{
|
{
|
||||||
ASSERT(!"Invalid explosion source");
|
ASSERT(!"Invalid explosion source");
|
||||||
@ -454,15 +454,15 @@ bool cPluginLua::OnExploding(cWorld & a_World, double & a_ExplosionSize, bool &
|
|||||||
{
|
{
|
||||||
switch (a_Source)
|
switch (a_Source)
|
||||||
{
|
{
|
||||||
case esBed: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, reinterpret_cast<Vector3i *> (a_SourceData), cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
|
case esBed: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, static_cast<Vector3i *> (a_SourceData), cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
|
||||||
case esEnderCrystal: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, reinterpret_cast<cEntity *> (a_SourceData), cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
|
case esEnderCrystal: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, static_cast<cEntity *> (a_SourceData), cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
|
||||||
case esGhastFireball: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, reinterpret_cast<cGhastFireballEntity *>(a_SourceData), cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
|
case esGhastFireball: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, static_cast<cGhastFireballEntity *>(a_SourceData), cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
|
||||||
case esMonster: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, reinterpret_cast<cMonster *> (a_SourceData), cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
|
case esMonster: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, static_cast<cMonster *> (a_SourceData), cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
|
||||||
case esOther: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
|
case esOther: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
|
||||||
case esPlugin: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
|
case esPlugin: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
|
||||||
case esPrimedTNT: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, reinterpret_cast<cTNTEntity *> (a_SourceData), cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
|
case esPrimedTNT: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, static_cast<cTNTEntity *> (a_SourceData), cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
|
||||||
case esWitherBirth: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, reinterpret_cast<cMonster *> (a_SourceData), cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
|
case esWitherBirth: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, static_cast<cMonster *> (a_SourceData), cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
|
||||||
case esWitherSkull: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, reinterpret_cast<cWitherSkullEntity *> (a_SourceData), cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
|
case esWitherSkull: hook->Call(&a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, static_cast<cWitherSkullEntity *> (a_SourceData), cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break;
|
||||||
case esMax:
|
case esMax:
|
||||||
{
|
{
|
||||||
ASSERT(!"Invalid explosion source");
|
ASSERT(!"Invalid explosion source");
|
||||||
|
@ -264,7 +264,7 @@ void cBeaconEntity::GiveEffects(void)
|
|||||||
void cBeaconEntity::CopyFrom(const cBlockEntity & a_Src)
|
void cBeaconEntity::CopyFrom(const cBlockEntity & a_Src)
|
||||||
{
|
{
|
||||||
Super::CopyFrom(a_Src);
|
Super::CopyFrom(a_Src);
|
||||||
auto & src = reinterpret_cast<const cBeaconEntity &>(a_Src);
|
auto & src = static_cast<const cBeaconEntity &>(a_Src);
|
||||||
m_BeaconLevel = src.m_BeaconLevel;
|
m_BeaconLevel = src.m_BeaconLevel;
|
||||||
m_Contents.CopyFrom(src.m_Contents);
|
m_Contents.CopyFrom(src.m_Contents);
|
||||||
m_IsActive = src.m_IsActive;
|
m_IsActive = src.m_IsActive;
|
||||||
|
@ -23,7 +23,7 @@ cBedEntity::cBedEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, int a_Bloc
|
|||||||
void cBedEntity::CopyFrom(const cBlockEntity & a_Src)
|
void cBedEntity::CopyFrom(const cBlockEntity & a_Src)
|
||||||
{
|
{
|
||||||
Super::CopyFrom(a_Src);
|
Super::CopyFrom(a_Src);
|
||||||
auto & src = reinterpret_cast<const cBedEntity &>(a_Src);
|
auto & src = static_cast<const cBedEntity &>(a_Src);
|
||||||
m_Color = src.m_Color;
|
m_Color = src.m_Color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ void cBlockEntityWithItems::Destroy(void)
|
|||||||
void cBlockEntityWithItems::CopyFrom(const cBlockEntity & a_Src)
|
void cBlockEntityWithItems::CopyFrom(const cBlockEntity & a_Src)
|
||||||
{
|
{
|
||||||
Super::CopyFrom(a_Src);
|
Super::CopyFrom(a_Src);
|
||||||
auto & src = reinterpret_cast<const cBlockEntityWithItems &>(a_Src);
|
auto & src = static_cast<const cBlockEntityWithItems &>(a_Src);
|
||||||
m_Contents.CopyFrom(src.m_Contents);
|
m_Contents.CopyFrom(src.m_Contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ void cBrewingstandEntity::Destroy()
|
|||||||
void cBrewingstandEntity::CopyFrom(const cBlockEntity & a_Src)
|
void cBrewingstandEntity::CopyFrom(const cBlockEntity & a_Src)
|
||||||
{
|
{
|
||||||
Super::CopyFrom(a_Src);
|
Super::CopyFrom(a_Src);
|
||||||
auto & src = reinterpret_cast<const cBrewingstandEntity &>(a_Src);
|
auto & src = static_cast<const cBrewingstandEntity &>(a_Src);
|
||||||
m_IsBrewing = src.m_IsBrewing;
|
m_IsBrewing = src.m_IsBrewing;
|
||||||
for (size_t i = 0; i < ARRAYCOUNT(m_CurrentBrewingRecipes); ++i)
|
for (size_t i = 0; i < ARRAYCOUNT(m_CurrentBrewingRecipes); ++i)
|
||||||
{
|
{
|
||||||
|
@ -50,7 +50,7 @@ cChestEntity::~cChestEntity()
|
|||||||
void cChestEntity::CopyFrom(const cBlockEntity & a_Src)
|
void cChestEntity::CopyFrom(const cBlockEntity & a_Src)
|
||||||
{
|
{
|
||||||
Super::CopyFrom(a_Src);
|
Super::CopyFrom(a_Src);
|
||||||
auto & src = reinterpret_cast<const cChestEntity &>(a_Src);
|
auto & src = static_cast<const cChestEntity &>(a_Src);
|
||||||
m_Contents.CopyFrom(src.m_Contents);
|
m_Contents.CopyFrom(src.m_Contents);
|
||||||
|
|
||||||
// Reset the neighbor and player count, there's no sense in copying these:
|
// Reset the neighbor and player count, there's no sense in copying these:
|
||||||
|
@ -117,7 +117,7 @@ void cCommandBlockEntity::Activate(void)
|
|||||||
void cCommandBlockEntity::CopyFrom(const cBlockEntity & a_Src)
|
void cCommandBlockEntity::CopyFrom(const cBlockEntity & a_Src)
|
||||||
{
|
{
|
||||||
Super::CopyFrom(a_Src);
|
Super::CopyFrom(a_Src);
|
||||||
auto & src = reinterpret_cast<const cCommandBlockEntity &>(a_Src);
|
auto & src = static_cast<const cCommandBlockEntity &>(a_Src);
|
||||||
m_Command = src.m_Command;
|
m_Command = src.m_Command;
|
||||||
m_LastOutput = src.m_LastOutput;
|
m_LastOutput = src.m_LastOutput;
|
||||||
m_Result = src.m_Result;
|
m_Result = src.m_Result;
|
||||||
|
@ -116,7 +116,7 @@ void cDropSpenserEntity::Activate(void)
|
|||||||
void cDropSpenserEntity::CopyFrom(const cBlockEntity & a_Src)
|
void cDropSpenserEntity::CopyFrom(const cBlockEntity & a_Src)
|
||||||
{
|
{
|
||||||
Super::CopyFrom(a_Src);
|
Super::CopyFrom(a_Src);
|
||||||
auto & src = reinterpret_cast<const cDropSpenserEntity &>(a_Src);
|
auto & src = static_cast<const cDropSpenserEntity &>(a_Src);
|
||||||
m_Contents.CopyFrom(src.m_Contents);
|
m_Contents.CopyFrom(src.m_Contents);
|
||||||
m_ShouldDropSpense = src.m_ShouldDropSpense;
|
m_ShouldDropSpense = src.m_ShouldDropSpense;
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ void cFlowerPotEntity::Destroy(void)
|
|||||||
void cFlowerPotEntity::CopyFrom(const cBlockEntity & a_Src)
|
void cFlowerPotEntity::CopyFrom(const cBlockEntity & a_Src)
|
||||||
{
|
{
|
||||||
Super::CopyFrom(a_Src);
|
Super::CopyFrom(a_Src);
|
||||||
auto & src = reinterpret_cast<const cFlowerPotEntity &>(a_Src);
|
auto & src = static_cast<const cFlowerPotEntity &>(a_Src);
|
||||||
m_Item = src.m_Item;
|
m_Item = src.m_Item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ void cFurnaceEntity::Destroy()
|
|||||||
void cFurnaceEntity::CopyFrom(const cBlockEntity & a_Src)
|
void cFurnaceEntity::CopyFrom(const cBlockEntity & a_Src)
|
||||||
{
|
{
|
||||||
Super::CopyFrom(a_Src);
|
Super::CopyFrom(a_Src);
|
||||||
auto & src = reinterpret_cast<const cFurnaceEntity &>(a_Src);
|
auto & src = static_cast<const cFurnaceEntity &>(a_Src);
|
||||||
m_Contents.CopyFrom(src.m_Contents);
|
m_Contents.CopyFrom(src.m_Contents);
|
||||||
m_CurrentRecipe = src.m_CurrentRecipe;
|
m_CurrentRecipe = src.m_CurrentRecipe;
|
||||||
m_FuelBurnTime = src.m_FuelBurnTime;
|
m_FuelBurnTime = src.m_FuelBurnTime;
|
||||||
|
@ -56,7 +56,7 @@ bool cHopperEntity::GetOutputBlockPos(NIBBLETYPE a_BlockMeta, int & a_OutputX, i
|
|||||||
void cHopperEntity::CopyFrom(const cBlockEntity & a_Src)
|
void cHopperEntity::CopyFrom(const cBlockEntity & a_Src)
|
||||||
{
|
{
|
||||||
Super::CopyFrom(a_Src);
|
Super::CopyFrom(a_Src);
|
||||||
auto & src = reinterpret_cast<const cHopperEntity &>(a_Src);
|
auto & src = static_cast<const cHopperEntity &>(a_Src);
|
||||||
m_LastMoveItemsInTick = src.m_LastMoveItemsInTick;
|
m_LastMoveItemsInTick = src.m_LastMoveItemsInTick;
|
||||||
m_LastMoveItemsOutTick = src.m_LastMoveItemsOutTick;
|
m_LastMoveItemsOutTick = src.m_LastMoveItemsOutTick;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ cJukeboxEntity::~cJukeboxEntity()
|
|||||||
void cJukeboxEntity::CopyFrom(const cBlockEntity & a_Src)
|
void cJukeboxEntity::CopyFrom(const cBlockEntity & a_Src)
|
||||||
{
|
{
|
||||||
Super::CopyFrom(a_Src);
|
Super::CopyFrom(a_Src);
|
||||||
auto & src = reinterpret_cast<const cJukeboxEntity &>(a_Src);
|
auto & src = static_cast<const cJukeboxEntity &>(a_Src);
|
||||||
m_Record = src.m_Record;
|
m_Record = src.m_Record;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ cMobHeadEntity::cMobHeadEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, in
|
|||||||
void cMobHeadEntity::CopyFrom(const cBlockEntity & a_Src)
|
void cMobHeadEntity::CopyFrom(const cBlockEntity & a_Src)
|
||||||
{
|
{
|
||||||
Super::CopyFrom(a_Src);
|
Super::CopyFrom(a_Src);
|
||||||
auto & src = reinterpret_cast<const cMobHeadEntity &>(a_Src);
|
auto & src = static_cast<const cMobHeadEntity &>(a_Src);
|
||||||
m_OwnerName = src.m_OwnerName;
|
m_OwnerName = src.m_OwnerName;
|
||||||
m_OwnerTexture = src.m_OwnerTexture;
|
m_OwnerTexture = src.m_OwnerTexture;
|
||||||
m_OwnerTextureSignature = src.m_OwnerTextureSignature;
|
m_OwnerTextureSignature = src.m_OwnerTextureSignature;
|
||||||
|
@ -29,7 +29,7 @@ cMobSpawnerEntity::cMobSpawnerEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMe
|
|||||||
void cMobSpawnerEntity::CopyFrom(const cBlockEntity & a_Src)
|
void cMobSpawnerEntity::CopyFrom(const cBlockEntity & a_Src)
|
||||||
{
|
{
|
||||||
Super::CopyFrom(a_Src);
|
Super::CopyFrom(a_Src);
|
||||||
auto & src = reinterpret_cast<const cMobSpawnerEntity &>(a_Src);
|
auto & src = static_cast<const cMobSpawnerEntity &>(a_Src);
|
||||||
m_Entity = src.m_Entity;
|
m_Entity = src.m_Entity;
|
||||||
m_IsActive = src.m_IsActive;
|
m_IsActive = src.m_IsActive;
|
||||||
m_SpawnDelay = src.m_SpawnDelay;
|
m_SpawnDelay = src.m_SpawnDelay;
|
||||||
|
@ -23,7 +23,7 @@ cNoteEntity::cNoteEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, int a_Bl
|
|||||||
void cNoteEntity::CopyFrom(const cBlockEntity & a_Src)
|
void cNoteEntity::CopyFrom(const cBlockEntity & a_Src)
|
||||||
{
|
{
|
||||||
Super::CopyFrom(a_Src);
|
Super::CopyFrom(a_Src);
|
||||||
auto & src = reinterpret_cast<const cNoteEntity &>(a_Src);
|
auto & src = static_cast<const cNoteEntity &>(a_Src);
|
||||||
m_Pitch = src.m_Pitch;
|
m_Pitch = src.m_Pitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ cSignEntity::cSignEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, int a_Bl
|
|||||||
void cSignEntity::CopyFrom(const cBlockEntity & a_Src)
|
void cSignEntity::CopyFrom(const cBlockEntity & a_Src)
|
||||||
{
|
{
|
||||||
Super::CopyFrom(a_Src);
|
Super::CopyFrom(a_Src);
|
||||||
auto & src = reinterpret_cast<const cSignEntity &>(a_Src);
|
auto & src = static_cast<const cSignEntity &>(a_Src);
|
||||||
for (size_t i = 0; i < ARRAYCOUNT(m_Line); ++i)
|
for (size_t i = 0; i < ARRAYCOUNT(m_Line); ++i)
|
||||||
{
|
{
|
||||||
m_Line[i] = src.m_Line[i];
|
m_Line[i] = src.m_Line[i];
|
||||||
|
@ -126,7 +126,7 @@ bool cByteBuffer::Write(const void * a_Bytes, size_t a_Count)
|
|||||||
}
|
}
|
||||||
ASSERT(m_BufferSize >= m_WritePos);
|
ASSERT(m_BufferSize >= m_WritePos);
|
||||||
size_t TillEnd = m_BufferSize - m_WritePos;
|
size_t TillEnd = m_BufferSize - m_WritePos;
|
||||||
const char * Bytes = reinterpret_cast<const char *>(a_Bytes);
|
const char * Bytes = static_cast<const char *>(a_Bytes);
|
||||||
if (TillEnd <= a_Count)
|
if (TillEnd <= a_Count)
|
||||||
{
|
{
|
||||||
// Need to wrap around the ringbuffer end
|
// Need to wrap around the ringbuffer end
|
||||||
@ -739,7 +739,7 @@ bool cByteBuffer::ReadBuf(void * a_Buffer, size_t a_Count)
|
|||||||
CHECK_THREAD
|
CHECK_THREAD
|
||||||
CheckValid();
|
CheckValid();
|
||||||
NEEDBYTES(a_Count);
|
NEEDBYTES(a_Count);
|
||||||
char * Dst = reinterpret_cast<char *>(a_Buffer); // So that we can do byte math
|
char * Dst = static_cast<char *>(a_Buffer); // So that we can do byte math
|
||||||
ASSERT(m_BufferSize >= m_ReadPos);
|
ASSERT(m_BufferSize >= m_ReadPos);
|
||||||
size_t BytesToEndOfBuffer = m_BufferSize - m_ReadPos;
|
size_t BytesToEndOfBuffer = m_BufferSize - m_ReadPos;
|
||||||
if (BytesToEndOfBuffer <= a_Count)
|
if (BytesToEndOfBuffer <= a_Count)
|
||||||
@ -772,7 +772,7 @@ bool cByteBuffer::WriteBuf(const void * a_Buffer, size_t a_Count)
|
|||||||
CHECK_THREAD
|
CHECK_THREAD
|
||||||
CheckValid();
|
CheckValid();
|
||||||
PUTBYTES(a_Count);
|
PUTBYTES(a_Count);
|
||||||
char * Src = reinterpret_cast<char *>(const_cast<void*>(a_Buffer)); // So that we can do byte math
|
const char * Src = static_cast<const char *>(a_Buffer); // So that we can do byte math
|
||||||
ASSERT(m_BufferSize >= m_ReadPos);
|
ASSERT(m_BufferSize >= m_ReadPos);
|
||||||
size_t BytesToEndOfBuffer = m_BufferSize - m_WritePos;
|
size_t BytesToEndOfBuffer = m_BufferSize - m_WritePos;
|
||||||
if (BytesToEndOfBuffer <= a_Count)
|
if (BytesToEndOfBuffer <= a_Count)
|
||||||
|
@ -539,7 +539,7 @@ void cChunk::CollectMobCensus(cMobCensus & toFill)
|
|||||||
// LOGD("Counting entity #%i (%s)", (*itr)->GetUniqueID(), (*itr)->GetClass());
|
// LOGD("Counting entity #%i (%s)", (*itr)->GetUniqueID(), (*itr)->GetClass());
|
||||||
if (entity->IsMob())
|
if (entity->IsMob())
|
||||||
{
|
{
|
||||||
auto & Monster = reinterpret_cast<cMonster &>(*entity);
|
auto & Monster = static_cast<cMonster &>(*entity);
|
||||||
currentPosition = Monster.GetPosition();
|
currentPosition = Monster.GetPosition();
|
||||||
for (const auto & PlayerPos : PlayerPositions)
|
for (const auto & PlayerPos : PlayerPositions)
|
||||||
{
|
{
|
||||||
@ -1902,11 +1902,11 @@ void cChunk::CollectPickupsByPlayer(cPlayer & a_Player)
|
|||||||
MarkDirty();
|
MarkDirty();
|
||||||
if (Entity->IsPickup())
|
if (Entity->IsPickup())
|
||||||
{
|
{
|
||||||
reinterpret_cast<cPickup *>(Entity.get())->CollectedBy(a_Player);
|
static_cast<cPickup &>(*Entity).CollectedBy(a_Player);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
reinterpret_cast<cProjectileEntity *>(Entity.get())->CollectedBy(a_Player);
|
static_cast<cProjectileEntity &>(*Entity).CollectedBy(a_Player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (SqrDist < 5 * 5)
|
else if (SqrDist < 5 * 5)
|
||||||
|
@ -782,7 +782,7 @@ void cClientHandle::HandleEnchantItem(UInt8 a_WindowID, UInt8 a_Enchantment)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cEnchantingWindow * Window = reinterpret_cast<cEnchantingWindow *>(m_Player->GetWindow());
|
cEnchantingWindow * Window = static_cast<cEnchantingWindow *>(m_Player->GetWindow());
|
||||||
cItem Item = *Window->m_SlotArea->GetSlot(0, *m_Player); // Make a copy of the item
|
cItem Item = *Window->m_SlotArea->GetSlot(0, *m_Player); // Make a copy of the item
|
||||||
short BaseEnchantmentLevel = Window->GetPropertyValue(a_Enchantment);
|
short BaseEnchantmentLevel = Window->GetPropertyValue(a_Enchantment);
|
||||||
|
|
||||||
@ -959,7 +959,7 @@ void cClientHandle::HandleBeaconSelection(int a_PrimaryEffect, int a_SecondaryEf
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
cBeaconWindow * BeaconWindow = reinterpret_cast<cBeaconWindow *>(Window);
|
cBeaconWindow * BeaconWindow = static_cast<cBeaconWindow *>(Window);
|
||||||
|
|
||||||
if (Window->GetSlot(*m_Player, 0)->IsEmpty())
|
if (Window->GetSlot(*m_Player, 0)->IsEmpty())
|
||||||
{
|
{
|
||||||
@ -1044,7 +1044,7 @@ void cClientHandle::HandleAnvilItemName(const AString & a_ItemName)
|
|||||||
|
|
||||||
if (a_ItemName.length() <= 30)
|
if (a_ItemName.length() <= 30)
|
||||||
{
|
{
|
||||||
reinterpret_cast<cAnvilWindow *>(m_Player->GetWindow())->SetRepairedItemName(a_ItemName, m_Player);
|
static_cast<cAnvilWindow *>(m_Player->GetWindow())->SetRepairedItemName(a_ItemName, m_Player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,7 +410,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
|
|||||||
|
|
||||||
if ((a_TDI.Attacker != nullptr) && (a_TDI.Attacker->IsPlayer()))
|
if ((a_TDI.Attacker != nullptr) && (a_TDI.Attacker->IsPlayer()))
|
||||||
{
|
{
|
||||||
cPlayer * Player = reinterpret_cast<cPlayer *>(a_TDI.Attacker);
|
cPlayer * Player = static_cast<cPlayer *>(a_TDI.Attacker);
|
||||||
|
|
||||||
Player->GetEquippedItem().GetHandler()->OnEntityAttack(Player, this);
|
Player->GetEquippedItem().GetHandler()->OnEntityAttack(Player, this);
|
||||||
|
|
||||||
@ -441,7 +441,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
|
|||||||
{
|
{
|
||||||
if (IsMob())
|
if (IsMob())
|
||||||
{
|
{
|
||||||
cMonster * Monster = reinterpret_cast<cMonster *>(this);
|
cMonster * Monster = static_cast<cMonster *>(this);
|
||||||
switch (Monster->GetMobType())
|
switch (Monster->GetMobType())
|
||||||
{
|
{
|
||||||
case mtSkeleton:
|
case mtSkeleton:
|
||||||
@ -460,7 +460,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
|
|||||||
{
|
{
|
||||||
if (IsMob())
|
if (IsMob())
|
||||||
{
|
{
|
||||||
cMonster * Monster = reinterpret_cast<cMonster *>(this);
|
cMonster * Monster = static_cast<cMonster *>(this);
|
||||||
switch (Monster->GetMobType())
|
switch (Monster->GetMobType())
|
||||||
{
|
{
|
||||||
case mtSpider:
|
case mtSpider:
|
||||||
@ -496,7 +496,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
|
|||||||
}
|
}
|
||||||
else if (IsMob() && !IsInWater())
|
else if (IsMob() && !IsInWater())
|
||||||
{
|
{
|
||||||
cMonster * Monster = reinterpret_cast<cMonster *>(this);
|
cMonster * Monster = static_cast<cMonster *>(this);
|
||||||
switch (Monster->GetMobType())
|
switch (Monster->GetMobType())
|
||||||
{
|
{
|
||||||
case mtGhast:
|
case mtGhast:
|
||||||
@ -871,7 +871,7 @@ void cEntity::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
|||||||
// Handle cactus damage or destruction:
|
// Handle cactus damage or destruction:
|
||||||
if (
|
if (
|
||||||
IsMob() || IsPickup() ||
|
IsMob() || IsPickup() ||
|
||||||
(IsPlayer() && !((reinterpret_cast<cPlayer *>(this))->IsGameModeCreative() || (reinterpret_cast<cPlayer *>(this))->IsGameModeSpectator()))
|
(IsPlayer() && !((static_cast<cPlayer *>(this))->IsGameModeCreative() || (static_cast<cPlayer *>(this))->IsGameModeSpectator()))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
DetectCacti();
|
DetectCacti();
|
||||||
@ -1362,7 +1362,7 @@ bool cEntity::DetectPortal()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsPlayer() && !(reinterpret_cast<cPlayer *>(this))->IsGameModeCreative() && (m_PortalCooldownData.m_TicksDelayed != 80))
|
if (IsPlayer() && !(static_cast<cPlayer *>(this))->IsGameModeCreative() && (m_PortalCooldownData.m_TicksDelayed != 80))
|
||||||
{
|
{
|
||||||
// Delay teleportation for four seconds if the entity is a non-creative player
|
// Delay teleportation for four seconds if the entity is a non-creative player
|
||||||
m_PortalCooldownData.m_TicksDelayed++;
|
m_PortalCooldownData.m_TicksDelayed++;
|
||||||
@ -1385,7 +1385,7 @@ bool cEntity::DetectPortal()
|
|||||||
if (IsPlayer())
|
if (IsPlayer())
|
||||||
{
|
{
|
||||||
// Send a respawn packet before world is loaded / generated so the client isn't left in limbo
|
// Send a respawn packet before world is loaded / generated so the client isn't left in limbo
|
||||||
(reinterpret_cast<cPlayer *>(this))->GetClientHandle()->SendRespawn(DestionationDim);
|
(static_cast<cPlayer *>(this))->GetClientHandle()->SendRespawn(DestionationDim);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3d TargetPos = GetPosition();
|
Vector3d TargetPos = GetPosition();
|
||||||
@ -1414,10 +1414,10 @@ bool cEntity::DetectPortal()
|
|||||||
{
|
{
|
||||||
if (DestionationDim == dimNether)
|
if (DestionationDim == dimNether)
|
||||||
{
|
{
|
||||||
reinterpret_cast<cPlayer *>(this)->AwardAchievement(achEnterPortal);
|
static_cast<cPlayer *>(this)->AwardAchievement(achEnterPortal);
|
||||||
}
|
}
|
||||||
|
|
||||||
reinterpret_cast<cPlayer *>(this)->GetClientHandle()->SendRespawn(DestionationDim);
|
static_cast<cPlayer *>(this)->GetClientHandle()->SendRespawn(DestionationDim);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3d TargetPos = GetPosition();
|
Vector3d TargetPos = GetPosition();
|
||||||
@ -1454,7 +1454,7 @@ bool cEntity::DetectPortal()
|
|||||||
|
|
||||||
if (IsPlayer())
|
if (IsPlayer())
|
||||||
{
|
{
|
||||||
cPlayer * Player = reinterpret_cast<cPlayer *>(this);
|
cPlayer * Player = static_cast<cPlayer *>(this);
|
||||||
if (Player->GetBedWorld() == DestinationWorld)
|
if (Player->GetBedWorld() == DestinationWorld)
|
||||||
{
|
{
|
||||||
Player->TeleportToCoords(Player->GetLastBedPos().x, Player->GetLastBedPos().y, Player->GetLastBedPos().z);
|
Player->TeleportToCoords(Player->GetLastBedPos().x, Player->GetLastBedPos().y, Player->GetLastBedPos().z);
|
||||||
@ -1487,9 +1487,9 @@ bool cEntity::DetectPortal()
|
|||||||
{
|
{
|
||||||
if (DestionationDim == dimEnd)
|
if (DestionationDim == dimEnd)
|
||||||
{
|
{
|
||||||
reinterpret_cast<cPlayer *>(this)->AwardAchievement(achEnterTheEnd);
|
static_cast<cPlayer *>(this)->AwardAchievement(achEnterTheEnd);
|
||||||
}
|
}
|
||||||
reinterpret_cast<cPlayer *>(this)->GetClientHandle()->SendRespawn(DestionationDim);
|
static_cast<cPlayer *>(this)->GetClientHandle()->SendRespawn(DestionationDim);
|
||||||
}
|
}
|
||||||
|
|
||||||
cWorld * TargetWorld = cRoot::Get()->GetWorld(GetWorld()->GetLinkedEndWorldName());
|
cWorld * TargetWorld = cRoot::Get()->GetWorld(GetWorld()->GetLinkedEndWorldName());
|
||||||
@ -1717,7 +1717,7 @@ void cEntity::HandleAir(void)
|
|||||||
|
|
||||||
if (RespirationLevel > 0)
|
if (RespirationLevel > 0)
|
||||||
{
|
{
|
||||||
reinterpret_cast<cPawn *>(this)->AddEntityEffect(cEntityEffect::effNightVision, 200, 5, 0);
|
static_cast<cPawn *>(this)->AddEntityEffect(cEntityEffect::effNightVision, 200, 5, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_AirLevel <= 0)
|
if (m_AirLevel <= 0)
|
||||||
|
@ -241,12 +241,12 @@ void cEntityEffectSpeed::OnActivate(cPawn & a_Target)
|
|||||||
{
|
{
|
||||||
if (a_Target.IsMob())
|
if (a_Target.IsMob())
|
||||||
{
|
{
|
||||||
cMonster * Mob = reinterpret_cast<cMonster*>(&a_Target);
|
cMonster * Mob = static_cast<cMonster*>(&a_Target);
|
||||||
Mob->SetRelativeWalkSpeed(Mob->GetRelativeWalkSpeed() + 0.2 * m_Intensity);
|
Mob->SetRelativeWalkSpeed(Mob->GetRelativeWalkSpeed() + 0.2 * m_Intensity);
|
||||||
}
|
}
|
||||||
else if (a_Target.IsPlayer())
|
else if (a_Target.IsPlayer())
|
||||||
{
|
{
|
||||||
cPlayer * Player = reinterpret_cast<cPlayer*>(&a_Target);
|
cPlayer * Player = static_cast<cPlayer*>(&a_Target);
|
||||||
Player->SetNormalMaxSpeed(Player->GetNormalMaxSpeed() + 0.2 * m_Intensity);
|
Player->SetNormalMaxSpeed(Player->GetNormalMaxSpeed() + 0.2 * m_Intensity);
|
||||||
Player->SetSprintingMaxSpeed(Player->GetSprintingMaxSpeed() + 0.26 * m_Intensity);
|
Player->SetSprintingMaxSpeed(Player->GetSprintingMaxSpeed() + 0.26 * m_Intensity);
|
||||||
Player->SetFlyingMaxSpeed(Player->GetFlyingMaxSpeed() + 0.2 * m_Intensity);
|
Player->SetFlyingMaxSpeed(Player->GetFlyingMaxSpeed() + 0.2 * m_Intensity);
|
||||||
@ -261,12 +261,12 @@ void cEntityEffectSpeed::OnDeactivate(cPawn & a_Target)
|
|||||||
{
|
{
|
||||||
if (a_Target.IsMob())
|
if (a_Target.IsMob())
|
||||||
{
|
{
|
||||||
cMonster * Mob = reinterpret_cast<cMonster*>(&a_Target);
|
cMonster * Mob = static_cast<cMonster*>(&a_Target);
|
||||||
Mob->SetRelativeWalkSpeed(Mob->GetRelativeWalkSpeed() - 0.2 * m_Intensity);
|
Mob->SetRelativeWalkSpeed(Mob->GetRelativeWalkSpeed() - 0.2 * m_Intensity);
|
||||||
}
|
}
|
||||||
else if (a_Target.IsPlayer())
|
else if (a_Target.IsPlayer())
|
||||||
{
|
{
|
||||||
cPlayer * Player = reinterpret_cast<cPlayer*>(&a_Target);
|
cPlayer * Player = static_cast<cPlayer*>(&a_Target);
|
||||||
Player->SetNormalMaxSpeed(Player->GetNormalMaxSpeed() - 0.2 * m_Intensity);
|
Player->SetNormalMaxSpeed(Player->GetNormalMaxSpeed() - 0.2 * m_Intensity);
|
||||||
Player->SetSprintingMaxSpeed(Player->GetSprintingMaxSpeed() - 0.26 * m_Intensity);
|
Player->SetSprintingMaxSpeed(Player->GetSprintingMaxSpeed() - 0.26 * m_Intensity);
|
||||||
Player->SetFlyingMaxSpeed(Player->GetFlyingMaxSpeed() - 0.2 * m_Intensity);
|
Player->SetFlyingMaxSpeed(Player->GetFlyingMaxSpeed() - 0.2 * m_Intensity);
|
||||||
@ -328,7 +328,7 @@ void cEntityEffectInstantHealth::OnActivate(cPawn & a_Target)
|
|||||||
// Base amount = 6, doubles for every increase in intensity
|
// Base amount = 6, doubles for every increase in intensity
|
||||||
int amount = static_cast<int>(6 * (1 << m_Intensity) * m_DistanceModifier);
|
int amount = static_cast<int>(6 * (1 << m_Intensity) * m_DistanceModifier);
|
||||||
|
|
||||||
if (a_Target.IsMob() && reinterpret_cast<cMonster &>(a_Target).IsUndead())
|
if (a_Target.IsMob() && static_cast<cMonster &>(a_Target).IsUndead())
|
||||||
{
|
{
|
||||||
a_Target.TakeDamage(dtPotionOfHarming, nullptr, amount, 0); // TODO: Store attacker in a pointer-safe way, pass to TakeDamage
|
a_Target.TakeDamage(dtPotionOfHarming, nullptr, amount, 0); // TODO: Store attacker in a pointer-safe way, pass to TakeDamage
|
||||||
return;
|
return;
|
||||||
@ -348,7 +348,7 @@ void cEntityEffectInstantDamage::OnActivate(cPawn & a_Target)
|
|||||||
// Base amount = 6, doubles for every increase in intensity
|
// Base amount = 6, doubles for every increase in intensity
|
||||||
int amount = static_cast<int>(6 * (1 << m_Intensity) * m_DistanceModifier);
|
int amount = static_cast<int>(6 * (1 << m_Intensity) * m_DistanceModifier);
|
||||||
|
|
||||||
if (a_Target.IsMob() && reinterpret_cast<cMonster &>(a_Target).IsUndead())
|
if (a_Target.IsMob() && static_cast<cMonster &>(a_Target).IsUndead())
|
||||||
{
|
{
|
||||||
a_Target.Heal(amount);
|
a_Target.Heal(amount);
|
||||||
return;
|
return;
|
||||||
@ -367,7 +367,7 @@ void cEntityEffectRegeneration::OnTick(cPawn & a_Target)
|
|||||||
{
|
{
|
||||||
super::OnTick(a_Target);
|
super::OnTick(a_Target);
|
||||||
|
|
||||||
if (a_Target.IsMob() && reinterpret_cast<cMonster &>(a_Target).IsUndead())
|
if (a_Target.IsMob() && static_cast<cMonster &>(a_Target).IsUndead())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -396,7 +396,7 @@ void cEntityEffectHunger::OnTick(cPawn & a_Target)
|
|||||||
|
|
||||||
if (a_Target.IsPlayer())
|
if (a_Target.IsPlayer())
|
||||||
{
|
{
|
||||||
cPlayer & Target = reinterpret_cast<cPlayer &>(a_Target);
|
cPlayer & Target = static_cast<cPlayer &>(a_Target);
|
||||||
Target.AddFoodExhaustion(0.025 * (static_cast<double>(GetIntensity()) + 1.0)); // 0.5 per second = 0.025 per tick
|
Target.AddFoodExhaustion(0.025 * (static_cast<double>(GetIntensity()) + 1.0)); // 0.5 per second = 0.025 per tick
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -448,7 +448,7 @@ void cEntityEffectPoison::OnTick(cPawn & a_Target)
|
|||||||
|
|
||||||
if (a_Target.IsMob())
|
if (a_Target.IsMob())
|
||||||
{
|
{
|
||||||
cMonster & Target = reinterpret_cast<cMonster &>(a_Target);
|
cMonster & Target = static_cast<cMonster &>(a_Target);
|
||||||
|
|
||||||
// Doesn't effect undead mobs, spiders
|
// Doesn't effect undead mobs, spiders
|
||||||
if (
|
if (
|
||||||
@ -505,7 +505,7 @@ void cEntityEffectSaturation::OnTick(cPawn & a_Target)
|
|||||||
{
|
{
|
||||||
if (a_Target.IsPlayer())
|
if (a_Target.IsPlayer())
|
||||||
{
|
{
|
||||||
cPlayer & Target = reinterpret_cast<cPlayer &>(a_Target);
|
cPlayer & Target = static_cast<cPlayer &>(a_Target);
|
||||||
Target.SetFoodSaturationLevel(Target.GetFoodSaturationLevel() + (1 + m_Intensity)); // Increase saturation 1 per tick, adds 1 for every increase in level
|
Target.SetFoodSaturationLevel(Target.GetFoodSaturationLevel() + (1 + m_Intensity)); // Increase saturation 1 per tick, adds 1 for every increase in level
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -968,7 +968,7 @@ bool cPlayer::DoTakeDamage(TakeDamageInfo & a_TDI)
|
|||||||
|
|
||||||
if ((a_TDI.Attacker != nullptr) && (a_TDI.Attacker->IsPlayer()))
|
if ((a_TDI.Attacker != nullptr) && (a_TDI.Attacker->IsPlayer()))
|
||||||
{
|
{
|
||||||
cPlayer * Attacker = reinterpret_cast<cPlayer *>(a_TDI.Attacker);
|
cPlayer * Attacker = static_cast<cPlayer *>(a_TDI.Attacker);
|
||||||
|
|
||||||
if ((m_Team != nullptr) && (m_Team == Attacker->m_Team))
|
if ((m_Team != nullptr) && (m_Team == Attacker->m_Team))
|
||||||
{
|
{
|
||||||
@ -1098,7 +1098,7 @@ void cPlayer::KilledBy(TakeDamageInfo & a_TDI)
|
|||||||
}
|
}
|
||||||
else if (a_TDI.Attacker->IsPlayer())
|
else if (a_TDI.Attacker->IsPlayer())
|
||||||
{
|
{
|
||||||
cPlayer * Killer = reinterpret_cast<cPlayer *>(a_TDI.Attacker);
|
cPlayer * Killer = static_cast<cPlayer *>(a_TDI.Attacker);
|
||||||
AString DeathMessage = Printf("%s was killed by %s", GetName().c_str(), Killer->GetName().c_str());
|
AString DeathMessage = Printf("%s was killed by %s", GetName().c_str(), Killer->GetName().c_str());
|
||||||
PluginManager->CallHookKilled(*this, a_TDI, DeathMessage);
|
PluginManager->CallHookKilled(*this, a_TDI, DeathMessage);
|
||||||
if (DeathMessage != AString(""))
|
if (DeathMessage != AString(""))
|
||||||
@ -1139,7 +1139,7 @@ void cPlayer::Killed(cEntity * a_Victim)
|
|||||||
}
|
}
|
||||||
else if (a_Victim->IsMob())
|
else if (a_Victim->IsMob())
|
||||||
{
|
{
|
||||||
if (reinterpret_cast<cMonster *>(a_Victim)->GetMobFamily() == cMonster::mfHostile)
|
if (static_cast<cMonster *>(a_Victim)->GetMobFamily() == cMonster::mfHostile)
|
||||||
{
|
{
|
||||||
AwardAchievement(achKillMonster);
|
AwardAchievement(achKillMonster);
|
||||||
}
|
}
|
||||||
@ -2529,7 +2529,7 @@ void cPlayer::UpdateMovementStats(const Vector3d & a_DeltaPos, bool a_PreviousIs
|
|||||||
case cEntity::etBoat: m_Stats.AddValue(statDistBoat, Value); break;
|
case cEntity::etBoat: m_Stats.AddValue(statDistBoat, Value); break;
|
||||||
case cEntity::etMonster:
|
case cEntity::etMonster:
|
||||||
{
|
{
|
||||||
cMonster * Monster = reinterpret_cast<cMonster *>(m_AttachedTo);
|
cMonster * Monster = static_cast<cMonster *>(m_AttachedTo);
|
||||||
switch (Monster->GetMobType())
|
switch (Monster->GetMobType())
|
||||||
{
|
{
|
||||||
case mtPig: m_Stats.AddValue(statDistPig, Value); break;
|
case mtPig: m_Stats.AddValue(statDistPig, Value); break;
|
||||||
|
@ -771,7 +771,7 @@ cPieces cPrefabPiecePool::GetStartingPieces(void)
|
|||||||
|
|
||||||
int cPrefabPiecePool::GetPieceWeight(const cPlacedPiece & a_PlacedPiece, const cPiece::cConnector & a_ExistingConnector, const cPiece & a_NewPiece)
|
int cPrefabPiecePool::GetPieceWeight(const cPlacedPiece & a_PlacedPiece, const cPiece::cConnector & a_ExistingConnector, const cPiece & a_NewPiece)
|
||||||
{
|
{
|
||||||
return (reinterpret_cast<const cPrefab &>(a_NewPiece)).GetPieceWeight(a_PlacedPiece, a_ExistingConnector);
|
return (static_cast<const cPrefab &>(a_NewPiece)).GetPieceWeight(a_PlacedPiece, a_ExistingConnector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -780,7 +780,7 @@ int cPrefabPiecePool::GetPieceWeight(const cPlacedPiece & a_PlacedPiece, const c
|
|||||||
|
|
||||||
int cPrefabPiecePool::GetStartingPieceWeight(const cPiece & a_NewPiece)
|
int cPrefabPiecePool::GetStartingPieceWeight(const cPiece & a_NewPiece)
|
||||||
{
|
{
|
||||||
return (reinterpret_cast<const cPrefab &>(a_NewPiece)).GetDefaultWeight();
|
return (static_cast<const cPrefab &>(a_NewPiece)).GetDefaultWeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -216,7 +216,7 @@ void cHTTPServer::NewRequest(cHTTPServerConnection & a_Connection, cHTTPIncoming
|
|||||||
|
|
||||||
void cHTTPServer::RequestBody(cHTTPServerConnection & a_Connection, cHTTPIncomingRequest & a_Request, const void * a_Data, size_t a_Size)
|
void cHTTPServer::RequestBody(cHTTPServerConnection & a_Connection, cHTTPIncomingRequest & a_Request, const void * a_Data, size_t a_Size)
|
||||||
{
|
{
|
||||||
m_Callbacks->OnRequestBody(a_Connection, a_Request, reinterpret_cast<const char *>(a_Data), a_Size);
|
m_Callbacks->OnRequestBody(a_Connection, a_Request, static_cast<const char *>(a_Data), a_Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ void cSslHTTPServerConnection::OnReceivedData(const char * a_Data, size_t a_Size
|
|||||||
|
|
||||||
void cSslHTTPServerConnection::SendData(const void * a_Data, size_t a_Size)
|
void cSslHTTPServerConnection::SendData(const void * a_Data, size_t a_Size)
|
||||||
{
|
{
|
||||||
const char * OutgoingData = reinterpret_cast<const char *>(a_Data);
|
const char * OutgoingData = static_cast<const char *>(a_Data);
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
@ -79,7 +79,7 @@ void cCreeper::GetDrops(cItems & a_Drops, cEntity * a_Killer)
|
|||||||
if (
|
if (
|
||||||
(a_Killer != nullptr) &&
|
(a_Killer != nullptr) &&
|
||||||
a_Killer->IsProjectile() &&
|
a_Killer->IsProjectile() &&
|
||||||
((reinterpret_cast<cProjectileEntity *>(a_Killer))->GetCreatorUniqueID() != cEntity::INVALID_ID))
|
((static_cast<cProjectileEntity *>(a_Killer))->GetCreatorUniqueID() != cEntity::INVALID_ID))
|
||||||
{
|
{
|
||||||
auto ProjectileCreatorCallback = [](cEntity & a_Entity)
|
auto ProjectileCreatorCallback = [](cEntity & a_Entity)
|
||||||
{
|
{
|
||||||
|
@ -285,7 +285,7 @@ int cFile::ReadRestOfFile(AString & a_Contents)
|
|||||||
|
|
||||||
// HACK: This depends on the internal knowledge that AString's data() function returns the internal buffer directly
|
// HACK: This depends on the internal knowledge that AString's data() function returns the internal buffer directly
|
||||||
a_Contents.assign(DataSize, '\0');
|
a_Contents.assign(DataSize, '\0');
|
||||||
return Read(reinterpret_cast<void *>(const_cast<char *>(a_Contents.data())), DataSize);
|
return Read(static_cast<void *>(const_cast<char *>(a_Contents.data())), DataSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ void cNetworkSingleton::RunEventLoop(cNetworkSingleton * a_Self)
|
|||||||
|
|
||||||
void cNetworkSingleton::SignalizeStartup(evutil_socket_t a_Socket, short a_Events, void * a_Self)
|
void cNetworkSingleton::SignalizeStartup(evutil_socket_t a_Socket, short a_Events, void * a_Self)
|
||||||
{
|
{
|
||||||
auto self = reinterpret_cast<cNetworkSingleton *>(a_Self);
|
auto self = static_cast<cNetworkSingleton *>(a_Self);
|
||||||
ASSERT(self != nullptr);
|
ASSERT(self != nullptr);
|
||||||
self->m_StartupEvent.Set();
|
self->m_StartupEvent.Set();
|
||||||
}
|
}
|
||||||
|
@ -284,7 +284,7 @@ bool cServerHandleImpl::Listen(UInt16 a_Port)
|
|||||||
void cServerHandleImpl::Callback(evconnlistener * a_Listener, evutil_socket_t a_Socket, sockaddr * a_Addr, int a_Len, void * a_Self)
|
void cServerHandleImpl::Callback(evconnlistener * a_Listener, evutil_socket_t a_Socket, sockaddr * a_Addr, int a_Len, void * a_Self)
|
||||||
{
|
{
|
||||||
// Cast to true self:
|
// Cast to true self:
|
||||||
cServerHandleImpl * Self = reinterpret_cast<cServerHandleImpl *>(a_Self);
|
cServerHandleImpl * Self = static_cast<cServerHandleImpl *>(a_Self);
|
||||||
ASSERT(Self != nullptr);
|
ASSERT(Self != nullptr);
|
||||||
ASSERT(Self->m_SelfPtr != nullptr);
|
ASSERT(Self->m_SelfPtr != nullptr);
|
||||||
|
|
||||||
|
@ -398,7 +398,7 @@ void cProtocol_1_10_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity &
|
|||||||
{
|
{
|
||||||
case cEntity::etPlayer:
|
case cEntity::etPlayer:
|
||||||
{
|
{
|
||||||
auto & Player = reinterpret_cast<const cPlayer &>(a_Entity);
|
auto & Player = static_cast<const cPlayer &>(a_Entity);
|
||||||
|
|
||||||
// TODO Set player custom name to their name.
|
// TODO Set player custom name to their name.
|
||||||
// Then it's possible to move the custom name of mobs to the entities
|
// Then it's possible to move the custom name of mobs to the entities
|
||||||
@ -424,7 +424,7 @@ void cProtocol_1_10_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity &
|
|||||||
{
|
{
|
||||||
a_Pkt.WriteBEUInt8(ITEM_ITEM);
|
a_Pkt.WriteBEUInt8(ITEM_ITEM);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
|
||||||
WriteItem(a_Pkt, reinterpret_cast<const cPickup &>(a_Entity).GetItem());
|
WriteItem(a_Pkt, static_cast<const cPickup &>(a_Entity).GetItem());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case cEntity::etMinecart:
|
case cEntity::etMinecart:
|
||||||
@ -433,7 +433,7 @@ void cProtocol_1_10_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity &
|
|||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
||||||
|
|
||||||
// The following expression makes Minecarts shake more with less health or higher damage taken
|
// The following expression makes Minecarts shake more with less health or higher damage taken
|
||||||
auto & Minecart = reinterpret_cast<const cMinecart &>(a_Entity);
|
auto & Minecart = static_cast<const cMinecart &>(a_Entity);
|
||||||
auto maxHealth = a_Entity.GetMaxHealth();
|
auto maxHealth = a_Entity.GetMaxHealth();
|
||||||
auto curHealth = a_Entity.GetHealth();
|
auto curHealth = a_Entity.GetHealth();
|
||||||
a_Pkt.WriteVarInt32(static_cast<UInt32>((maxHealth - curHealth) * Minecart.LastDamage() * 4));
|
a_Pkt.WriteVarInt32(static_cast<UInt32>((maxHealth - curHealth) * Minecart.LastDamage() * 4));
|
||||||
@ -448,7 +448,7 @@ void cProtocol_1_10_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity &
|
|||||||
|
|
||||||
if (Minecart.GetPayload() == cMinecart::mpNone)
|
if (Minecart.GetPayload() == cMinecart::mpNone)
|
||||||
{
|
{
|
||||||
auto & RideableMinecart = reinterpret_cast<const cRideableMinecart &>(Minecart);
|
auto & RideableMinecart = static_cast<const cRideableMinecart &>(Minecart);
|
||||||
const cItem & MinecartContent = RideableMinecart.GetContent();
|
const cItem & MinecartContent = RideableMinecart.GetContent();
|
||||||
if (!MinecartContent.IsEmpty())
|
if (!MinecartContent.IsEmpty())
|
||||||
{
|
{
|
||||||
@ -471,35 +471,35 @@ void cProtocol_1_10_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity &
|
|||||||
{
|
{
|
||||||
a_Pkt.WriteBEUInt8(MINECART_FURNACE_POWERED);
|
a_Pkt.WriteBEUInt8(MINECART_FURNACE_POWERED);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
a_Pkt.WriteBool(reinterpret_cast<const cMinecartWithFurnace &>(Minecart).IsFueled());
|
a_Pkt.WriteBool(static_cast<const cMinecartWithFurnace &>(Minecart).IsFueled());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} // case etMinecart
|
} // case etMinecart
|
||||||
|
|
||||||
case cEntity::etProjectile:
|
case cEntity::etProjectile:
|
||||||
{
|
{
|
||||||
auto & Projectile = reinterpret_cast<const cProjectileEntity &>(a_Entity);
|
auto & Projectile = static_cast<const cProjectileEntity &>(a_Entity);
|
||||||
switch (Projectile.GetProjectileKind())
|
switch (Projectile.GetProjectileKind())
|
||||||
{
|
{
|
||||||
case cProjectileEntity::pkArrow:
|
case cProjectileEntity::pkArrow:
|
||||||
{
|
{
|
||||||
a_Pkt.WriteBEUInt8(ARROW_CRITICAL);
|
a_Pkt.WriteBEUInt8(ARROW_CRITICAL);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BYTE);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BYTE);
|
||||||
a_Pkt.WriteBEInt8(reinterpret_cast<const cArrowEntity &>(Projectile).IsCritical() ? 1 : 0);
|
a_Pkt.WriteBEInt8(static_cast<const cArrowEntity &>(Projectile).IsCritical() ? 1 : 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case cProjectileEntity::pkFirework:
|
case cProjectileEntity::pkFirework:
|
||||||
{
|
{
|
||||||
a_Pkt.WriteBEUInt8(FIREWORK_INFO); // Firework item used for this firework
|
a_Pkt.WriteBEUInt8(FIREWORK_INFO); // Firework item used for this firework
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
|
||||||
WriteItem(a_Pkt, reinterpret_cast<const cFireworkEntity &>(Projectile).GetItem());
|
WriteItem(a_Pkt, static_cast<const cFireworkEntity &>(Projectile).GetItem());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case cProjectileEntity::pkSplashPotion:
|
case cProjectileEntity::pkSplashPotion:
|
||||||
{
|
{
|
||||||
a_Pkt.WriteBEUInt8(POTION_THROWN); // Potion item which was thrown
|
a_Pkt.WriteBEUInt8(POTION_THROWN); // Potion item which was thrown
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
|
||||||
WriteItem(a_Pkt, reinterpret_cast<const cSplashPotionEntity &>(Projectile).GetItem());
|
WriteItem(a_Pkt, static_cast<const cSplashPotionEntity &>(Projectile).GetItem());
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
@ -511,13 +511,13 @@ void cProtocol_1_10_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity &
|
|||||||
|
|
||||||
case cEntity::etMonster:
|
case cEntity::etMonster:
|
||||||
{
|
{
|
||||||
WriteMobMetadata(a_Pkt, reinterpret_cast<const cMonster &>(a_Entity));
|
WriteMobMetadata(a_Pkt, static_cast<const cMonster &>(a_Entity));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case cEntity::etBoat:
|
case cEntity::etBoat:
|
||||||
{
|
{
|
||||||
auto & Boat = reinterpret_cast<const cBoat &>(a_Entity);
|
auto & Boat = static_cast<const cBoat &>(a_Entity);
|
||||||
|
|
||||||
a_Pkt.WriteBEInt8(BOAT_LAST_HIT_TIME);
|
a_Pkt.WriteBEInt8(BOAT_LAST_HIT_TIME);
|
||||||
a_Pkt.WriteBEInt8(METADATA_TYPE_VARINT);
|
a_Pkt.WriteBEInt8(METADATA_TYPE_VARINT);
|
||||||
@ -548,7 +548,7 @@ void cProtocol_1_10_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity &
|
|||||||
|
|
||||||
case cEntity::etItemFrame:
|
case cEntity::etItemFrame:
|
||||||
{
|
{
|
||||||
auto & Frame = reinterpret_cast<const cItemFrame &>(a_Entity);
|
auto & Frame = static_cast<const cItemFrame &>(a_Entity);
|
||||||
a_Pkt.WriteBEUInt8(ITEM_FRAME_ITEM);
|
a_Pkt.WriteBEUInt8(ITEM_FRAME_ITEM);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
|
||||||
WriteItem(a_Pkt, Frame.GetItem());
|
WriteItem(a_Pkt, Frame.GetItem());
|
||||||
@ -577,7 +577,7 @@ void cProtocol_1_10_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity
|
|||||||
{
|
{
|
||||||
case E_BLOCK_BEACON:
|
case E_BLOCK_BEACON:
|
||||||
{
|
{
|
||||||
auto & BeaconEntity = reinterpret_cast<const cBeaconEntity &>(a_BlockEntity);
|
auto & BeaconEntity = static_cast<const cBeaconEntity &>(a_BlockEntity);
|
||||||
Writer.AddInt("x", BeaconEntity.GetPosX());
|
Writer.AddInt("x", BeaconEntity.GetPosX());
|
||||||
Writer.AddInt("y", BeaconEntity.GetPosY());
|
Writer.AddInt("y", BeaconEntity.GetPosY());
|
||||||
Writer.AddInt("z", BeaconEntity.GetPosZ());
|
Writer.AddInt("z", BeaconEntity.GetPosZ());
|
||||||
@ -590,7 +590,7 @@ void cProtocol_1_10_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity
|
|||||||
|
|
||||||
case E_BLOCK_COMMAND_BLOCK:
|
case E_BLOCK_COMMAND_BLOCK:
|
||||||
{
|
{
|
||||||
auto & CommandBlockEntity = reinterpret_cast<const cCommandBlockEntity &>(a_BlockEntity);
|
auto & CommandBlockEntity = static_cast<const cCommandBlockEntity &>(a_BlockEntity);
|
||||||
Writer.AddByte("TrackOutput", 1); // Neither I nor the MC wiki has any idea about this
|
Writer.AddByte("TrackOutput", 1); // Neither I nor the MC wiki has any idea about this
|
||||||
Writer.AddInt("SuccessCount", CommandBlockEntity.GetResult());
|
Writer.AddInt("SuccessCount", CommandBlockEntity.GetResult());
|
||||||
Writer.AddInt("x", CommandBlockEntity.GetPosX());
|
Writer.AddInt("x", CommandBlockEntity.GetPosX());
|
||||||
@ -611,7 +611,7 @@ void cProtocol_1_10_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity
|
|||||||
|
|
||||||
case E_BLOCK_HEAD:
|
case E_BLOCK_HEAD:
|
||||||
{
|
{
|
||||||
auto & MobHeadEntity = reinterpret_cast<const cMobHeadEntity &>(a_BlockEntity);
|
auto & MobHeadEntity = static_cast<const cMobHeadEntity &>(a_BlockEntity);
|
||||||
Writer.AddInt("x", MobHeadEntity.GetPosX());
|
Writer.AddInt("x", MobHeadEntity.GetPosX());
|
||||||
Writer.AddInt("y", MobHeadEntity.GetPosY());
|
Writer.AddInt("y", MobHeadEntity.GetPosY());
|
||||||
Writer.AddInt("z", MobHeadEntity.GetPosZ());
|
Writer.AddInt("z", MobHeadEntity.GetPosZ());
|
||||||
@ -637,7 +637,7 @@ void cProtocol_1_10_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity
|
|||||||
|
|
||||||
case E_BLOCK_FLOWER_POT:
|
case E_BLOCK_FLOWER_POT:
|
||||||
{
|
{
|
||||||
auto & FlowerPotEntity = reinterpret_cast<const cFlowerPotEntity &>(a_BlockEntity);
|
auto & FlowerPotEntity = static_cast<const cFlowerPotEntity &>(a_BlockEntity);
|
||||||
Writer.AddInt("x", FlowerPotEntity.GetPosX());
|
Writer.AddInt("x", FlowerPotEntity.GetPosX());
|
||||||
Writer.AddInt("y", FlowerPotEntity.GetPosY());
|
Writer.AddInt("y", FlowerPotEntity.GetPosY());
|
||||||
Writer.AddInt("z", FlowerPotEntity.GetPosZ());
|
Writer.AddInt("z", FlowerPotEntity.GetPosZ());
|
||||||
@ -649,7 +649,7 @@ void cProtocol_1_10_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity
|
|||||||
|
|
||||||
case E_BLOCK_MOB_SPAWNER:
|
case E_BLOCK_MOB_SPAWNER:
|
||||||
{
|
{
|
||||||
auto & MobSpawnerEntity = reinterpret_cast<const cMobSpawnerEntity &>(a_BlockEntity);
|
auto & MobSpawnerEntity = static_cast<const cMobSpawnerEntity &>(a_BlockEntity);
|
||||||
Writer.AddInt("x", MobSpawnerEntity.GetPosX());
|
Writer.AddInt("x", MobSpawnerEntity.GetPosX());
|
||||||
Writer.AddInt("y", MobSpawnerEntity.GetPosY());
|
Writer.AddInt("y", MobSpawnerEntity.GetPosY());
|
||||||
Writer.AddInt("z", MobSpawnerEntity.GetPosZ());
|
Writer.AddInt("z", MobSpawnerEntity.GetPosZ());
|
||||||
@ -700,7 +700,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
{
|
{
|
||||||
case mtBat:
|
case mtBat:
|
||||||
{
|
{
|
||||||
auto & Bat = reinterpret_cast<const cBat &>(a_Mob);
|
auto & Bat = static_cast<const cBat &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(BAT_HANGING);
|
a_Pkt.WriteBEUInt8(BAT_HANGING);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BYTE);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BYTE);
|
||||||
a_Pkt.WriteBEInt8(Bat.IsHanging() ? 1 : 0);
|
a_Pkt.WriteBEInt8(Bat.IsHanging() ? 1 : 0);
|
||||||
@ -709,7 +709,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtChicken:
|
case mtChicken:
|
||||||
{
|
{
|
||||||
auto & Chicken = reinterpret_cast<const cChicken &>(a_Mob);
|
auto & Chicken = static_cast<const cChicken &>(a_Mob);
|
||||||
|
|
||||||
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
@ -719,7 +719,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtCow:
|
case mtCow:
|
||||||
{
|
{
|
||||||
auto & Cow = reinterpret_cast<const cCow &>(a_Mob);
|
auto & Cow = static_cast<const cCow &>(a_Mob);
|
||||||
|
|
||||||
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
@ -729,7 +729,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtCreeper:
|
case mtCreeper:
|
||||||
{
|
{
|
||||||
auto & Creeper = reinterpret_cast<const cCreeper &>(a_Mob);
|
auto & Creeper = static_cast<const cCreeper &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(CREEPER_STATE); // (idle or "blowing")
|
a_Pkt.WriteBEUInt8(CREEPER_STATE); // (idle or "blowing")
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
||||||
a_Pkt.WriteVarInt32(Creeper.IsBlowing() ? 1 : static_cast<UInt32>(-1));
|
a_Pkt.WriteVarInt32(Creeper.IsBlowing() ? 1 : static_cast<UInt32>(-1));
|
||||||
@ -746,7 +746,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtEnderman:
|
case mtEnderman:
|
||||||
{
|
{
|
||||||
auto & Enderman = reinterpret_cast<const cEnderman &>(a_Mob);
|
auto & Enderman = static_cast<const cEnderman &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(ENDERMAN_CARRIED_BLOCK);
|
a_Pkt.WriteBEUInt8(ENDERMAN_CARRIED_BLOCK);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BLOCKID);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BLOCKID);
|
||||||
UInt32 Carried = 0;
|
UInt32 Carried = 0;
|
||||||
@ -762,7 +762,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtGhast:
|
case mtGhast:
|
||||||
{
|
{
|
||||||
auto & Ghast = reinterpret_cast<const cGhast &>(a_Mob);
|
auto & Ghast = static_cast<const cGhast &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(GHAST_ATTACKING);
|
a_Pkt.WriteBEUInt8(GHAST_ATTACKING);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
a_Pkt.WriteBool(Ghast.IsCharging());
|
a_Pkt.WriteBool(Ghast.IsCharging());
|
||||||
@ -771,7 +771,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtHorse:
|
case mtHorse:
|
||||||
{
|
{
|
||||||
auto & Horse = reinterpret_cast<const cHorse &>(a_Mob);
|
auto & Horse = static_cast<const cHorse &>(a_Mob);
|
||||||
Int8 Flags = 0;
|
Int8 Flags = 0;
|
||||||
if (Horse.IsTame())
|
if (Horse.IsTame())
|
||||||
{
|
{
|
||||||
@ -824,7 +824,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtMagmaCube:
|
case mtMagmaCube:
|
||||||
{
|
{
|
||||||
auto & MagmaCube = reinterpret_cast<const cMagmaCube &>(a_Mob);
|
auto & MagmaCube = static_cast<const cMagmaCube &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(SLIME_SIZE);
|
a_Pkt.WriteBEUInt8(SLIME_SIZE);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
||||||
a_Pkt.WriteVarInt32(static_cast<UInt32>(MagmaCube.GetSize()));
|
a_Pkt.WriteVarInt32(static_cast<UInt32>(MagmaCube.GetSize()));
|
||||||
@ -833,7 +833,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtOcelot:
|
case mtOcelot:
|
||||||
{
|
{
|
||||||
auto & Ocelot = reinterpret_cast<const cOcelot &>(a_Mob);
|
auto & Ocelot = static_cast<const cOcelot &>(a_Mob);
|
||||||
|
|
||||||
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
@ -843,7 +843,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtPig:
|
case mtPig:
|
||||||
{
|
{
|
||||||
auto & Pig = reinterpret_cast<const cPig &>(a_Mob);
|
auto & Pig = static_cast<const cPig &>(a_Mob);
|
||||||
|
|
||||||
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
@ -858,7 +858,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtRabbit:
|
case mtRabbit:
|
||||||
{
|
{
|
||||||
auto & Rabbit = reinterpret_cast<const cRabbit &>(a_Mob);
|
auto & Rabbit = static_cast<const cRabbit &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
a_Pkt.WriteBool(Rabbit.IsBaby());
|
a_Pkt.WriteBool(Rabbit.IsBaby());
|
||||||
@ -871,7 +871,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtSheep:
|
case mtSheep:
|
||||||
{
|
{
|
||||||
auto & Sheep = reinterpret_cast<const cSheep &>(a_Mob);
|
auto & Sheep = static_cast<const cSheep &>(a_Mob);
|
||||||
|
|
||||||
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
@ -891,7 +891,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtSkeleton:
|
case mtSkeleton:
|
||||||
{
|
{
|
||||||
auto & Skeleton = reinterpret_cast<const cSkeleton &>(a_Mob);
|
auto & Skeleton = static_cast<const cSkeleton &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(SKELETON_TYPE);
|
a_Pkt.WriteBEUInt8(SKELETON_TYPE);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
||||||
a_Pkt.WriteVarInt32(Skeleton.IsWither() ? 1 : 0);
|
a_Pkt.WriteVarInt32(Skeleton.IsWither() ? 1 : 0);
|
||||||
@ -900,7 +900,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtSlime:
|
case mtSlime:
|
||||||
{
|
{
|
||||||
auto & Slime = reinterpret_cast<const cSlime &>(a_Mob);
|
auto & Slime = static_cast<const cSlime &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(SLIME_SIZE);
|
a_Pkt.WriteBEUInt8(SLIME_SIZE);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
||||||
a_Pkt.WriteVarInt32(static_cast<UInt32>(Slime.GetSize()));
|
a_Pkt.WriteVarInt32(static_cast<UInt32>(Slime.GetSize()));
|
||||||
@ -909,7 +909,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtVillager:
|
case mtVillager:
|
||||||
{
|
{
|
||||||
auto & Villager = reinterpret_cast<const cVillager &>(a_Mob);
|
auto & Villager = static_cast<const cVillager &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
a_Pkt.WriteBool(Villager.IsBaby());
|
a_Pkt.WriteBool(Villager.IsBaby());
|
||||||
@ -922,7 +922,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtWitch:
|
case mtWitch:
|
||||||
{
|
{
|
||||||
auto & Witch = reinterpret_cast<const cWitch &>(a_Mob);
|
auto & Witch = static_cast<const cWitch &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(WITCH_AGGRESIVE);
|
a_Pkt.WriteBEUInt8(WITCH_AGGRESIVE);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
a_Pkt.WriteBool(Witch.IsAngry());
|
a_Pkt.WriteBool(Witch.IsAngry());
|
||||||
@ -931,7 +931,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtWither:
|
case mtWither:
|
||||||
{
|
{
|
||||||
auto & Wither = reinterpret_cast<const cWither &>(a_Mob);
|
auto & Wither = static_cast<const cWither &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(WITHER_INVULNERABLE_TIMER);
|
a_Pkt.WriteBEUInt8(WITHER_INVULNERABLE_TIMER);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
||||||
a_Pkt.WriteVarInt32(Wither.GetWitherInvulnerableTicks());
|
a_Pkt.WriteVarInt32(Wither.GetWitherInvulnerableTicks());
|
||||||
@ -942,7 +942,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtWolf:
|
case mtWolf:
|
||||||
{
|
{
|
||||||
auto & Wolf = reinterpret_cast<const cWolf &>(a_Mob);
|
auto & Wolf = static_cast<const cWolf &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
a_Pkt.WriteBool(Wolf.IsBaby());
|
a_Pkt.WriteBool(Wolf.IsBaby());
|
||||||
@ -980,7 +980,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtZombie:
|
case mtZombie:
|
||||||
{
|
{
|
||||||
auto & Zombie = reinterpret_cast<const cZombie &>(a_Mob);
|
auto & Zombie = static_cast<const cZombie &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(ZOMBIE_IS_BABY);
|
a_Pkt.WriteBEUInt8(ZOMBIE_IS_BABY);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
a_Pkt.WriteBool(Zombie.IsBaby());
|
a_Pkt.WriteBool(Zombie.IsBaby());
|
||||||
@ -997,7 +997,7 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtZombiePigman:
|
case mtZombiePigman:
|
||||||
{
|
{
|
||||||
auto & ZombiePigman = reinterpret_cast<const cZombiePigman &>(a_Mob);
|
auto & ZombiePigman = static_cast<const cZombiePigman &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
a_Pkt.WriteBool(ZombiePigman.IsBaby());
|
a_Pkt.WriteBool(ZombiePigman.IsBaby());
|
||||||
|
@ -411,7 +411,7 @@ void cProtocol_1_11_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity
|
|||||||
{
|
{
|
||||||
case E_BLOCK_BEACON:
|
case E_BLOCK_BEACON:
|
||||||
{
|
{
|
||||||
auto & BeaconEntity = reinterpret_cast<const cBeaconEntity &>(a_BlockEntity);
|
auto & BeaconEntity = static_cast<const cBeaconEntity &>(a_BlockEntity);
|
||||||
Writer.AddInt("x", BeaconEntity.GetPosX());
|
Writer.AddInt("x", BeaconEntity.GetPosX());
|
||||||
Writer.AddInt("y", BeaconEntity.GetPosY());
|
Writer.AddInt("y", BeaconEntity.GetPosY());
|
||||||
Writer.AddInt("z", BeaconEntity.GetPosZ());
|
Writer.AddInt("z", BeaconEntity.GetPosZ());
|
||||||
@ -424,7 +424,7 @@ void cProtocol_1_11_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity
|
|||||||
|
|
||||||
case E_BLOCK_BED:
|
case E_BLOCK_BED:
|
||||||
{
|
{
|
||||||
auto & BedEntity = reinterpret_cast<const cBedEntity &>(a_BlockEntity);
|
auto & BedEntity = static_cast<const cBedEntity &>(a_BlockEntity);
|
||||||
Writer.AddInt("x", BedEntity.GetPosX());
|
Writer.AddInt("x", BedEntity.GetPosX());
|
||||||
Writer.AddInt("y", BedEntity.GetPosY());
|
Writer.AddInt("y", BedEntity.GetPosY());
|
||||||
Writer.AddInt("z", BedEntity.GetPosZ());
|
Writer.AddInt("z", BedEntity.GetPosZ());
|
||||||
@ -435,7 +435,7 @@ void cProtocol_1_11_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity
|
|||||||
|
|
||||||
case E_BLOCK_COMMAND_BLOCK:
|
case E_BLOCK_COMMAND_BLOCK:
|
||||||
{
|
{
|
||||||
auto & CommandBlockEntity = reinterpret_cast<const cCommandBlockEntity &>(a_BlockEntity);
|
auto & CommandBlockEntity = static_cast<const cCommandBlockEntity &>(a_BlockEntity);
|
||||||
Writer.AddByte("TrackOutput", 1); // Neither I nor the MC wiki has any idea about this
|
Writer.AddByte("TrackOutput", 1); // Neither I nor the MC wiki has any idea about this
|
||||||
Writer.AddInt("SuccessCount", CommandBlockEntity.GetResult());
|
Writer.AddInt("SuccessCount", CommandBlockEntity.GetResult());
|
||||||
Writer.AddInt("x", CommandBlockEntity.GetPosX());
|
Writer.AddInt("x", CommandBlockEntity.GetPosX());
|
||||||
@ -456,7 +456,7 @@ void cProtocol_1_11_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity
|
|||||||
|
|
||||||
case E_BLOCK_HEAD:
|
case E_BLOCK_HEAD:
|
||||||
{
|
{
|
||||||
auto & MobHeadEntity = reinterpret_cast<const cMobHeadEntity &>(a_BlockEntity);
|
auto & MobHeadEntity = static_cast<const cMobHeadEntity &>(a_BlockEntity);
|
||||||
Writer.AddInt("x", MobHeadEntity.GetPosX());
|
Writer.AddInt("x", MobHeadEntity.GetPosX());
|
||||||
Writer.AddInt("y", MobHeadEntity.GetPosY());
|
Writer.AddInt("y", MobHeadEntity.GetPosY());
|
||||||
Writer.AddInt("z", MobHeadEntity.GetPosZ());
|
Writer.AddInt("z", MobHeadEntity.GetPosZ());
|
||||||
@ -482,7 +482,7 @@ void cProtocol_1_11_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity
|
|||||||
|
|
||||||
case E_BLOCK_FLOWER_POT:
|
case E_BLOCK_FLOWER_POT:
|
||||||
{
|
{
|
||||||
auto & FlowerPotEntity = reinterpret_cast<const cFlowerPotEntity &>(a_BlockEntity);
|
auto & FlowerPotEntity = static_cast<const cFlowerPotEntity &>(a_BlockEntity);
|
||||||
Writer.AddInt("x", FlowerPotEntity.GetPosX());
|
Writer.AddInt("x", FlowerPotEntity.GetPosX());
|
||||||
Writer.AddInt("y", FlowerPotEntity.GetPosY());
|
Writer.AddInt("y", FlowerPotEntity.GetPosY());
|
||||||
Writer.AddInt("z", FlowerPotEntity.GetPosZ());
|
Writer.AddInt("z", FlowerPotEntity.GetPosZ());
|
||||||
@ -494,7 +494,7 @@ void cProtocol_1_11_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity
|
|||||||
|
|
||||||
case E_BLOCK_MOB_SPAWNER:
|
case E_BLOCK_MOB_SPAWNER:
|
||||||
{
|
{
|
||||||
auto & MobSpawnerEntity = reinterpret_cast<const cMobSpawnerEntity &>(a_BlockEntity);
|
auto & MobSpawnerEntity = static_cast<const cMobSpawnerEntity &>(a_BlockEntity);
|
||||||
Writer.AddInt("x", MobSpawnerEntity.GetPosX());
|
Writer.AddInt("x", MobSpawnerEntity.GetPosX());
|
||||||
Writer.AddInt("y", MobSpawnerEntity.GetPosY());
|
Writer.AddInt("y", MobSpawnerEntity.GetPosY());
|
||||||
Writer.AddInt("z", MobSpawnerEntity.GetPosZ());
|
Writer.AddInt("z", MobSpawnerEntity.GetPosZ());
|
||||||
@ -636,7 +636,7 @@ void cProtocol_1_11_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity &
|
|||||||
{
|
{
|
||||||
case cEntity::etPlayer:
|
case cEntity::etPlayer:
|
||||||
{
|
{
|
||||||
auto & Player = reinterpret_cast<const cPlayer &>(a_Entity);
|
auto & Player = static_cast<const cPlayer &>(a_Entity);
|
||||||
|
|
||||||
// TODO Set player custom name to their name.
|
// TODO Set player custom name to their name.
|
||||||
// Then it's possible to move the custom name of mobs to the entities
|
// Then it's possible to move the custom name of mobs to the entities
|
||||||
@ -662,7 +662,7 @@ void cProtocol_1_11_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity &
|
|||||||
{
|
{
|
||||||
a_Pkt.WriteBEUInt8(ITEM_ITEM);
|
a_Pkt.WriteBEUInt8(ITEM_ITEM);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
|
||||||
WriteItem(a_Pkt, reinterpret_cast<const cPickup &>(a_Entity).GetItem());
|
WriteItem(a_Pkt, static_cast<const cPickup &>(a_Entity).GetItem());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case cEntity::etMinecart:
|
case cEntity::etMinecart:
|
||||||
@ -671,7 +671,7 @@ void cProtocol_1_11_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity &
|
|||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
||||||
|
|
||||||
// The following expression makes Minecarts shake more with less health or higher damage taken
|
// The following expression makes Minecarts shake more with less health or higher damage taken
|
||||||
auto & Minecart = reinterpret_cast<const cMinecart &>(a_Entity);
|
auto & Minecart = static_cast<const cMinecart &>(a_Entity);
|
||||||
auto maxHealth = a_Entity.GetMaxHealth();
|
auto maxHealth = a_Entity.GetMaxHealth();
|
||||||
auto curHealth = a_Entity.GetHealth();
|
auto curHealth = a_Entity.GetHealth();
|
||||||
a_Pkt.WriteVarInt32(static_cast<UInt32>((maxHealth - curHealth) * Minecart.LastDamage() * 4));
|
a_Pkt.WriteVarInt32(static_cast<UInt32>((maxHealth - curHealth) * Minecart.LastDamage() * 4));
|
||||||
@ -686,7 +686,7 @@ void cProtocol_1_11_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity &
|
|||||||
|
|
||||||
if (Minecart.GetPayload() == cMinecart::mpNone)
|
if (Minecart.GetPayload() == cMinecart::mpNone)
|
||||||
{
|
{
|
||||||
auto & RideableMinecart = reinterpret_cast<const cRideableMinecart &>(Minecart);
|
auto & RideableMinecart = static_cast<const cRideableMinecart &>(Minecart);
|
||||||
const cItem & MinecartContent = RideableMinecart.GetContent();
|
const cItem & MinecartContent = RideableMinecart.GetContent();
|
||||||
if (!MinecartContent.IsEmpty())
|
if (!MinecartContent.IsEmpty())
|
||||||
{
|
{
|
||||||
@ -709,28 +709,28 @@ void cProtocol_1_11_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity &
|
|||||||
{
|
{
|
||||||
a_Pkt.WriteBEUInt8(MINECART_FURNACE_POWERED);
|
a_Pkt.WriteBEUInt8(MINECART_FURNACE_POWERED);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
a_Pkt.WriteBool(reinterpret_cast<const cMinecartWithFurnace &>(Minecart).IsFueled());
|
a_Pkt.WriteBool(static_cast<const cMinecartWithFurnace &>(Minecart).IsFueled());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} // case etMinecart
|
} // case etMinecart
|
||||||
|
|
||||||
case cEntity::etProjectile:
|
case cEntity::etProjectile:
|
||||||
{
|
{
|
||||||
auto & Projectile = reinterpret_cast<const cProjectileEntity &>(a_Entity);
|
auto & Projectile = static_cast<const cProjectileEntity &>(a_Entity);
|
||||||
switch (Projectile.GetProjectileKind())
|
switch (Projectile.GetProjectileKind())
|
||||||
{
|
{
|
||||||
case cProjectileEntity::pkArrow:
|
case cProjectileEntity::pkArrow:
|
||||||
{
|
{
|
||||||
a_Pkt.WriteBEUInt8(ARROW_CRITICAL);
|
a_Pkt.WriteBEUInt8(ARROW_CRITICAL);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BYTE);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BYTE);
|
||||||
a_Pkt.WriteBEInt8(reinterpret_cast<const cArrowEntity &>(Projectile).IsCritical() ? 1 : 0);
|
a_Pkt.WriteBEInt8(static_cast<const cArrowEntity &>(Projectile).IsCritical() ? 1 : 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case cProjectileEntity::pkFirework:
|
case cProjectileEntity::pkFirework:
|
||||||
{
|
{
|
||||||
a_Pkt.WriteBEUInt8(FIREWORK_INFO); // Firework item used for this firework
|
a_Pkt.WriteBEUInt8(FIREWORK_INFO); // Firework item used for this firework
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
|
||||||
WriteItem(a_Pkt, reinterpret_cast<const cFireworkEntity &>(Projectile).GetItem());
|
WriteItem(a_Pkt, static_cast<const cFireworkEntity &>(Projectile).GetItem());
|
||||||
|
|
||||||
// FIREWORK_BOOSTED_ENTITY_ID, in 1.11.1 only
|
// FIREWORK_BOOSTED_ENTITY_ID, in 1.11.1 only
|
||||||
break;
|
break;
|
||||||
@ -739,7 +739,7 @@ void cProtocol_1_11_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity &
|
|||||||
{
|
{
|
||||||
a_Pkt.WriteBEUInt8(POTION_THROWN); // Potion item which was thrown
|
a_Pkt.WriteBEUInt8(POTION_THROWN); // Potion item which was thrown
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
|
||||||
WriteItem(a_Pkt, reinterpret_cast<const cSplashPotionEntity &>(Projectile).GetItem());
|
WriteItem(a_Pkt, static_cast<const cSplashPotionEntity &>(Projectile).GetItem());
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
@ -751,13 +751,13 @@ void cProtocol_1_11_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity &
|
|||||||
|
|
||||||
case cEntity::etMonster:
|
case cEntity::etMonster:
|
||||||
{
|
{
|
||||||
WriteMobMetadata(a_Pkt, reinterpret_cast<const cMonster &>(a_Entity));
|
WriteMobMetadata(a_Pkt, static_cast<const cMonster &>(a_Entity));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case cEntity::etBoat:
|
case cEntity::etBoat:
|
||||||
{
|
{
|
||||||
auto & Boat = reinterpret_cast<const cBoat &>(a_Entity);
|
auto & Boat = static_cast<const cBoat &>(a_Entity);
|
||||||
|
|
||||||
a_Pkt.WriteBEInt8(BOAT_LAST_HIT_TIME);
|
a_Pkt.WriteBEInt8(BOAT_LAST_HIT_TIME);
|
||||||
a_Pkt.WriteBEInt8(METADATA_TYPE_VARINT);
|
a_Pkt.WriteBEInt8(METADATA_TYPE_VARINT);
|
||||||
@ -788,7 +788,7 @@ void cProtocol_1_11_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity &
|
|||||||
|
|
||||||
case cEntity::etItemFrame:
|
case cEntity::etItemFrame:
|
||||||
{
|
{
|
||||||
auto & Frame = reinterpret_cast<const cItemFrame &>(a_Entity);
|
auto & Frame = static_cast<const cItemFrame &>(a_Entity);
|
||||||
a_Pkt.WriteBEUInt8(ITEM_FRAME_ITEM);
|
a_Pkt.WriteBEUInt8(ITEM_FRAME_ITEM);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
|
||||||
WriteItem(a_Pkt, Frame.GetItem());
|
WriteItem(a_Pkt, Frame.GetItem());
|
||||||
@ -834,7 +834,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
{
|
{
|
||||||
case mtBat:
|
case mtBat:
|
||||||
{
|
{
|
||||||
auto & Bat = reinterpret_cast<const cBat &>(a_Mob);
|
auto & Bat = static_cast<const cBat &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(BAT_HANGING);
|
a_Pkt.WriteBEUInt8(BAT_HANGING);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BYTE);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BYTE);
|
||||||
a_Pkt.WriteBEInt8(Bat.IsHanging() ? 1 : 0);
|
a_Pkt.WriteBEInt8(Bat.IsHanging() ? 1 : 0);
|
||||||
@ -843,7 +843,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtChicken:
|
case mtChicken:
|
||||||
{
|
{
|
||||||
auto & Chicken = reinterpret_cast<const cChicken &>(a_Mob);
|
auto & Chicken = static_cast<const cChicken &>(a_Mob);
|
||||||
|
|
||||||
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
@ -853,7 +853,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtCow:
|
case mtCow:
|
||||||
{
|
{
|
||||||
auto & Cow = reinterpret_cast<const cCow &>(a_Mob);
|
auto & Cow = static_cast<const cCow &>(a_Mob);
|
||||||
|
|
||||||
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
@ -863,7 +863,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtCreeper:
|
case mtCreeper:
|
||||||
{
|
{
|
||||||
auto & Creeper = reinterpret_cast<const cCreeper &>(a_Mob);
|
auto & Creeper = static_cast<const cCreeper &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(CREEPER_STATE); // (idle or "blowing")
|
a_Pkt.WriteBEUInt8(CREEPER_STATE); // (idle or "blowing")
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
||||||
a_Pkt.WriteVarInt32(Creeper.IsBlowing() ? 1 : static_cast<UInt32>(-1));
|
a_Pkt.WriteVarInt32(Creeper.IsBlowing() ? 1 : static_cast<UInt32>(-1));
|
||||||
@ -880,7 +880,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtEnderman:
|
case mtEnderman:
|
||||||
{
|
{
|
||||||
auto & Enderman = reinterpret_cast<const cEnderman &>(a_Mob);
|
auto & Enderman = static_cast<const cEnderman &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(ENDERMAN_CARRIED_BLOCK);
|
a_Pkt.WriteBEUInt8(ENDERMAN_CARRIED_BLOCK);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BLOCKID);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BLOCKID);
|
||||||
UInt32 Carried = 0;
|
UInt32 Carried = 0;
|
||||||
@ -896,7 +896,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtGhast:
|
case mtGhast:
|
||||||
{
|
{
|
||||||
auto & Ghast = reinterpret_cast<const cGhast &>(a_Mob);
|
auto & Ghast = static_cast<const cGhast &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(GHAST_ATTACKING);
|
a_Pkt.WriteBEUInt8(GHAST_ATTACKING);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
a_Pkt.WriteBool(Ghast.IsCharging());
|
a_Pkt.WriteBool(Ghast.IsCharging());
|
||||||
@ -908,7 +908,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
// XXX This behaves incorrectly with different varients; horses have different entity IDs now
|
// XXX This behaves incorrectly with different varients; horses have different entity IDs now
|
||||||
|
|
||||||
// Abstract horse
|
// Abstract horse
|
||||||
auto & Horse = reinterpret_cast<const cHorse &>(a_Mob);
|
auto & Horse = static_cast<const cHorse &>(a_Mob);
|
||||||
Int8 Flags = 0;
|
Int8 Flags = 0;
|
||||||
if (Horse.IsTame())
|
if (Horse.IsTame())
|
||||||
{
|
{
|
||||||
@ -963,7 +963,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtMagmaCube:
|
case mtMagmaCube:
|
||||||
{
|
{
|
||||||
auto & MagmaCube = reinterpret_cast<const cMagmaCube &>(a_Mob);
|
auto & MagmaCube = static_cast<const cMagmaCube &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(SLIME_SIZE);
|
a_Pkt.WriteBEUInt8(SLIME_SIZE);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
||||||
a_Pkt.WriteVarInt32(static_cast<UInt32>(MagmaCube.GetSize()));
|
a_Pkt.WriteVarInt32(static_cast<UInt32>(MagmaCube.GetSize()));
|
||||||
@ -972,7 +972,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtOcelot:
|
case mtOcelot:
|
||||||
{
|
{
|
||||||
auto & Ocelot = reinterpret_cast<const cOcelot &>(a_Mob);
|
auto & Ocelot = static_cast<const cOcelot &>(a_Mob);
|
||||||
|
|
||||||
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
@ -1000,7 +1000,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtPig:
|
case mtPig:
|
||||||
{
|
{
|
||||||
auto & Pig = reinterpret_cast<const cPig &>(a_Mob);
|
auto & Pig = static_cast<const cPig &>(a_Mob);
|
||||||
|
|
||||||
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
@ -1016,7 +1016,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtRabbit:
|
case mtRabbit:
|
||||||
{
|
{
|
||||||
auto & Rabbit = reinterpret_cast<const cRabbit &>(a_Mob);
|
auto & Rabbit = static_cast<const cRabbit &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
a_Pkt.WriteBool(Rabbit.IsBaby());
|
a_Pkt.WriteBool(Rabbit.IsBaby());
|
||||||
@ -1029,7 +1029,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtSheep:
|
case mtSheep:
|
||||||
{
|
{
|
||||||
auto & Sheep = reinterpret_cast<const cSheep &>(a_Mob);
|
auto & Sheep = static_cast<const cSheep &>(a_Mob);
|
||||||
|
|
||||||
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
@ -1051,7 +1051,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
{
|
{
|
||||||
// XXX Skeletons are separate entities; all skeletons are currently treated as regular ones
|
// XXX Skeletons are separate entities; all skeletons are currently treated as regular ones
|
||||||
|
|
||||||
// auto & Skeleton = reinterpret_cast<const cSkeleton &>(a_Mob);
|
// auto & Skeleton = static_cast<const cSkeleton &>(a_Mob);
|
||||||
// a_Pkt.WriteBEUInt8(SKELETON_TYPE);
|
// a_Pkt.WriteBEUInt8(SKELETON_TYPE);
|
||||||
// a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
// a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
||||||
// a_Pkt.WriteVarInt32(Skeleton.IsWither() ? 1 : 0);
|
// a_Pkt.WriteVarInt32(Skeleton.IsWither() ? 1 : 0);
|
||||||
@ -1060,7 +1060,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtSlime:
|
case mtSlime:
|
||||||
{
|
{
|
||||||
auto & Slime = reinterpret_cast<const cSlime &>(a_Mob);
|
auto & Slime = static_cast<const cSlime &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(SLIME_SIZE);
|
a_Pkt.WriteBEUInt8(SLIME_SIZE);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
||||||
a_Pkt.WriteVarInt32(static_cast<UInt32>(Slime.GetSize()));
|
a_Pkt.WriteVarInt32(static_cast<UInt32>(Slime.GetSize()));
|
||||||
@ -1069,7 +1069,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtVillager:
|
case mtVillager:
|
||||||
{
|
{
|
||||||
auto & Villager = reinterpret_cast<const cVillager &>(a_Mob);
|
auto & Villager = static_cast<const cVillager &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
a_Pkt.WriteBool(Villager.IsBaby());
|
a_Pkt.WriteBool(Villager.IsBaby());
|
||||||
@ -1082,7 +1082,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtWitch:
|
case mtWitch:
|
||||||
{
|
{
|
||||||
auto & Witch = reinterpret_cast<const cWitch &>(a_Mob);
|
auto & Witch = static_cast<const cWitch &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(WITCH_AGGRESIVE);
|
a_Pkt.WriteBEUInt8(WITCH_AGGRESIVE);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
a_Pkt.WriteBool(Witch.IsAngry());
|
a_Pkt.WriteBool(Witch.IsAngry());
|
||||||
@ -1091,7 +1091,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtWither:
|
case mtWither:
|
||||||
{
|
{
|
||||||
auto & Wither = reinterpret_cast<const cWither &>(a_Mob);
|
auto & Wither = static_cast<const cWither &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(WITHER_INVULNERABLE_TIMER);
|
a_Pkt.WriteBEUInt8(WITHER_INVULNERABLE_TIMER);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
||||||
a_Pkt.WriteVarInt32(Wither.GetWitherInvulnerableTicks());
|
a_Pkt.WriteVarInt32(Wither.GetWitherInvulnerableTicks());
|
||||||
@ -1102,7 +1102,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtWolf:
|
case mtWolf:
|
||||||
{
|
{
|
||||||
auto & Wolf = reinterpret_cast<const cWolf &>(a_Mob);
|
auto & Wolf = static_cast<const cWolf &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
a_Pkt.WriteBool(Wolf.IsBaby());
|
a_Pkt.WriteBool(Wolf.IsBaby());
|
||||||
@ -1141,7 +1141,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
case mtZombie:
|
case mtZombie:
|
||||||
{
|
{
|
||||||
// XXX Zombies were also split into new sublcasses; this doesn't handle that.
|
// XXX Zombies were also split into new sublcasses; this doesn't handle that.
|
||||||
auto & Zombie = reinterpret_cast<const cZombie &>(a_Mob);
|
auto & Zombie = static_cast<const cZombie &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(ZOMBIE_IS_BABY);
|
a_Pkt.WriteBEUInt8(ZOMBIE_IS_BABY);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
a_Pkt.WriteBool(Zombie.IsBaby());
|
a_Pkt.WriteBool(Zombie.IsBaby());
|
||||||
@ -1159,7 +1159,7 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
|||||||
|
|
||||||
case mtZombiePigman:
|
case mtZombiePigman:
|
||||||
{
|
{
|
||||||
auto & ZombiePigman = reinterpret_cast<const cZombiePigman &>(a_Mob);
|
auto & ZombiePigman = static_cast<const cZombiePigman &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
a_Pkt.WriteBool(ZombiePigman.IsBaby());
|
a_Pkt.WriteBool(ZombiePigman.IsBaby());
|
||||||
|
@ -449,7 +449,7 @@ void cProtocol_1_12::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_
|
|||||||
{
|
{
|
||||||
case cEntity::etPlayer:
|
case cEntity::etPlayer:
|
||||||
{
|
{
|
||||||
auto & Player = reinterpret_cast<const cPlayer &>(a_Entity);
|
auto & Player = static_cast<const cPlayer &>(a_Entity);
|
||||||
|
|
||||||
// TODO Set player custom name to their name.
|
// TODO Set player custom name to their name.
|
||||||
// Then it's possible to move the custom name of mobs to the entities
|
// Then it's possible to move the custom name of mobs to the entities
|
||||||
@ -475,7 +475,7 @@ void cProtocol_1_12::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_
|
|||||||
{
|
{
|
||||||
a_Pkt.WriteBEUInt8(ITEM_ITEM);
|
a_Pkt.WriteBEUInt8(ITEM_ITEM);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
|
||||||
WriteItem(a_Pkt, reinterpret_cast<const cPickup &>(a_Entity).GetItem());
|
WriteItem(a_Pkt, static_cast<const cPickup &>(a_Entity).GetItem());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case cEntity::etMinecart:
|
case cEntity::etMinecart:
|
||||||
@ -484,7 +484,7 @@ void cProtocol_1_12::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_
|
|||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
||||||
|
|
||||||
// The following expression makes Minecarts shake more with less health or higher damage taken
|
// The following expression makes Minecarts shake more with less health or higher damage taken
|
||||||
auto & Minecart = reinterpret_cast<const cMinecart &>(a_Entity);
|
auto & Minecart = static_cast<const cMinecart &>(a_Entity);
|
||||||
auto maxHealth = a_Entity.GetMaxHealth();
|
auto maxHealth = a_Entity.GetMaxHealth();
|
||||||
auto curHealth = a_Entity.GetHealth();
|
auto curHealth = a_Entity.GetHealth();
|
||||||
a_Pkt.WriteVarInt32(static_cast<UInt32>((maxHealth - curHealth) * Minecart.LastDamage() * 4));
|
a_Pkt.WriteVarInt32(static_cast<UInt32>((maxHealth - curHealth) * Minecart.LastDamage() * 4));
|
||||||
@ -499,7 +499,7 @@ void cProtocol_1_12::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_
|
|||||||
|
|
||||||
if (Minecart.GetPayload() == cMinecart::mpNone)
|
if (Minecart.GetPayload() == cMinecart::mpNone)
|
||||||
{
|
{
|
||||||
auto & RideableMinecart = reinterpret_cast<const cRideableMinecart &>(Minecart);
|
auto & RideableMinecart = static_cast<const cRideableMinecart &>(Minecart);
|
||||||
const cItem & MinecartContent = RideableMinecart.GetContent();
|
const cItem & MinecartContent = RideableMinecart.GetContent();
|
||||||
if (!MinecartContent.IsEmpty())
|
if (!MinecartContent.IsEmpty())
|
||||||
{
|
{
|
||||||
@ -522,28 +522,28 @@ void cProtocol_1_12::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_
|
|||||||
{
|
{
|
||||||
a_Pkt.WriteBEUInt8(MINECART_FURNACE_POWERED);
|
a_Pkt.WriteBEUInt8(MINECART_FURNACE_POWERED);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
a_Pkt.WriteBool(reinterpret_cast<const cMinecartWithFurnace &>(Minecart).IsFueled());
|
a_Pkt.WriteBool(static_cast<const cMinecartWithFurnace &>(Minecart).IsFueled());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} // case etMinecart
|
} // case etMinecart
|
||||||
|
|
||||||
case cEntity::etProjectile:
|
case cEntity::etProjectile:
|
||||||
{
|
{
|
||||||
auto & Projectile = reinterpret_cast<const cProjectileEntity &>(a_Entity);
|
auto & Projectile = static_cast<const cProjectileEntity &>(a_Entity);
|
||||||
switch (Projectile.GetProjectileKind())
|
switch (Projectile.GetProjectileKind())
|
||||||
{
|
{
|
||||||
case cProjectileEntity::pkArrow:
|
case cProjectileEntity::pkArrow:
|
||||||
{
|
{
|
||||||
a_Pkt.WriteBEUInt8(ARROW_CRITICAL);
|
a_Pkt.WriteBEUInt8(ARROW_CRITICAL);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BYTE);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BYTE);
|
||||||
a_Pkt.WriteBEInt8(reinterpret_cast<const cArrowEntity &>(Projectile).IsCritical() ? 1 : 0);
|
a_Pkt.WriteBEInt8(static_cast<const cArrowEntity &>(Projectile).IsCritical() ? 1 : 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case cProjectileEntity::pkFirework:
|
case cProjectileEntity::pkFirework:
|
||||||
{
|
{
|
||||||
a_Pkt.WriteBEUInt8(FIREWORK_INFO); // Firework item used for this firework
|
a_Pkt.WriteBEUInt8(FIREWORK_INFO); // Firework item used for this firework
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
|
||||||
WriteItem(a_Pkt, reinterpret_cast<const cFireworkEntity &>(Projectile).GetItem());
|
WriteItem(a_Pkt, static_cast<const cFireworkEntity &>(Projectile).GetItem());
|
||||||
|
|
||||||
// FIREWORK_BOOSTED_ENTITY_ID, in 1.11.1 only
|
// FIREWORK_BOOSTED_ENTITY_ID, in 1.11.1 only
|
||||||
break;
|
break;
|
||||||
@ -552,7 +552,7 @@ void cProtocol_1_12::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_
|
|||||||
{
|
{
|
||||||
a_Pkt.WriteBEUInt8(POTION_THROWN); // Potion item which was thrown
|
a_Pkt.WriteBEUInt8(POTION_THROWN); // Potion item which was thrown
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
|
||||||
WriteItem(a_Pkt, reinterpret_cast<const cSplashPotionEntity &>(Projectile).GetItem());
|
WriteItem(a_Pkt, static_cast<const cSplashPotionEntity &>(Projectile).GetItem());
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
@ -564,13 +564,13 @@ void cProtocol_1_12::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_
|
|||||||
|
|
||||||
case cEntity::etMonster:
|
case cEntity::etMonster:
|
||||||
{
|
{
|
||||||
WriteMobMetadata(a_Pkt, reinterpret_cast<const cMonster &>(a_Entity));
|
WriteMobMetadata(a_Pkt, static_cast<const cMonster &>(a_Entity));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case cEntity::etBoat:
|
case cEntity::etBoat:
|
||||||
{
|
{
|
||||||
auto & Boat = reinterpret_cast<const cBoat &>(a_Entity);
|
auto & Boat = static_cast<const cBoat &>(a_Entity);
|
||||||
|
|
||||||
a_Pkt.WriteBEInt8(BOAT_LAST_HIT_TIME);
|
a_Pkt.WriteBEInt8(BOAT_LAST_HIT_TIME);
|
||||||
a_Pkt.WriteBEInt8(METADATA_TYPE_VARINT);
|
a_Pkt.WriteBEInt8(METADATA_TYPE_VARINT);
|
||||||
@ -601,7 +601,7 @@ void cProtocol_1_12::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_
|
|||||||
|
|
||||||
case cEntity::etItemFrame:
|
case cEntity::etItemFrame:
|
||||||
{
|
{
|
||||||
auto & Frame = reinterpret_cast<const cItemFrame &>(a_Entity);
|
auto & Frame = static_cast<const cItemFrame &>(a_Entity);
|
||||||
a_Pkt.WriteBEUInt8(ITEM_FRAME_ITEM);
|
a_Pkt.WriteBEUInt8(ITEM_FRAME_ITEM);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
|
||||||
WriteItem(a_Pkt, Frame.GetItem());
|
WriteItem(a_Pkt, Frame.GetItem());
|
||||||
@ -647,7 +647,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
|
|||||||
{
|
{
|
||||||
case mtBat:
|
case mtBat:
|
||||||
{
|
{
|
||||||
auto & Bat = reinterpret_cast<const cBat &>(a_Mob);
|
auto & Bat = static_cast<const cBat &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(BAT_HANGING);
|
a_Pkt.WriteBEUInt8(BAT_HANGING);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BYTE);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BYTE);
|
||||||
a_Pkt.WriteBEInt8(Bat.IsHanging() ? 1 : 0);
|
a_Pkt.WriteBEInt8(Bat.IsHanging() ? 1 : 0);
|
||||||
@ -656,7 +656,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
|
|||||||
|
|
||||||
case mtChicken:
|
case mtChicken:
|
||||||
{
|
{
|
||||||
auto & Chicken = reinterpret_cast<const cChicken &>(a_Mob);
|
auto & Chicken = static_cast<const cChicken &>(a_Mob);
|
||||||
|
|
||||||
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
@ -666,7 +666,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
|
|||||||
|
|
||||||
case mtCow:
|
case mtCow:
|
||||||
{
|
{
|
||||||
auto & Cow = reinterpret_cast<const cCow &>(a_Mob);
|
auto & Cow = static_cast<const cCow &>(a_Mob);
|
||||||
|
|
||||||
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
@ -676,7 +676,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
|
|||||||
|
|
||||||
case mtCreeper:
|
case mtCreeper:
|
||||||
{
|
{
|
||||||
auto & Creeper = reinterpret_cast<const cCreeper &>(a_Mob);
|
auto & Creeper = static_cast<const cCreeper &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(CREEPER_STATE); // (idle or "blowing")
|
a_Pkt.WriteBEUInt8(CREEPER_STATE); // (idle or "blowing")
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
||||||
a_Pkt.WriteVarInt32(Creeper.IsBlowing() ? 1 : static_cast<UInt32>(-1));
|
a_Pkt.WriteVarInt32(Creeper.IsBlowing() ? 1 : static_cast<UInt32>(-1));
|
||||||
@ -693,7 +693,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
|
|||||||
|
|
||||||
case mtEnderman:
|
case mtEnderman:
|
||||||
{
|
{
|
||||||
auto & Enderman = reinterpret_cast<const cEnderman &>(a_Mob);
|
auto & Enderman = static_cast<const cEnderman &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(ENDERMAN_CARRIED_BLOCK);
|
a_Pkt.WriteBEUInt8(ENDERMAN_CARRIED_BLOCK);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BLOCKID);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BLOCKID);
|
||||||
UInt32 Carried = 0;
|
UInt32 Carried = 0;
|
||||||
@ -709,7 +709,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
|
|||||||
|
|
||||||
case mtGhast:
|
case mtGhast:
|
||||||
{
|
{
|
||||||
auto & Ghast = reinterpret_cast<const cGhast &>(a_Mob);
|
auto & Ghast = static_cast<const cGhast &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(GHAST_ATTACKING);
|
a_Pkt.WriteBEUInt8(GHAST_ATTACKING);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
a_Pkt.WriteBool(Ghast.IsCharging());
|
a_Pkt.WriteBool(Ghast.IsCharging());
|
||||||
@ -721,7 +721,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
|
|||||||
// XXX This behaves incorrectly with different varients; horses have different entity IDs now
|
// XXX This behaves incorrectly with different varients; horses have different entity IDs now
|
||||||
|
|
||||||
// Abstract horse
|
// Abstract horse
|
||||||
auto & Horse = reinterpret_cast<const cHorse &>(a_Mob);
|
auto & Horse = static_cast<const cHorse &>(a_Mob);
|
||||||
Int8 Flags = 0;
|
Int8 Flags = 0;
|
||||||
if (Horse.IsTame())
|
if (Horse.IsTame())
|
||||||
{
|
{
|
||||||
@ -776,7 +776,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
|
|||||||
|
|
||||||
case mtMagmaCube:
|
case mtMagmaCube:
|
||||||
{
|
{
|
||||||
auto & MagmaCube = reinterpret_cast<const cMagmaCube &>(a_Mob);
|
auto & MagmaCube = static_cast<const cMagmaCube &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(SLIME_SIZE);
|
a_Pkt.WriteBEUInt8(SLIME_SIZE);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
||||||
a_Pkt.WriteVarInt32(static_cast<UInt32>(MagmaCube.GetSize()));
|
a_Pkt.WriteVarInt32(static_cast<UInt32>(MagmaCube.GetSize()));
|
||||||
@ -785,7 +785,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
|
|||||||
|
|
||||||
case mtOcelot:
|
case mtOcelot:
|
||||||
{
|
{
|
||||||
auto & Ocelot = reinterpret_cast<const cOcelot &>(a_Mob);
|
auto & Ocelot = static_cast<const cOcelot &>(a_Mob);
|
||||||
|
|
||||||
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
@ -813,7 +813,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
|
|||||||
|
|
||||||
case mtPig:
|
case mtPig:
|
||||||
{
|
{
|
||||||
auto & Pig = reinterpret_cast<const cPig &>(a_Mob);
|
auto & Pig = static_cast<const cPig &>(a_Mob);
|
||||||
|
|
||||||
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
@ -829,7 +829,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
|
|||||||
|
|
||||||
case mtRabbit:
|
case mtRabbit:
|
||||||
{
|
{
|
||||||
auto & Rabbit = reinterpret_cast<const cRabbit &>(a_Mob);
|
auto & Rabbit = static_cast<const cRabbit &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
a_Pkt.WriteBool(Rabbit.IsBaby());
|
a_Pkt.WriteBool(Rabbit.IsBaby());
|
||||||
@ -842,7 +842,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
|
|||||||
|
|
||||||
case mtSheep:
|
case mtSheep:
|
||||||
{
|
{
|
||||||
auto & Sheep = reinterpret_cast<const cSheep &>(a_Mob);
|
auto & Sheep = static_cast<const cSheep &>(a_Mob);
|
||||||
|
|
||||||
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
@ -864,7 +864,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
|
|||||||
{
|
{
|
||||||
// XXX Skeletons are separate entities; all skeletons are currently treated as regular ones
|
// XXX Skeletons are separate entities; all skeletons are currently treated as regular ones
|
||||||
|
|
||||||
// auto & Skeleton = reinterpret_cast<const cSkeleton &>(a_Mob);
|
// auto & Skeleton = static_cast<const cSkeleton &>(a_Mob);
|
||||||
// a_Pkt.WriteBEUInt8(SKELETON_TYPE);
|
// a_Pkt.WriteBEUInt8(SKELETON_TYPE);
|
||||||
// a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
// a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
||||||
// a_Pkt.WriteVarInt32(Skeleton.IsWither() ? 1 : 0);
|
// a_Pkt.WriteVarInt32(Skeleton.IsWither() ? 1 : 0);
|
||||||
@ -873,7 +873,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
|
|||||||
|
|
||||||
case mtSlime:
|
case mtSlime:
|
||||||
{
|
{
|
||||||
auto & Slime = reinterpret_cast<const cSlime &>(a_Mob);
|
auto & Slime = static_cast<const cSlime &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(SLIME_SIZE);
|
a_Pkt.WriteBEUInt8(SLIME_SIZE);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
||||||
a_Pkt.WriteVarInt32(static_cast<UInt32>(Slime.GetSize()));
|
a_Pkt.WriteVarInt32(static_cast<UInt32>(Slime.GetSize()));
|
||||||
@ -882,7 +882,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
|
|||||||
|
|
||||||
case mtVillager:
|
case mtVillager:
|
||||||
{
|
{
|
||||||
auto & Villager = reinterpret_cast<const cVillager &>(a_Mob);
|
auto & Villager = static_cast<const cVillager &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
a_Pkt.WriteBool(Villager.IsBaby());
|
a_Pkt.WriteBool(Villager.IsBaby());
|
||||||
@ -895,7 +895,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
|
|||||||
|
|
||||||
case mtWitch:
|
case mtWitch:
|
||||||
{
|
{
|
||||||
auto & Witch = reinterpret_cast<const cWitch &>(a_Mob);
|
auto & Witch = static_cast<const cWitch &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(WITCH_AGGRESIVE);
|
a_Pkt.WriteBEUInt8(WITCH_AGGRESIVE);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
a_Pkt.WriteBool(Witch.IsAngry());
|
a_Pkt.WriteBool(Witch.IsAngry());
|
||||||
@ -904,7 +904,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
|
|||||||
|
|
||||||
case mtWither:
|
case mtWither:
|
||||||
{
|
{
|
||||||
auto & Wither = reinterpret_cast<const cWither &>(a_Mob);
|
auto & Wither = static_cast<const cWither &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(WITHER_INVULNERABLE_TIMER);
|
a_Pkt.WriteBEUInt8(WITHER_INVULNERABLE_TIMER);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
||||||
a_Pkt.WriteVarInt32(Wither.GetWitherInvulnerableTicks());
|
a_Pkt.WriteVarInt32(Wither.GetWitherInvulnerableTicks());
|
||||||
@ -915,7 +915,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
|
|||||||
|
|
||||||
case mtWolf:
|
case mtWolf:
|
||||||
{
|
{
|
||||||
auto & Wolf = reinterpret_cast<const cWolf &>(a_Mob);
|
auto & Wolf = static_cast<const cWolf &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
a_Pkt.WriteBool(Wolf.IsBaby());
|
a_Pkt.WriteBool(Wolf.IsBaby());
|
||||||
@ -954,7 +954,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
|
|||||||
case mtZombie:
|
case mtZombie:
|
||||||
{
|
{
|
||||||
// XXX Zombies were also split into new sublcasses; this doesn't handle that.
|
// XXX Zombies were also split into new sublcasses; this doesn't handle that.
|
||||||
auto & Zombie = reinterpret_cast<const cZombie &>(a_Mob);
|
auto & Zombie = static_cast<const cZombie &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(ZOMBIE_IS_BABY);
|
a_Pkt.WriteBEUInt8(ZOMBIE_IS_BABY);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
a_Pkt.WriteBool(Zombie.IsBaby());
|
a_Pkt.WriteBool(Zombie.IsBaby());
|
||||||
@ -972,7 +972,7 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
|
|||||||
|
|
||||||
case mtZombiePigman:
|
case mtZombiePigman:
|
||||||
{
|
{
|
||||||
auto & ZombiePigman = reinterpret_cast<const cZombiePigman &>(a_Mob);
|
auto & ZombiePigman = static_cast<const cZombiePigman &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
a_Pkt.WriteBEUInt8(AGEABLE_BABY);
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
a_Pkt.WriteBool(ZombiePigman.IsBaby());
|
a_Pkt.WriteBool(ZombiePigman.IsBaby());
|
||||||
|
@ -2842,7 +2842,7 @@ void cProtocol_1_8_0::SendData(const char * a_Data, size_t a_Size)
|
|||||||
while (a_Size > 0)
|
while (a_Size > 0)
|
||||||
{
|
{
|
||||||
size_t NumBytes = (a_Size > sizeof(Encrypted)) ? sizeof(Encrypted) : a_Size;
|
size_t NumBytes = (a_Size > sizeof(Encrypted)) ? sizeof(Encrypted) : a_Size;
|
||||||
m_Encryptor.ProcessData(Encrypted, reinterpret_cast<Byte *>(const_cast<char*>(a_Data)), NumBytes);
|
m_Encryptor.ProcessData(Encrypted, reinterpret_cast<const Byte *>(a_Data), NumBytes);
|
||||||
m_Client->SendData(reinterpret_cast<const char *>(Encrypted), NumBytes);
|
m_Client->SendData(reinterpret_cast<const char *>(Encrypted), NumBytes);
|
||||||
a_Size -= NumBytes;
|
a_Size -= NumBytes;
|
||||||
a_Data += NumBytes;
|
a_Data += NumBytes;
|
||||||
@ -3161,7 +3161,7 @@ void cProtocol_1_8_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity &
|
|||||||
{
|
{
|
||||||
case E_BLOCK_BEACON:
|
case E_BLOCK_BEACON:
|
||||||
{
|
{
|
||||||
auto & BeaconEntity = reinterpret_cast<const cBeaconEntity &>(a_BlockEntity);
|
auto & BeaconEntity = static_cast<const cBeaconEntity &>(a_BlockEntity);
|
||||||
Writer.AddInt("x", BeaconEntity.GetPosX());
|
Writer.AddInt("x", BeaconEntity.GetPosX());
|
||||||
Writer.AddInt("y", BeaconEntity.GetPosY());
|
Writer.AddInt("y", BeaconEntity.GetPosY());
|
||||||
Writer.AddInt("z", BeaconEntity.GetPosZ());
|
Writer.AddInt("z", BeaconEntity.GetPosZ());
|
||||||
@ -3174,7 +3174,7 @@ void cProtocol_1_8_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity &
|
|||||||
|
|
||||||
case E_BLOCK_COMMAND_BLOCK:
|
case E_BLOCK_COMMAND_BLOCK:
|
||||||
{
|
{
|
||||||
auto & CommandBlockEntity = reinterpret_cast<const cCommandBlockEntity &>(a_BlockEntity);
|
auto & CommandBlockEntity = static_cast<const cCommandBlockEntity &>(a_BlockEntity);
|
||||||
Writer.AddByte("TrackOutput", 1); // Neither I nor the MC wiki has any idea about this
|
Writer.AddByte("TrackOutput", 1); // Neither I nor the MC wiki has any idea about this
|
||||||
Writer.AddInt("SuccessCount", CommandBlockEntity.GetResult());
|
Writer.AddInt("SuccessCount", CommandBlockEntity.GetResult());
|
||||||
Writer.AddInt("x", CommandBlockEntity.GetPosX());
|
Writer.AddInt("x", CommandBlockEntity.GetPosX());
|
||||||
@ -3195,7 +3195,7 @@ void cProtocol_1_8_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity &
|
|||||||
|
|
||||||
case E_BLOCK_HEAD:
|
case E_BLOCK_HEAD:
|
||||||
{
|
{
|
||||||
auto & MobHeadEntity = reinterpret_cast<const cMobHeadEntity &>(a_BlockEntity);
|
auto & MobHeadEntity = static_cast<const cMobHeadEntity &>(a_BlockEntity);
|
||||||
Writer.AddInt("x", MobHeadEntity.GetPosX());
|
Writer.AddInt("x", MobHeadEntity.GetPosX());
|
||||||
Writer.AddInt("y", MobHeadEntity.GetPosY());
|
Writer.AddInt("y", MobHeadEntity.GetPosY());
|
||||||
Writer.AddInt("z", MobHeadEntity.GetPosZ());
|
Writer.AddInt("z", MobHeadEntity.GetPosZ());
|
||||||
@ -3221,7 +3221,7 @@ void cProtocol_1_8_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity &
|
|||||||
|
|
||||||
case E_BLOCK_FLOWER_POT:
|
case E_BLOCK_FLOWER_POT:
|
||||||
{
|
{
|
||||||
auto & FlowerPotEntity = reinterpret_cast<const cFlowerPotEntity &>(a_BlockEntity);
|
auto & FlowerPotEntity = static_cast<const cFlowerPotEntity &>(a_BlockEntity);
|
||||||
Writer.AddInt("x", FlowerPotEntity.GetPosX());
|
Writer.AddInt("x", FlowerPotEntity.GetPosX());
|
||||||
Writer.AddInt("y", FlowerPotEntity.GetPosY());
|
Writer.AddInt("y", FlowerPotEntity.GetPosY());
|
||||||
Writer.AddInt("z", FlowerPotEntity.GetPosZ());
|
Writer.AddInt("z", FlowerPotEntity.GetPosZ());
|
||||||
@ -3233,7 +3233,7 @@ void cProtocol_1_8_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity &
|
|||||||
|
|
||||||
case E_BLOCK_MOB_SPAWNER:
|
case E_BLOCK_MOB_SPAWNER:
|
||||||
{
|
{
|
||||||
auto & MobSpawnerEntity = reinterpret_cast<const cMobSpawnerEntity &>(a_BlockEntity);
|
auto & MobSpawnerEntity = static_cast<const cMobSpawnerEntity &>(a_BlockEntity);
|
||||||
Writer.AddInt("x", MobSpawnerEntity.GetPosX());
|
Writer.AddInt("x", MobSpawnerEntity.GetPosX());
|
||||||
Writer.AddInt("y", MobSpawnerEntity.GetPosY());
|
Writer.AddInt("y", MobSpawnerEntity.GetPosY());
|
||||||
Writer.AddInt("z", MobSpawnerEntity.GetPosZ());
|
Writer.AddInt("z", MobSpawnerEntity.GetPosZ());
|
||||||
@ -3288,7 +3288,7 @@ void cProtocol_1_8_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a
|
|||||||
{
|
{
|
||||||
case cEntity::etPlayer:
|
case cEntity::etPlayer:
|
||||||
{
|
{
|
||||||
auto & Player = reinterpret_cast<const cPlayer &>(a_Entity);
|
auto & Player = static_cast<const cPlayer &>(a_Entity);
|
||||||
|
|
||||||
// Player health (not handled since players aren't monsters)
|
// Player health (not handled since players aren't monsters)
|
||||||
a_Pkt.WriteBEUInt8(0x66);
|
a_Pkt.WriteBEUInt8(0x66);
|
||||||
@ -3303,7 +3303,7 @@ void cProtocol_1_8_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a
|
|||||||
case cEntity::etPickup:
|
case cEntity::etPickup:
|
||||||
{
|
{
|
||||||
a_Pkt.WriteBEUInt8((5 << 5) | 10); // Slot(5) + index 10
|
a_Pkt.WriteBEUInt8((5 << 5) | 10); // Slot(5) + index 10
|
||||||
WriteItem(a_Pkt, reinterpret_cast<const cPickup &>(a_Entity).GetItem());
|
WriteItem(a_Pkt, static_cast<const cPickup &>(a_Entity).GetItem());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case cEntity::etMinecart:
|
case cEntity::etMinecart:
|
||||||
@ -3317,7 +3317,7 @@ void cProtocol_1_8_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a
|
|||||||
Health: 3 | 3 - (3 - 3) = 3
|
Health: 3 | 3 - (3 - 3) = 3
|
||||||
Health: 1 | 3 - (1 - 3) = 5
|
Health: 1 | 3 - (1 - 3) = 5
|
||||||
*/
|
*/
|
||||||
auto & Minecart = reinterpret_cast<const cMinecart &>(a_Entity);
|
auto & Minecart = static_cast<const cMinecart &>(a_Entity);
|
||||||
a_Pkt.WriteBEInt32(static_cast<Int32>((((a_Entity.GetMaxHealth() / 2) - (a_Entity.GetHealth() - (a_Entity.GetMaxHealth() / 2))) * Minecart.LastDamage()) * 4));
|
a_Pkt.WriteBEInt32(static_cast<Int32>((((a_Entity.GetMaxHealth() / 2) - (a_Entity.GetHealth() - (a_Entity.GetMaxHealth() / 2))) * Minecart.LastDamage()) * 4));
|
||||||
a_Pkt.WriteBEUInt8(0x52);
|
a_Pkt.WriteBEUInt8(0x52);
|
||||||
a_Pkt.WriteBEInt32(1); // Shaking direction, doesn't seem to affect anything
|
a_Pkt.WriteBEInt32(1); // Shaking direction, doesn't seem to affect anything
|
||||||
@ -3326,7 +3326,7 @@ void cProtocol_1_8_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a
|
|||||||
|
|
||||||
if (Minecart.GetPayload() == cMinecart::mpNone)
|
if (Minecart.GetPayload() == cMinecart::mpNone)
|
||||||
{
|
{
|
||||||
auto & RideableMinecart = reinterpret_cast<const cRideableMinecart &>(Minecart);
|
auto & RideableMinecart = static_cast<const cRideableMinecart &>(Minecart);
|
||||||
const cItem & MinecartContent = RideableMinecart.GetContent();
|
const cItem & MinecartContent = RideableMinecart.GetContent();
|
||||||
if (!MinecartContent.IsEmpty())
|
if (!MinecartContent.IsEmpty())
|
||||||
{
|
{
|
||||||
@ -3343,26 +3343,26 @@ void cProtocol_1_8_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a
|
|||||||
else if (Minecart.GetPayload() == cMinecart::mpFurnace)
|
else if (Minecart.GetPayload() == cMinecart::mpFurnace)
|
||||||
{
|
{
|
||||||
a_Pkt.WriteBEUInt8(0x10);
|
a_Pkt.WriteBEUInt8(0x10);
|
||||||
a_Pkt.WriteBEUInt8(reinterpret_cast<const cMinecartWithFurnace &>(Minecart).IsFueled() ? 1 : 0);
|
a_Pkt.WriteBEUInt8(static_cast<const cMinecartWithFurnace &>(Minecart).IsFueled() ? 1 : 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} // case etMinecart
|
} // case etMinecart
|
||||||
|
|
||||||
case cEntity::etProjectile:
|
case cEntity::etProjectile:
|
||||||
{
|
{
|
||||||
auto & Projectile = reinterpret_cast<const cProjectileEntity &>(a_Entity);
|
auto & Projectile = static_cast<const cProjectileEntity &>(a_Entity);
|
||||||
switch (Projectile.GetProjectileKind())
|
switch (Projectile.GetProjectileKind())
|
||||||
{
|
{
|
||||||
case cProjectileEntity::pkArrow:
|
case cProjectileEntity::pkArrow:
|
||||||
{
|
{
|
||||||
a_Pkt.WriteBEUInt8(0x10);
|
a_Pkt.WriteBEUInt8(0x10);
|
||||||
a_Pkt.WriteBEUInt8(reinterpret_cast<const cArrowEntity &>(Projectile).IsCritical() ? 1 : 0);
|
a_Pkt.WriteBEUInt8(static_cast<const cArrowEntity &>(Projectile).IsCritical() ? 1 : 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case cProjectileEntity::pkFirework:
|
case cProjectileEntity::pkFirework:
|
||||||
{
|
{
|
||||||
a_Pkt.WriteBEUInt8(0xa8);
|
a_Pkt.WriteBEUInt8(0xa8);
|
||||||
WriteItem(a_Pkt, reinterpret_cast<const cFireworkEntity &>(Projectile).GetItem());
|
WriteItem(a_Pkt, static_cast<const cFireworkEntity &>(Projectile).GetItem());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -3375,13 +3375,13 @@ void cProtocol_1_8_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a
|
|||||||
|
|
||||||
case cEntity::etMonster:
|
case cEntity::etMonster:
|
||||||
{
|
{
|
||||||
WriteMobMetadata(a_Pkt, reinterpret_cast<const cMonster &>(a_Entity));
|
WriteMobMetadata(a_Pkt, static_cast<const cMonster &>(a_Entity));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case cEntity::etItemFrame:
|
case cEntity::etItemFrame:
|
||||||
{
|
{
|
||||||
auto & Frame = reinterpret_cast<const cItemFrame &>(a_Entity);
|
auto & Frame = static_cast<const cItemFrame &>(a_Entity);
|
||||||
a_Pkt.WriteBEUInt8(0xa8);
|
a_Pkt.WriteBEUInt8(0xa8);
|
||||||
WriteItem(a_Pkt, Frame.GetItem());
|
WriteItem(a_Pkt, Frame.GetItem());
|
||||||
a_Pkt.WriteBEUInt8(0x09);
|
a_Pkt.WriteBEUInt8(0x09);
|
||||||
@ -3419,7 +3419,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
{
|
{
|
||||||
case mtBat:
|
case mtBat:
|
||||||
{
|
{
|
||||||
auto & Bat = reinterpret_cast<const cBat &>(a_Mob);
|
auto & Bat = static_cast<const cBat &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(0x10);
|
a_Pkt.WriteBEUInt8(0x10);
|
||||||
a_Pkt.WriteBEUInt8(Bat.IsHanging() ? 1 : 0);
|
a_Pkt.WriteBEUInt8(Bat.IsHanging() ? 1 : 0);
|
||||||
break;
|
break;
|
||||||
@ -3427,7 +3427,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtChicken:
|
case mtChicken:
|
||||||
{
|
{
|
||||||
auto & Chicken = reinterpret_cast<const cChicken &>(a_Mob);
|
auto & Chicken = static_cast<const cChicken &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(0x0c);
|
a_Pkt.WriteBEUInt8(0x0c);
|
||||||
a_Pkt.WriteBEInt8(Chicken.IsBaby() ? -1 : (Chicken.IsInLoveCooldown() ? 1 : 0));
|
a_Pkt.WriteBEInt8(Chicken.IsBaby() ? -1 : (Chicken.IsInLoveCooldown() ? 1 : 0));
|
||||||
break;
|
break;
|
||||||
@ -3435,7 +3435,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtCow:
|
case mtCow:
|
||||||
{
|
{
|
||||||
auto & Cow = reinterpret_cast<const cCow &>(a_Mob);
|
auto & Cow = static_cast<const cCow &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(0x0c);
|
a_Pkt.WriteBEUInt8(0x0c);
|
||||||
a_Pkt.WriteBEInt8(Cow.IsBaby() ? -1 : (Cow.IsInLoveCooldown() ? 1 : 0));
|
a_Pkt.WriteBEInt8(Cow.IsBaby() ? -1 : (Cow.IsInLoveCooldown() ? 1 : 0));
|
||||||
break;
|
break;
|
||||||
@ -3443,7 +3443,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtCreeper:
|
case mtCreeper:
|
||||||
{
|
{
|
||||||
auto & Creeper = reinterpret_cast<const cCreeper &>(a_Mob);
|
auto & Creeper = static_cast<const cCreeper &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(0x10);
|
a_Pkt.WriteBEUInt8(0x10);
|
||||||
a_Pkt.WriteBEUInt8(Creeper.IsBlowing() ? 1 : 255);
|
a_Pkt.WriteBEUInt8(Creeper.IsBlowing() ? 1 : 255);
|
||||||
a_Pkt.WriteBEUInt8(0x11);
|
a_Pkt.WriteBEUInt8(0x11);
|
||||||
@ -3453,7 +3453,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtEnderman:
|
case mtEnderman:
|
||||||
{
|
{
|
||||||
auto & Enderman = reinterpret_cast<const cEnderman &>(a_Mob);
|
auto & Enderman = static_cast<const cEnderman &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(0x30);
|
a_Pkt.WriteBEUInt8(0x30);
|
||||||
a_Pkt.WriteBEInt16(static_cast<Byte>(Enderman.GetCarriedBlock()));
|
a_Pkt.WriteBEInt16(static_cast<Byte>(Enderman.GetCarriedBlock()));
|
||||||
a_Pkt.WriteBEUInt8(0x11);
|
a_Pkt.WriteBEUInt8(0x11);
|
||||||
@ -3465,7 +3465,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtGhast:
|
case mtGhast:
|
||||||
{
|
{
|
||||||
auto & Ghast = reinterpret_cast<const cGhast &>(a_Mob);
|
auto & Ghast = static_cast<const cGhast &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(0x10);
|
a_Pkt.WriteBEUInt8(0x10);
|
||||||
a_Pkt.WriteBEUInt8(Ghast.IsCharging());
|
a_Pkt.WriteBEUInt8(Ghast.IsCharging());
|
||||||
break;
|
break;
|
||||||
@ -3473,7 +3473,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtHorse:
|
case mtHorse:
|
||||||
{
|
{
|
||||||
auto & Horse = reinterpret_cast<const cHorse &>(a_Mob);
|
auto & Horse = static_cast<const cHorse &>(a_Mob);
|
||||||
int Flags = 0;
|
int Flags = 0;
|
||||||
if (Horse.IsTame())
|
if (Horse.IsTame())
|
||||||
{
|
{
|
||||||
@ -3517,7 +3517,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtMagmaCube:
|
case mtMagmaCube:
|
||||||
{
|
{
|
||||||
auto & MagmaCube = reinterpret_cast<const cMagmaCube &>(a_Mob);
|
auto & MagmaCube = static_cast<const cMagmaCube &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(0x10);
|
a_Pkt.WriteBEUInt8(0x10);
|
||||||
a_Pkt.WriteBEUInt8(static_cast<UInt8>(MagmaCube.GetSize()));
|
a_Pkt.WriteBEUInt8(static_cast<UInt8>(MagmaCube.GetSize()));
|
||||||
break;
|
break;
|
||||||
@ -3525,7 +3525,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtOcelot:
|
case mtOcelot:
|
||||||
{
|
{
|
||||||
auto & Ocelot = reinterpret_cast<const cOcelot &>(a_Mob);
|
auto & Ocelot = static_cast<const cOcelot &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(0x0c);
|
a_Pkt.WriteBEUInt8(0x0c);
|
||||||
a_Pkt.WriteBEInt8(Ocelot.IsBaby() ? -1 : (Ocelot.IsInLoveCooldown() ? 1 : 0));
|
a_Pkt.WriteBEInt8(Ocelot.IsBaby() ? -1 : (Ocelot.IsInLoveCooldown() ? 1 : 0));
|
||||||
break;
|
break;
|
||||||
@ -3533,7 +3533,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtPig:
|
case mtPig:
|
||||||
{
|
{
|
||||||
auto & Pig = reinterpret_cast<const cPig &>(a_Mob);
|
auto & Pig = static_cast<const cPig &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(0x0c);
|
a_Pkt.WriteBEUInt8(0x0c);
|
||||||
a_Pkt.WriteBEInt8(Pig.IsBaby() ? -1 : (Pig.IsInLoveCooldown() ? 1 : 0));
|
a_Pkt.WriteBEInt8(Pig.IsBaby() ? -1 : (Pig.IsInLoveCooldown() ? 1 : 0));
|
||||||
a_Pkt.WriteBEUInt8(0x10);
|
a_Pkt.WriteBEUInt8(0x10);
|
||||||
@ -3543,7 +3543,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtSheep:
|
case mtSheep:
|
||||||
{
|
{
|
||||||
auto & Sheep = reinterpret_cast<const cSheep &>(a_Mob);
|
auto & Sheep = static_cast<const cSheep &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(0x0c);
|
a_Pkt.WriteBEUInt8(0x0c);
|
||||||
a_Pkt.WriteBEInt8(Sheep.IsBaby() ? -1 : (Sheep.IsInLoveCooldown() ? 1 : 0));
|
a_Pkt.WriteBEInt8(Sheep.IsBaby() ? -1 : (Sheep.IsInLoveCooldown() ? 1 : 0));
|
||||||
|
|
||||||
@ -3560,7 +3560,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtRabbit:
|
case mtRabbit:
|
||||||
{
|
{
|
||||||
auto & Rabbit = reinterpret_cast<const cRabbit &>(a_Mob);
|
auto & Rabbit = static_cast<const cRabbit &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(0x12);
|
a_Pkt.WriteBEUInt8(0x12);
|
||||||
a_Pkt.WriteBEUInt8(static_cast<UInt8>(Rabbit.GetRabbitType()));
|
a_Pkt.WriteBEUInt8(static_cast<UInt8>(Rabbit.GetRabbitType()));
|
||||||
a_Pkt.WriteBEUInt8(0x0c);
|
a_Pkt.WriteBEUInt8(0x0c);
|
||||||
@ -3570,7 +3570,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtSkeleton:
|
case mtSkeleton:
|
||||||
{
|
{
|
||||||
auto & Skeleton = reinterpret_cast<const cSkeleton &>(a_Mob);
|
auto & Skeleton = static_cast<const cSkeleton &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(0x0d);
|
a_Pkt.WriteBEUInt8(0x0d);
|
||||||
a_Pkt.WriteBEUInt8(Skeleton.IsWither() ? 1 : 0);
|
a_Pkt.WriteBEUInt8(Skeleton.IsWither() ? 1 : 0);
|
||||||
break;
|
break;
|
||||||
@ -3578,7 +3578,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtSlime:
|
case mtSlime:
|
||||||
{
|
{
|
||||||
auto & Slime = reinterpret_cast<const cSlime &>(a_Mob);
|
auto & Slime = static_cast<const cSlime &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(0x10);
|
a_Pkt.WriteBEUInt8(0x10);
|
||||||
a_Pkt.WriteBEUInt8(static_cast<UInt8>(Slime.GetSize()));
|
a_Pkt.WriteBEUInt8(static_cast<UInt8>(Slime.GetSize()));
|
||||||
break;
|
break;
|
||||||
@ -3586,7 +3586,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtVillager:
|
case mtVillager:
|
||||||
{
|
{
|
||||||
auto & Villager = reinterpret_cast<const cVillager &>(a_Mob);
|
auto & Villager = static_cast<const cVillager &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(0x50);
|
a_Pkt.WriteBEUInt8(0x50);
|
||||||
a_Pkt.WriteBEInt32(Villager.GetVilType());
|
a_Pkt.WriteBEInt32(Villager.GetVilType());
|
||||||
a_Pkt.WriteBEUInt8(0x0c);
|
a_Pkt.WriteBEUInt8(0x0c);
|
||||||
@ -3596,7 +3596,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtWitch:
|
case mtWitch:
|
||||||
{
|
{
|
||||||
auto & Witch = reinterpret_cast<const cWitch &>(a_Mob);
|
auto & Witch = static_cast<const cWitch &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(0x15);
|
a_Pkt.WriteBEUInt8(0x15);
|
||||||
a_Pkt.WriteBEUInt8(Witch.IsAngry() ? 1 : 0);
|
a_Pkt.WriteBEUInt8(Witch.IsAngry() ? 1 : 0);
|
||||||
break;
|
break;
|
||||||
@ -3604,7 +3604,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtWither:
|
case mtWither:
|
||||||
{
|
{
|
||||||
auto & Wither = reinterpret_cast<const cWither &>(a_Mob);
|
auto & Wither = static_cast<const cWither &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(0x54); // Int at index 20
|
a_Pkt.WriteBEUInt8(0x54); // Int at index 20
|
||||||
a_Pkt.WriteBEInt32(static_cast<Int32>(Wither.GetWitherInvulnerableTicks()));
|
a_Pkt.WriteBEInt32(static_cast<Int32>(Wither.GetWitherInvulnerableTicks()));
|
||||||
a_Pkt.WriteBEUInt8(0x66); // Float at index 6
|
a_Pkt.WriteBEUInt8(0x66); // Float at index 6
|
||||||
@ -3614,7 +3614,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtWolf:
|
case mtWolf:
|
||||||
{
|
{
|
||||||
auto & Wolf = reinterpret_cast<const cWolf &>(a_Mob);
|
auto & Wolf = static_cast<const cWolf &>(a_Mob);
|
||||||
Byte WolfStatus = 0;
|
Byte WolfStatus = 0;
|
||||||
if (Wolf.IsSitting())
|
if (Wolf.IsSitting())
|
||||||
{
|
{
|
||||||
@ -3644,7 +3644,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtZombie:
|
case mtZombie:
|
||||||
{
|
{
|
||||||
auto & Zombie = reinterpret_cast<const cZombie &>(a_Mob);
|
auto & Zombie = static_cast<const cZombie &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(0x0c);
|
a_Pkt.WriteBEUInt8(0x0c);
|
||||||
a_Pkt.WriteBEInt8(Zombie.IsBaby() ? 1 : -1);
|
a_Pkt.WriteBEInt8(Zombie.IsBaby() ? 1 : -1);
|
||||||
a_Pkt.WriteBEUInt8(0x0d);
|
a_Pkt.WriteBEUInt8(0x0d);
|
||||||
@ -3656,7 +3656,7 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtZombiePigman:
|
case mtZombiePigman:
|
||||||
{
|
{
|
||||||
auto & ZombiePigman = reinterpret_cast<const cZombiePigman &>(a_Mob);
|
auto & ZombiePigman = static_cast<const cZombiePigman &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(0x0c);
|
a_Pkt.WriteBEUInt8(0x0c);
|
||||||
a_Pkt.WriteBEInt8(ZombiePigman.IsBaby() ? 1 : -1);
|
a_Pkt.WriteBEInt8(ZombiePigman.IsBaby() ? 1 : -1);
|
||||||
break;
|
break;
|
||||||
|
@ -2405,7 +2405,7 @@ void cProtocol_1_9_0::HandlePacketBoatSteer(cByteBuffer & a_ByteBuffer)
|
|||||||
{
|
{
|
||||||
if (Vehicle->GetEntityType() == cEntity::etBoat)
|
if (Vehicle->GetEntityType() == cEntity::etBoat)
|
||||||
{
|
{
|
||||||
auto * Boat = reinterpret_cast<cBoat *>(Vehicle);
|
auto * Boat = static_cast<cBoat *>(Vehicle);
|
||||||
Boat->UpdatePaddles(RightPaddle, LeftPaddle);
|
Boat->UpdatePaddles(RightPaddle, LeftPaddle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2970,7 +2970,7 @@ void cProtocol_1_9_0::SendData(const char * a_Data, size_t a_Size)
|
|||||||
while (a_Size > 0)
|
while (a_Size > 0)
|
||||||
{
|
{
|
||||||
size_t NumBytes = (a_Size > sizeof(Encrypted)) ? sizeof(Encrypted) : a_Size;
|
size_t NumBytes = (a_Size > sizeof(Encrypted)) ? sizeof(Encrypted) : a_Size;
|
||||||
m_Encryptor.ProcessData(Encrypted, reinterpret_cast<Byte *>(const_cast<char*>(a_Data)), NumBytes);
|
m_Encryptor.ProcessData(Encrypted, reinterpret_cast<const Byte *>(a_Data), NumBytes);
|
||||||
m_Client->SendData(reinterpret_cast<const char *>(Encrypted), NumBytes);
|
m_Client->SendData(reinterpret_cast<const char *>(Encrypted), NumBytes);
|
||||||
a_Size -= NumBytes;
|
a_Size -= NumBytes;
|
||||||
a_Data += NumBytes;
|
a_Data += NumBytes;
|
||||||
@ -3527,7 +3527,7 @@ void cProtocol_1_9_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity &
|
|||||||
{
|
{
|
||||||
case E_BLOCK_BEACON:
|
case E_BLOCK_BEACON:
|
||||||
{
|
{
|
||||||
auto & BeaconEntity = reinterpret_cast<const cBeaconEntity &>(a_BlockEntity);
|
auto & BeaconEntity = static_cast<const cBeaconEntity &>(a_BlockEntity);
|
||||||
Writer.AddInt("x", BeaconEntity.GetPosX());
|
Writer.AddInt("x", BeaconEntity.GetPosX());
|
||||||
Writer.AddInt("y", BeaconEntity.GetPosY());
|
Writer.AddInt("y", BeaconEntity.GetPosY());
|
||||||
Writer.AddInt("z", BeaconEntity.GetPosZ());
|
Writer.AddInt("z", BeaconEntity.GetPosZ());
|
||||||
@ -3540,7 +3540,7 @@ void cProtocol_1_9_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity &
|
|||||||
|
|
||||||
case E_BLOCK_COMMAND_BLOCK:
|
case E_BLOCK_COMMAND_BLOCK:
|
||||||
{
|
{
|
||||||
auto & CommandBlockEntity = reinterpret_cast<const cCommandBlockEntity &>(a_BlockEntity);
|
auto & CommandBlockEntity = static_cast<const cCommandBlockEntity &>(a_BlockEntity);
|
||||||
Writer.AddByte("TrackOutput", 1); // Neither I nor the MC wiki has any idea about this
|
Writer.AddByte("TrackOutput", 1); // Neither I nor the MC wiki has any idea about this
|
||||||
Writer.AddInt("SuccessCount", CommandBlockEntity.GetResult());
|
Writer.AddInt("SuccessCount", CommandBlockEntity.GetResult());
|
||||||
Writer.AddInt("x", CommandBlockEntity.GetPosX());
|
Writer.AddInt("x", CommandBlockEntity.GetPosX());
|
||||||
@ -3561,7 +3561,7 @@ void cProtocol_1_9_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity &
|
|||||||
|
|
||||||
case E_BLOCK_HEAD:
|
case E_BLOCK_HEAD:
|
||||||
{
|
{
|
||||||
auto & MobHeadEntity = reinterpret_cast<const cMobHeadEntity &>(a_BlockEntity);
|
auto & MobHeadEntity = static_cast<const cMobHeadEntity &>(a_BlockEntity);
|
||||||
Writer.AddInt("x", MobHeadEntity.GetPosX());
|
Writer.AddInt("x", MobHeadEntity.GetPosX());
|
||||||
Writer.AddInt("y", MobHeadEntity.GetPosY());
|
Writer.AddInt("y", MobHeadEntity.GetPosY());
|
||||||
Writer.AddInt("z", MobHeadEntity.GetPosZ());
|
Writer.AddInt("z", MobHeadEntity.GetPosZ());
|
||||||
@ -3587,7 +3587,7 @@ void cProtocol_1_9_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity &
|
|||||||
|
|
||||||
case E_BLOCK_FLOWER_POT:
|
case E_BLOCK_FLOWER_POT:
|
||||||
{
|
{
|
||||||
auto & FlowerPotEntity = reinterpret_cast<const cFlowerPotEntity &>(a_BlockEntity);
|
auto & FlowerPotEntity = static_cast<const cFlowerPotEntity &>(a_BlockEntity);
|
||||||
Writer.AddInt("x", FlowerPotEntity.GetPosX());
|
Writer.AddInt("x", FlowerPotEntity.GetPosX());
|
||||||
Writer.AddInt("y", FlowerPotEntity.GetPosY());
|
Writer.AddInt("y", FlowerPotEntity.GetPosY());
|
||||||
Writer.AddInt("z", FlowerPotEntity.GetPosZ());
|
Writer.AddInt("z", FlowerPotEntity.GetPosZ());
|
||||||
@ -3599,7 +3599,7 @@ void cProtocol_1_9_0::WriteBlockEntity(cPacketizer & a_Pkt, const cBlockEntity &
|
|||||||
|
|
||||||
case E_BLOCK_MOB_SPAWNER:
|
case E_BLOCK_MOB_SPAWNER:
|
||||||
{
|
{
|
||||||
auto & MobSpawnerEntity = reinterpret_cast<const cMobSpawnerEntity &>(a_BlockEntity);
|
auto & MobSpawnerEntity = static_cast<const cMobSpawnerEntity &>(a_BlockEntity);
|
||||||
Writer.AddInt("x", MobSpawnerEntity.GetPosX());
|
Writer.AddInt("x", MobSpawnerEntity.GetPosX());
|
||||||
Writer.AddInt("y", MobSpawnerEntity.GetPosY());
|
Writer.AddInt("y", MobSpawnerEntity.GetPosY());
|
||||||
Writer.AddInt("z", MobSpawnerEntity.GetPosZ());
|
Writer.AddInt("z", MobSpawnerEntity.GetPosZ());
|
||||||
@ -3657,7 +3657,7 @@ void cProtocol_1_9_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a
|
|||||||
{
|
{
|
||||||
case cEntity::etPlayer:
|
case cEntity::etPlayer:
|
||||||
{
|
{
|
||||||
auto & Player = reinterpret_cast<const cPlayer &>(a_Entity);
|
auto & Player = static_cast<const cPlayer &>(a_Entity);
|
||||||
|
|
||||||
// TODO Set player custom name to their name.
|
// TODO Set player custom name to their name.
|
||||||
// Then it's possible to move the custom name of mobs to the entities
|
// Then it's possible to move the custom name of mobs to the entities
|
||||||
@ -3683,7 +3683,7 @@ void cProtocol_1_9_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a
|
|||||||
{
|
{
|
||||||
a_Pkt.WriteBEUInt8(5); // Index 5: Item
|
a_Pkt.WriteBEUInt8(5); // Index 5: Item
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
|
||||||
WriteItem(a_Pkt, reinterpret_cast<const cPickup &>(a_Entity).GetItem());
|
WriteItem(a_Pkt, static_cast<const cPickup &>(a_Entity).GetItem());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case cEntity::etMinecart:
|
case cEntity::etMinecart:
|
||||||
@ -3692,7 +3692,7 @@ void cProtocol_1_9_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a
|
|||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
||||||
|
|
||||||
// The following expression makes Minecarts shake more with less health or higher damage taken
|
// The following expression makes Minecarts shake more with less health or higher damage taken
|
||||||
auto & Minecart = reinterpret_cast<const cMinecart &>(a_Entity);
|
auto & Minecart = static_cast<const cMinecart &>(a_Entity);
|
||||||
auto maxHealth = a_Entity.GetMaxHealth();
|
auto maxHealth = a_Entity.GetMaxHealth();
|
||||||
auto curHealth = a_Entity.GetHealth();
|
auto curHealth = a_Entity.GetHealth();
|
||||||
a_Pkt.WriteVarInt32(static_cast<UInt32>((maxHealth - curHealth) * Minecart.LastDamage() * 4));
|
a_Pkt.WriteVarInt32(static_cast<UInt32>((maxHealth - curHealth) * Minecart.LastDamage() * 4));
|
||||||
@ -3707,7 +3707,7 @@ void cProtocol_1_9_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a
|
|||||||
|
|
||||||
if (Minecart.GetPayload() == cMinecart::mpNone)
|
if (Minecart.GetPayload() == cMinecart::mpNone)
|
||||||
{
|
{
|
||||||
auto & RideableMinecart = reinterpret_cast<const cRideableMinecart &>(Minecart);
|
auto & RideableMinecart = static_cast<const cRideableMinecart &>(Minecart);
|
||||||
const cItem & MinecartContent = RideableMinecart.GetContent();
|
const cItem & MinecartContent = RideableMinecart.GetContent();
|
||||||
if (!MinecartContent.IsEmpty())
|
if (!MinecartContent.IsEmpty())
|
||||||
{
|
{
|
||||||
@ -3730,35 +3730,35 @@ void cProtocol_1_9_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a
|
|||||||
{
|
{
|
||||||
a_Pkt.WriteBEUInt8(11); // Index 11: Is powered
|
a_Pkt.WriteBEUInt8(11); // Index 11: Is powered
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
a_Pkt.WriteBool(reinterpret_cast<const cMinecartWithFurnace &>(Minecart).IsFueled());
|
a_Pkt.WriteBool(static_cast<const cMinecartWithFurnace &>(Minecart).IsFueled());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} // case etMinecart
|
} // case etMinecart
|
||||||
|
|
||||||
case cEntity::etProjectile:
|
case cEntity::etProjectile:
|
||||||
{
|
{
|
||||||
auto & Projectile = reinterpret_cast<const cProjectileEntity &>(a_Entity);
|
auto & Projectile = static_cast<const cProjectileEntity &>(a_Entity);
|
||||||
switch (Projectile.GetProjectileKind())
|
switch (Projectile.GetProjectileKind())
|
||||||
{
|
{
|
||||||
case cProjectileEntity::pkArrow:
|
case cProjectileEntity::pkArrow:
|
||||||
{
|
{
|
||||||
a_Pkt.WriteBEUInt8(5); // Index 5: Is critical
|
a_Pkt.WriteBEUInt8(5); // Index 5: Is critical
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BYTE);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BYTE);
|
||||||
a_Pkt.WriteBEInt8(reinterpret_cast<const cArrowEntity &>(Projectile).IsCritical() ? 1 : 0);
|
a_Pkt.WriteBEInt8(static_cast<const cArrowEntity &>(Projectile).IsCritical() ? 1 : 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case cProjectileEntity::pkFirework:
|
case cProjectileEntity::pkFirework:
|
||||||
{
|
{
|
||||||
a_Pkt.WriteBEUInt8(5); // Index 5: Firework item used for this firework
|
a_Pkt.WriteBEUInt8(5); // Index 5: Firework item used for this firework
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
|
||||||
WriteItem(a_Pkt, reinterpret_cast<const cFireworkEntity &>(Projectile).GetItem());
|
WriteItem(a_Pkt, static_cast<const cFireworkEntity &>(Projectile).GetItem());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case cProjectileEntity::pkSplashPotion:
|
case cProjectileEntity::pkSplashPotion:
|
||||||
{
|
{
|
||||||
a_Pkt.WriteBEUInt8(5); // Index 5: Potion item which was thrown
|
a_Pkt.WriteBEUInt8(5); // Index 5: Potion item which was thrown
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
|
||||||
WriteItem(a_Pkt, reinterpret_cast<const cSplashPotionEntity &>(Projectile).GetItem());
|
WriteItem(a_Pkt, static_cast<const cSplashPotionEntity &>(Projectile).GetItem());
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
@ -3770,13 +3770,13 @@ void cProtocol_1_9_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a
|
|||||||
|
|
||||||
case cEntity::etMonster:
|
case cEntity::etMonster:
|
||||||
{
|
{
|
||||||
WriteMobMetadata(a_Pkt, reinterpret_cast<const cMonster &>(a_Entity));
|
WriteMobMetadata(a_Pkt, static_cast<const cMonster &>(a_Entity));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case cEntity::etBoat:
|
case cEntity::etBoat:
|
||||||
{
|
{
|
||||||
auto & Boat = reinterpret_cast<const cBoat &>(a_Entity);
|
auto & Boat = static_cast<const cBoat &>(a_Entity);
|
||||||
|
|
||||||
a_Pkt.WriteBEInt8(5); // Index 6: Time since last hit
|
a_Pkt.WriteBEInt8(5); // Index 6: Time since last hit
|
||||||
a_Pkt.WriteBEInt8(METADATA_TYPE_VARINT);
|
a_Pkt.WriteBEInt8(METADATA_TYPE_VARINT);
|
||||||
@ -3807,7 +3807,7 @@ void cProtocol_1_9_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a
|
|||||||
|
|
||||||
case cEntity::etItemFrame:
|
case cEntity::etItemFrame:
|
||||||
{
|
{
|
||||||
auto & Frame = reinterpret_cast<const cItemFrame &>(a_Entity);
|
auto & Frame = static_cast<const cItemFrame &>(a_Entity);
|
||||||
a_Pkt.WriteBEUInt8(5); // Index 5: Item
|
a_Pkt.WriteBEUInt8(5); // Index 5: Item
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_ITEM);
|
||||||
WriteItem(a_Pkt, Frame.GetItem());
|
WriteItem(a_Pkt, Frame.GetItem());
|
||||||
@ -3851,7 +3851,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
{
|
{
|
||||||
case mtBat:
|
case mtBat:
|
||||||
{
|
{
|
||||||
auto & Bat = reinterpret_cast<const cBat &>(a_Mob);
|
auto & Bat = static_cast<const cBat &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(11); // Index 11: Bat flags - currently only hanging
|
a_Pkt.WriteBEUInt8(11); // Index 11: Bat flags - currently only hanging
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BYTE);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BYTE);
|
||||||
a_Pkt.WriteBEInt8(Bat.IsHanging() ? 1 : 0);
|
a_Pkt.WriteBEInt8(Bat.IsHanging() ? 1 : 0);
|
||||||
@ -3860,7 +3860,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtChicken:
|
case mtChicken:
|
||||||
{
|
{
|
||||||
auto & Chicken = reinterpret_cast<const cChicken &>(a_Mob);
|
auto & Chicken = static_cast<const cChicken &>(a_Mob);
|
||||||
|
|
||||||
a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
|
a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
@ -3870,7 +3870,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtCow:
|
case mtCow:
|
||||||
{
|
{
|
||||||
auto & Cow = reinterpret_cast<const cCow &>(a_Mob);
|
auto & Cow = static_cast<const cCow &>(a_Mob);
|
||||||
|
|
||||||
a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
|
a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
@ -3880,7 +3880,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtCreeper:
|
case mtCreeper:
|
||||||
{
|
{
|
||||||
auto & Creeper = reinterpret_cast<const cCreeper &>(a_Mob);
|
auto & Creeper = static_cast<const cCreeper &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(11); // Index 11: State (idle or "blowing")
|
a_Pkt.WriteBEUInt8(11); // Index 11: State (idle or "blowing")
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
||||||
a_Pkt.WriteVarInt32(Creeper.IsBlowing() ? 1 : 0xffffffff);
|
a_Pkt.WriteVarInt32(Creeper.IsBlowing() ? 1 : 0xffffffff);
|
||||||
@ -3897,7 +3897,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtEnderman:
|
case mtEnderman:
|
||||||
{
|
{
|
||||||
auto & Enderman = reinterpret_cast<const cEnderman &>(a_Mob);
|
auto & Enderman = static_cast<const cEnderman &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(11); // Index 11: Carried block
|
a_Pkt.WriteBEUInt8(11); // Index 11: Carried block
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BLOCKID);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BLOCKID);
|
||||||
UInt32 Carried = 0;
|
UInt32 Carried = 0;
|
||||||
@ -3913,7 +3913,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtGhast:
|
case mtGhast:
|
||||||
{
|
{
|
||||||
auto & Ghast = reinterpret_cast<const cGhast &>(a_Mob);
|
auto & Ghast = static_cast<const cGhast &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(11); // Is attacking
|
a_Pkt.WriteBEUInt8(11); // Is attacking
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
a_Pkt.WriteBool(Ghast.IsCharging());
|
a_Pkt.WriteBool(Ghast.IsCharging());
|
||||||
@ -3922,7 +3922,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtHorse:
|
case mtHorse:
|
||||||
{
|
{
|
||||||
auto & Horse = reinterpret_cast<const cHorse &>(a_Mob);
|
auto & Horse = static_cast<const cHorse &>(a_Mob);
|
||||||
Int8 Flags = 0;
|
Int8 Flags = 0;
|
||||||
if (Horse.IsTame())
|
if (Horse.IsTame())
|
||||||
{
|
{
|
||||||
@ -3975,7 +3975,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtMagmaCube:
|
case mtMagmaCube:
|
||||||
{
|
{
|
||||||
auto & MagmaCube = reinterpret_cast<const cMagmaCube &>(a_Mob);
|
auto & MagmaCube = static_cast<const cMagmaCube &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(11); // Index 11: Size
|
a_Pkt.WriteBEUInt8(11); // Index 11: Size
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
||||||
a_Pkt.WriteVarInt32(static_cast<UInt32>(MagmaCube.GetSize()));
|
a_Pkt.WriteVarInt32(static_cast<UInt32>(MagmaCube.GetSize()));
|
||||||
@ -3984,7 +3984,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtOcelot:
|
case mtOcelot:
|
||||||
{
|
{
|
||||||
auto & Ocelot = reinterpret_cast<const cOcelot &>(a_Mob);
|
auto & Ocelot = static_cast<const cOcelot &>(a_Mob);
|
||||||
|
|
||||||
a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
|
a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
@ -3994,7 +3994,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtPig:
|
case mtPig:
|
||||||
{
|
{
|
||||||
auto & Pig = reinterpret_cast<const cPig &>(a_Mob);
|
auto & Pig = static_cast<const cPig &>(a_Mob);
|
||||||
|
|
||||||
a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
|
a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
@ -4009,7 +4009,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtRabbit:
|
case mtRabbit:
|
||||||
{
|
{
|
||||||
auto & Rabbit = reinterpret_cast<const cRabbit &>(a_Mob);
|
auto & Rabbit = static_cast<const cRabbit &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
|
a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
a_Pkt.WriteBool(Rabbit.IsBaby());
|
a_Pkt.WriteBool(Rabbit.IsBaby());
|
||||||
@ -4022,7 +4022,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtSheep:
|
case mtSheep:
|
||||||
{
|
{
|
||||||
auto & Sheep = reinterpret_cast<const cSheep &>(a_Mob);
|
auto & Sheep = static_cast<const cSheep &>(a_Mob);
|
||||||
|
|
||||||
a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
|
a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
@ -4042,7 +4042,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtSkeleton:
|
case mtSkeleton:
|
||||||
{
|
{
|
||||||
auto & Skeleton = reinterpret_cast<const cSkeleton &>(a_Mob);
|
auto & Skeleton = static_cast<const cSkeleton &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(11); // Index 11: Type
|
a_Pkt.WriteBEUInt8(11); // Index 11: Type
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
||||||
a_Pkt.WriteVarInt32(Skeleton.IsWither() ? 1 : 0);
|
a_Pkt.WriteVarInt32(Skeleton.IsWither() ? 1 : 0);
|
||||||
@ -4051,7 +4051,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtSlime:
|
case mtSlime:
|
||||||
{
|
{
|
||||||
auto & Slime = reinterpret_cast<const cSlime &>(a_Mob);
|
auto & Slime = static_cast<const cSlime &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(11); // Index 11: Size
|
a_Pkt.WriteBEUInt8(11); // Index 11: Size
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
||||||
a_Pkt.WriteVarInt32(static_cast<UInt32>(Slime.GetSize()));
|
a_Pkt.WriteVarInt32(static_cast<UInt32>(Slime.GetSize()));
|
||||||
@ -4060,7 +4060,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtVillager:
|
case mtVillager:
|
||||||
{
|
{
|
||||||
auto & Villager = reinterpret_cast<const cVillager &>(a_Mob);
|
auto & Villager = static_cast<const cVillager &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
|
a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
a_Pkt.WriteBool(Villager.IsBaby());
|
a_Pkt.WriteBool(Villager.IsBaby());
|
||||||
@ -4073,7 +4073,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtWitch:
|
case mtWitch:
|
||||||
{
|
{
|
||||||
auto & Witch = reinterpret_cast<const cWitch &>(a_Mob);
|
auto & Witch = static_cast<const cWitch &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(11); // Index 11: Is angry
|
a_Pkt.WriteBEUInt8(11); // Index 11: Is angry
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
a_Pkt.WriteBool(Witch.IsAngry());
|
a_Pkt.WriteBool(Witch.IsAngry());
|
||||||
@ -4082,7 +4082,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtWither:
|
case mtWither:
|
||||||
{
|
{
|
||||||
auto & Wither = reinterpret_cast<const cWither &>(a_Mob);
|
auto & Wither = static_cast<const cWither &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(14); // Index 14: Invulnerable ticks
|
a_Pkt.WriteBEUInt8(14); // Index 14: Invulnerable ticks
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
||||||
a_Pkt.WriteVarInt32(Wither.GetWitherInvulnerableTicks());
|
a_Pkt.WriteVarInt32(Wither.GetWitherInvulnerableTicks());
|
||||||
@ -4093,7 +4093,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtWolf:
|
case mtWolf:
|
||||||
{
|
{
|
||||||
auto & Wolf = reinterpret_cast<const cWolf &>(a_Mob);
|
auto & Wolf = static_cast<const cWolf &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
|
a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
a_Pkt.WriteBool(Wolf.IsBaby());
|
a_Pkt.WriteBool(Wolf.IsBaby());
|
||||||
@ -4131,7 +4131,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtZombie:
|
case mtZombie:
|
||||||
{
|
{
|
||||||
auto & Zombie = reinterpret_cast<const cZombie &>(a_Mob);
|
auto & Zombie = static_cast<const cZombie &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
|
a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
a_Pkt.WriteBool(Zombie.IsBaby());
|
a_Pkt.WriteBool(Zombie.IsBaby());
|
||||||
@ -4148,7 +4148,7 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
|||||||
|
|
||||||
case mtZombiePigman:
|
case mtZombiePigman:
|
||||||
{
|
{
|
||||||
auto & ZombiePigman = reinterpret_cast<const cZombiePigman &>(a_Mob);
|
auto & ZombiePigman = static_cast<const cZombiePigman &>(a_Mob);
|
||||||
a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
|
a_Pkt.WriteBEUInt8(11); // Index 11: Is baby
|
||||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL);
|
||||||
a_Pkt.WriteBool(ZombiePigman.IsBaby());
|
a_Pkt.WriteBool(ZombiePigman.IsBaby());
|
||||||
|
@ -638,7 +638,7 @@ AString & CreateHexDump(AString & a_Out, const void * a_Data, size_t a_Size, siz
|
|||||||
size_t k = std::min(a_Size - i, a_BytesPerLine);
|
size_t k = std::min(a_Size - i, a_BytesPerLine);
|
||||||
for (size_t j = 0; j < k; j++)
|
for (size_t j = 0; j < k; j++)
|
||||||
{
|
{
|
||||||
Byte c = (reinterpret_cast<const Byte *>(a_Data))[i + j];
|
Byte c = (static_cast<const Byte *>(a_Data))[i + j];
|
||||||
Hex << HEX(c >> 4) << HEX(c & 0xf) << ' ';
|
Hex << HEX(c >> 4) << HEX(c & 0xf) << ' ';
|
||||||
Chars << ((c >= ' ') ? static_cast<char>(c) : '.');
|
Chars << ((c >= ' ') ? static_cast<char>(c) : '.');
|
||||||
} // for j
|
} // for j
|
||||||
|
@ -993,10 +993,10 @@ void cSlotAreaAnvil::OnTakeResult(cPlayer & a_Player)
|
|||||||
m_ParentWindow.SetProperty(0, static_cast<short>(m_MaximumCost), a_Player);
|
m_ParentWindow.SetProperty(0, static_cast<short>(m_MaximumCost), a_Player);
|
||||||
|
|
||||||
m_MaximumCost = 0;
|
m_MaximumCost = 0;
|
||||||
reinterpret_cast<cAnvilWindow &>(m_ParentWindow).SetRepairedItemName("", nullptr);
|
static_cast<cAnvilWindow &>(m_ParentWindow).SetRepairedItemName("", nullptr);
|
||||||
|
|
||||||
int PosX, PosY, PosZ;
|
int PosX, PosY, PosZ;
|
||||||
reinterpret_cast<cAnvilWindow &>(m_ParentWindow).GetBlockPos(PosX, PosY, PosZ);
|
static_cast<cAnvilWindow &>(m_ParentWindow).GetBlockPos(PosX, PosY, PosZ);
|
||||||
|
|
||||||
BLOCKTYPE Block;
|
BLOCKTYPE Block;
|
||||||
NIBBLETYPE BlockMeta;
|
NIBBLETYPE BlockMeta;
|
||||||
@ -1142,7 +1142,7 @@ void cSlotAreaAnvil::UpdateResult(cPlayer & a_Player)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int NameChangeExp = 0;
|
int NameChangeExp = 0;
|
||||||
const AString & RepairedItemName = reinterpret_cast<cAnvilWindow*>(&m_ParentWindow)->GetRepairedItemName();
|
const AString & RepairedItemName = static_cast<cAnvilWindow*>(&m_ParentWindow)->GetRepairedItemName();
|
||||||
if (RepairedItemName.empty())
|
if (RepairedItemName.empty())
|
||||||
{
|
{
|
||||||
// Remove custom name
|
// Remove custom name
|
||||||
|
@ -487,7 +487,7 @@ void cNBTChunkSerializer::AddMinecartEntity(cMinecart * a_Minecart)
|
|||||||
{
|
{
|
||||||
AddBasicEntity(a_Minecart, "MinecartChest");
|
AddBasicEntity(a_Minecart, "MinecartChest");
|
||||||
// Add chest contents into the Items tag:
|
// Add chest contents into the Items tag:
|
||||||
AddMinecartChestContents(reinterpret_cast<cMinecartWithChest *>(a_Minecart));
|
AddMinecartChestContents(static_cast<cMinecartWithChest *>(a_Minecart));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case cMinecart::mpFurnace:
|
case cMinecart::mpFurnace:
|
||||||
@ -607,26 +607,26 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
|
|||||||
{
|
{
|
||||||
case mtBat:
|
case mtBat:
|
||||||
{
|
{
|
||||||
m_Writer.AddByte("BatFlags", reinterpret_cast<const cBat *>(a_Monster)->IsHanging());
|
m_Writer.AddByte("BatFlags", static_cast<const cBat *>(a_Monster)->IsHanging());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case mtCreeper:
|
case mtCreeper:
|
||||||
{
|
{
|
||||||
const cCreeper *Creeper = reinterpret_cast<const cCreeper *>(a_Monster);
|
const cCreeper *Creeper = static_cast<const cCreeper *>(a_Monster);
|
||||||
m_Writer.AddByte("powered", Creeper->IsCharged());
|
m_Writer.AddByte("powered", Creeper->IsCharged());
|
||||||
m_Writer.AddByte("ignited", Creeper->IsBlowing());
|
m_Writer.AddByte("ignited", Creeper->IsBlowing());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case mtEnderman:
|
case mtEnderman:
|
||||||
{
|
{
|
||||||
const cEnderman *Enderman = reinterpret_cast<const cEnderman *>(a_Monster);
|
const cEnderman *Enderman = static_cast<const cEnderman *>(a_Monster);
|
||||||
m_Writer.AddShort("carried", static_cast<Int16>(Enderman->GetCarriedBlock()));
|
m_Writer.AddShort("carried", static_cast<Int16>(Enderman->GetCarriedBlock()));
|
||||||
m_Writer.AddShort("carriedData", static_cast<Int16>(Enderman->GetCarriedMeta()));
|
m_Writer.AddShort("carriedData", static_cast<Int16>(Enderman->GetCarriedMeta()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case mtHorse:
|
case mtHorse:
|
||||||
{
|
{
|
||||||
const cHorse *Horse = reinterpret_cast<const cHorse *>(a_Monster);
|
const cHorse *Horse = static_cast<const cHorse *>(a_Monster);
|
||||||
m_Writer.AddByte("ChestedHorse", Horse->IsChested()? 1 : 0);
|
m_Writer.AddByte("ChestedHorse", Horse->IsChested()? 1 : 0);
|
||||||
m_Writer.AddByte("EatingHaystack", Horse->IsEating()? 1 : 0);
|
m_Writer.AddByte("EatingHaystack", Horse->IsEating()? 1 : 0);
|
||||||
m_Writer.AddByte("Tame", Horse->IsTame()? 1: 0);
|
m_Writer.AddByte("Tame", Horse->IsTame()? 1: 0);
|
||||||
@ -640,12 +640,12 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
|
|||||||
}
|
}
|
||||||
case mtMagmaCube:
|
case mtMagmaCube:
|
||||||
{
|
{
|
||||||
m_Writer.AddInt("Size", reinterpret_cast<const cMagmaCube *>(a_Monster)->GetSize());
|
m_Writer.AddInt("Size", static_cast<const cMagmaCube *>(a_Monster)->GetSize());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case mtOcelot:
|
case mtOcelot:
|
||||||
{
|
{
|
||||||
const auto *Ocelot = reinterpret_cast<const cOcelot *>(a_Monster);
|
const auto *Ocelot = static_cast<const cOcelot *>(a_Monster);
|
||||||
if (!Ocelot->GetOwnerName().empty())
|
if (!Ocelot->GetOwnerName().empty())
|
||||||
{
|
{
|
||||||
m_Writer.AddString("Owner", Ocelot->GetOwnerName());
|
m_Writer.AddString("Owner", Ocelot->GetOwnerName());
|
||||||
@ -661,12 +661,12 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
|
|||||||
}
|
}
|
||||||
case mtPig:
|
case mtPig:
|
||||||
{
|
{
|
||||||
m_Writer.AddInt("Age", reinterpret_cast<const cPig *>(a_Monster)->GetAge());
|
m_Writer.AddInt("Age", static_cast<const cPig *>(a_Monster)->GetAge());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case mtRabbit:
|
case mtRabbit:
|
||||||
{
|
{
|
||||||
const cRabbit * Rabbit = reinterpret_cast<const cRabbit *>(a_Monster);
|
const cRabbit * Rabbit = static_cast<const cRabbit *>(a_Monster);
|
||||||
m_Writer.AddInt("RabbitType", static_cast<Int32>(Rabbit->GetRabbitType()));
|
m_Writer.AddInt("RabbitType", static_cast<Int32>(Rabbit->GetRabbitType()));
|
||||||
m_Writer.AddInt("MoreCarrotTicks", Rabbit->GetMoreCarrotTicks());
|
m_Writer.AddInt("MoreCarrotTicks", Rabbit->GetMoreCarrotTicks());
|
||||||
m_Writer.AddInt("Age", Rabbit->GetAge());
|
m_Writer.AddInt("Age", Rabbit->GetAge());
|
||||||
@ -674,7 +674,7 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
|
|||||||
}
|
}
|
||||||
case mtSheep:
|
case mtSheep:
|
||||||
{
|
{
|
||||||
const cSheep *Sheep = reinterpret_cast<const cSheep *>(a_Monster);
|
const cSheep *Sheep = static_cast<const cSheep *>(a_Monster);
|
||||||
m_Writer.AddByte("Sheared", Sheep->IsSheared()? 1 : 0);
|
m_Writer.AddByte("Sheared", Sheep->IsSheared()? 1 : 0);
|
||||||
m_Writer.AddByte("Color", static_cast<Byte>(Sheep->GetFurColor()));
|
m_Writer.AddByte("Color", static_cast<Byte>(Sheep->GetFurColor()));
|
||||||
m_Writer.AddInt ("Age", Sheep->GetAge());
|
m_Writer.AddInt ("Age", Sheep->GetAge());
|
||||||
@ -682,29 +682,29 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
|
|||||||
}
|
}
|
||||||
case mtSlime:
|
case mtSlime:
|
||||||
{
|
{
|
||||||
m_Writer.AddInt("Size", reinterpret_cast<const cSlime *>(a_Monster)->GetSize());
|
m_Writer.AddInt("Size", static_cast<const cSlime *>(a_Monster)->GetSize());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case mtSkeleton:
|
case mtSkeleton:
|
||||||
{
|
{
|
||||||
m_Writer.AddByte("SkeletonType", (reinterpret_cast<const cSkeleton *>(a_Monster)->IsWither() ? 1 : 0));
|
m_Writer.AddByte("SkeletonType", (static_cast<const cSkeleton *>(a_Monster)->IsWither() ? 1 : 0));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case mtVillager:
|
case mtVillager:
|
||||||
{
|
{
|
||||||
const cVillager *Villager = reinterpret_cast<const cVillager *>(a_Monster);
|
const cVillager *Villager = static_cast<const cVillager *>(a_Monster);
|
||||||
m_Writer.AddInt("Profession", Villager->GetVilType());
|
m_Writer.AddInt("Profession", Villager->GetVilType());
|
||||||
m_Writer.AddInt("Age", Villager->GetAge());
|
m_Writer.AddInt("Age", Villager->GetAge());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case mtWither:
|
case mtWither:
|
||||||
{
|
{
|
||||||
m_Writer.AddInt("Invul", static_cast<Int32>(reinterpret_cast<const cWither *>(a_Monster)->GetWitherInvulnerableTicks()));
|
m_Writer.AddInt("Invul", static_cast<Int32>(static_cast<const cWither *>(a_Monster)->GetWitherInvulnerableTicks()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case mtWolf:
|
case mtWolf:
|
||||||
{
|
{
|
||||||
const cWolf *Wolf = reinterpret_cast<const cWolf *>(a_Monster);
|
const cWolf *Wolf = static_cast<const cWolf *>(a_Monster);
|
||||||
if (!Wolf->GetOwnerName().empty())
|
if (!Wolf->GetOwnerName().empty())
|
||||||
{
|
{
|
||||||
m_Writer.AddString("Owner", Wolf->GetOwnerName());
|
m_Writer.AddString("Owner", Wolf->GetOwnerName());
|
||||||
@ -721,7 +721,7 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
|
|||||||
}
|
}
|
||||||
case mtZombie:
|
case mtZombie:
|
||||||
{
|
{
|
||||||
const cZombie *Zombie = reinterpret_cast<const cZombie *>(a_Monster);
|
const cZombie *Zombie = static_cast<const cZombie *>(a_Monster);
|
||||||
m_Writer.AddByte("IsVillager", Zombie->IsVillagerZombie() ? 1 : 0);
|
m_Writer.AddByte("IsVillager", Zombie->IsVillagerZombie() ? 1 : 0);
|
||||||
m_Writer.AddByte("IsConverting", Zombie->IsConverting() ? 1 : 0);
|
m_Writer.AddByte("IsConverting", Zombie->IsConverting() ? 1 : 0);
|
||||||
m_Writer.AddInt ("Age", Zombie->GetAge());
|
m_Writer.AddInt ("Age", Zombie->GetAge());
|
||||||
@ -729,7 +729,7 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
|
|||||||
}
|
}
|
||||||
case mtZombiePigman:
|
case mtZombiePigman:
|
||||||
{
|
{
|
||||||
m_Writer.AddInt("Age", reinterpret_cast<const cZombiePigman *>(a_Monster)->GetAge());
|
m_Writer.AddInt("Age", static_cast<const cZombiePigman *>(a_Monster)->GetAge());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case mtBlaze:
|
case mtBlaze:
|
||||||
@ -787,7 +787,7 @@ void cNBTChunkSerializer::AddProjectileEntity(cProjectileEntity * a_Projectile)
|
|||||||
{
|
{
|
||||||
case cProjectileEntity::pkArrow:
|
case cProjectileEntity::pkArrow:
|
||||||
{
|
{
|
||||||
cArrowEntity * Arrow = reinterpret_cast<cArrowEntity *>(a_Projectile);
|
cArrowEntity * Arrow = static_cast<cArrowEntity *>(a_Projectile);
|
||||||
|
|
||||||
m_Writer.AddShort("xTile", static_cast<Int16>(Arrow->GetBlockHit().x));
|
m_Writer.AddShort("xTile", static_cast<Int16>(Arrow->GetBlockHit().x));
|
||||||
m_Writer.AddShort("yTile", static_cast<Int16>(Arrow->GetBlockHit().y));
|
m_Writer.AddShort("yTile", static_cast<Int16>(Arrow->GetBlockHit().y));
|
||||||
@ -798,7 +798,7 @@ void cNBTChunkSerializer::AddProjectileEntity(cProjectileEntity * a_Projectile)
|
|||||||
}
|
}
|
||||||
case cProjectileEntity::pkSplashPotion:
|
case cProjectileEntity::pkSplashPotion:
|
||||||
{
|
{
|
||||||
cSplashPotionEntity * Potion = reinterpret_cast<cSplashPotionEntity *>(a_Projectile);
|
cSplashPotionEntity * Potion = static_cast<cSplashPotionEntity *>(a_Projectile);
|
||||||
|
|
||||||
m_Writer.AddInt("EffectType", static_cast<Int16>(Potion->GetEntityEffectType()));
|
m_Writer.AddInt("EffectType", static_cast<Int16>(Potion->GetEntityEffectType()));
|
||||||
m_Writer.AddInt("EffectDuration", static_cast<Int16>(Potion->GetEntityEffect().GetDuration()));
|
m_Writer.AddInt("EffectDuration", static_cast<Int16>(Potion->GetEntityEffect().GetDuration()));
|
||||||
@ -993,18 +993,18 @@ void cNBTChunkSerializer::Entity(cEntity * a_Entity)
|
|||||||
|
|
||||||
switch (a_Entity->GetEntityType())
|
switch (a_Entity->GetEntityType())
|
||||||
{
|
{
|
||||||
case cEntity::etBoat: AddBoatEntity (reinterpret_cast<cBoat *> (a_Entity)); break;
|
case cEntity::etBoat: AddBoatEntity (static_cast<cBoat *> (a_Entity)); break;
|
||||||
case cEntity::etEnderCrystal: AddEnderCrystalEntity(reinterpret_cast<cEnderCrystal *> (a_Entity)); break;
|
case cEntity::etEnderCrystal: AddEnderCrystalEntity(static_cast<cEnderCrystal *> (a_Entity)); break;
|
||||||
case cEntity::etFallingBlock: AddFallingBlockEntity(reinterpret_cast<cFallingBlock *> (a_Entity)); break;
|
case cEntity::etFallingBlock: AddFallingBlockEntity(static_cast<cFallingBlock *> (a_Entity)); break;
|
||||||
case cEntity::etMinecart: AddMinecartEntity (reinterpret_cast<cMinecart *> (a_Entity)); break;
|
case cEntity::etMinecart: AddMinecartEntity (static_cast<cMinecart *> (a_Entity)); break;
|
||||||
case cEntity::etMonster: AddMonsterEntity (reinterpret_cast<cMonster *> (a_Entity)); break;
|
case cEntity::etMonster: AddMonsterEntity (static_cast<cMonster *> (a_Entity)); break;
|
||||||
case cEntity::etPickup: AddPickupEntity (reinterpret_cast<cPickup *> (a_Entity)); break;
|
case cEntity::etPickup: AddPickupEntity (static_cast<cPickup *> (a_Entity)); break;
|
||||||
case cEntity::etProjectile: AddProjectileEntity (reinterpret_cast<cProjectileEntity *>(a_Entity)); break;
|
case cEntity::etProjectile: AddProjectileEntity (static_cast<cProjectileEntity *>(a_Entity)); break;
|
||||||
case cEntity::etTNT: AddTNTEntity (reinterpret_cast<cTNTEntity *> (a_Entity)); break;
|
case cEntity::etTNT: AddTNTEntity (static_cast<cTNTEntity *> (a_Entity)); break;
|
||||||
case cEntity::etExpOrb: AddExpOrbEntity (reinterpret_cast<cExpOrb *> (a_Entity)); break;
|
case cEntity::etExpOrb: AddExpOrbEntity (static_cast<cExpOrb *> (a_Entity)); break;
|
||||||
case cEntity::etItemFrame: AddItemFrameEntity (reinterpret_cast<cItemFrame *> (a_Entity)); break;
|
case cEntity::etItemFrame: AddItemFrameEntity (static_cast<cItemFrame *> (a_Entity)); break;
|
||||||
case cEntity::etLeashKnot: AddLeashKnotEntity (reinterpret_cast<cLeashKnot *> (a_Entity)); break;
|
case cEntity::etLeashKnot: AddLeashKnotEntity (static_cast<cLeashKnot *> (a_Entity)); break;
|
||||||
case cEntity::etPainting: AddPaintingEntity (reinterpret_cast<cPainting *> (a_Entity)); break;
|
case cEntity::etPainting: AddPaintingEntity (static_cast<cPainting *> (a_Entity)); break;
|
||||||
case cEntity::etPlayer: return; // Players aren't saved into the world
|
case cEntity::etPlayer: return; // Players aren't saved into the world
|
||||||
case cEntity::etFloater: return; // Floaters aren't saved either
|
case cEntity::etFloater: return; // Floaters aren't saved either
|
||||||
default:
|
default:
|
||||||
@ -1038,25 +1038,25 @@ void cNBTChunkSerializer::BlockEntity(cBlockEntity * a_Entity)
|
|||||||
// Add tile-entity into NBT:
|
// Add tile-entity into NBT:
|
||||||
switch (a_Entity->GetBlockType())
|
switch (a_Entity->GetBlockType())
|
||||||
{
|
{
|
||||||
case E_BLOCK_BEACON: AddBeaconEntity (reinterpret_cast<cBeaconEntity *> (a_Entity)); break;
|
case E_BLOCK_BEACON: AddBeaconEntity (static_cast<cBeaconEntity *> (a_Entity)); break;
|
||||||
case E_BLOCK_BED: AddBedEntity (reinterpret_cast<cBedEntity *> (a_Entity)); break;
|
case E_BLOCK_BED: AddBedEntity (static_cast<cBedEntity *> (a_Entity)); break;
|
||||||
case E_BLOCK_BREWING_STAND: AddBrewingstandEntity(reinterpret_cast<cBrewingstandEntity *>(a_Entity)); break;
|
case E_BLOCK_BREWING_STAND: AddBrewingstandEntity(static_cast<cBrewingstandEntity *>(a_Entity)); break;
|
||||||
case E_BLOCK_CHEST: AddChestEntity (reinterpret_cast<cChestEntity *> (a_Entity), a_Entity->GetBlockType()); break;
|
case E_BLOCK_CHEST: AddChestEntity (static_cast<cChestEntity *> (a_Entity), a_Entity->GetBlockType()); break;
|
||||||
case E_BLOCK_COMMAND_BLOCK: AddCommandBlockEntity(reinterpret_cast<cCommandBlockEntity *>(a_Entity)); break;
|
case E_BLOCK_COMMAND_BLOCK: AddCommandBlockEntity(static_cast<cCommandBlockEntity *>(a_Entity)); break;
|
||||||
case E_BLOCK_DISPENSER: AddDispenserEntity (reinterpret_cast<cDispenserEntity *> (a_Entity)); break;
|
case E_BLOCK_DISPENSER: AddDispenserEntity (static_cast<cDispenserEntity *> (a_Entity)); break;
|
||||||
case E_BLOCK_DROPPER: AddDropperEntity (reinterpret_cast<cDropperEntity *> (a_Entity)); break;
|
case E_BLOCK_DROPPER: AddDropperEntity (static_cast<cDropperEntity *> (a_Entity)); break;
|
||||||
case E_BLOCK_ENDER_CHEST: /* No data to be saved */ break;
|
case E_BLOCK_ENDER_CHEST: /* No data to be saved */ break;
|
||||||
case E_BLOCK_FLOWER_POT: AddFlowerPotEntity (reinterpret_cast<cFlowerPotEntity *> (a_Entity)); break;
|
case E_BLOCK_FLOWER_POT: AddFlowerPotEntity (static_cast<cFlowerPotEntity *> (a_Entity)); break;
|
||||||
case E_BLOCK_FURNACE: AddFurnaceEntity (reinterpret_cast<cFurnaceEntity *> (a_Entity)); break;
|
case E_BLOCK_FURNACE: AddFurnaceEntity (static_cast<cFurnaceEntity *> (a_Entity)); break;
|
||||||
case E_BLOCK_HEAD: AddMobHeadEntity (reinterpret_cast<cMobHeadEntity *> (a_Entity)); break;
|
case E_BLOCK_HEAD: AddMobHeadEntity (static_cast<cMobHeadEntity *> (a_Entity)); break;
|
||||||
case E_BLOCK_HOPPER: AddHopperEntity (reinterpret_cast<cHopperEntity *> (a_Entity)); break;
|
case E_BLOCK_HOPPER: AddHopperEntity (static_cast<cHopperEntity *> (a_Entity)); break;
|
||||||
case E_BLOCK_JUKEBOX: AddJukeboxEntity (reinterpret_cast<cJukeboxEntity *> (a_Entity)); break;
|
case E_BLOCK_JUKEBOX: AddJukeboxEntity (static_cast<cJukeboxEntity *> (a_Entity)); break;
|
||||||
case E_BLOCK_LIT_FURNACE: AddFurnaceEntity (reinterpret_cast<cFurnaceEntity *> (a_Entity)); break;
|
case E_BLOCK_LIT_FURNACE: AddFurnaceEntity (static_cast<cFurnaceEntity *> (a_Entity)); break;
|
||||||
case E_BLOCK_MOB_SPAWNER: AddMobSpawnerEntity (reinterpret_cast<cMobSpawnerEntity *> (a_Entity)); break;
|
case E_BLOCK_MOB_SPAWNER: AddMobSpawnerEntity (static_cast<cMobSpawnerEntity *> (a_Entity)); break;
|
||||||
case E_BLOCK_NOTE_BLOCK: AddNoteEntity (reinterpret_cast<cNoteEntity *> (a_Entity)); break;
|
case E_BLOCK_NOTE_BLOCK: AddNoteEntity (static_cast<cNoteEntity *> (a_Entity)); break;
|
||||||
case E_BLOCK_SIGN_POST: AddSignEntity (reinterpret_cast<cSignEntity *> (a_Entity)); break;
|
case E_BLOCK_SIGN_POST: AddSignEntity (static_cast<cSignEntity *> (a_Entity)); break;
|
||||||
case E_BLOCK_TRAPPED_CHEST: AddChestEntity (reinterpret_cast<cChestEntity *> (a_Entity), a_Entity->GetBlockType()); break;
|
case E_BLOCK_TRAPPED_CHEST: AddChestEntity (static_cast<cChestEntity *> (a_Entity), a_Entity->GetBlockType()); break;
|
||||||
case E_BLOCK_WALLSIGN: AddSignEntity (reinterpret_cast<cSignEntity *> (a_Entity)); break;
|
case E_BLOCK_WALLSIGN: AddSignEntity (static_cast<cSignEntity *> (a_Entity)); break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
|
@ -208,7 +208,7 @@ bool cBlockingSslClientSocket::Send(const void * a_Data, size_t a_NumBytes)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Keep sending the data until all of it is sent:
|
// Keep sending the data until all of it is sent:
|
||||||
const char * Data = reinterpret_cast<const char *>(a_Data);
|
const char * Data = static_cast<const char *>(a_Data);
|
||||||
size_t NumBytes = a_NumBytes;
|
size_t NumBytes = a_NumBytes;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
@ -109,7 +109,7 @@ int cCryptoKey::ParsePublic(const void * a_Data, size_t a_NumBytes)
|
|||||||
{
|
{
|
||||||
ASSERT(!IsValid()); // Cannot parse a second key
|
ASSERT(!IsValid()); // Cannot parse a second key
|
||||||
|
|
||||||
return mbedtls_pk_parse_public_key(&m_Pk, reinterpret_cast<const unsigned char *>(a_Data), a_NumBytes);
|
return mbedtls_pk_parse_public_key(&m_Pk, static_cast<const unsigned char *>(a_Data), a_NumBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ int cCryptoKey::ParsePrivate(const void * a_Data, size_t a_NumBytes, const AStri
|
|||||||
ASSERT(!IsValid()); // Cannot parse a second key
|
ASSERT(!IsValid()); // Cannot parse a second key
|
||||||
// mbedTLS requires that PEM-encoded data is passed including the terminating NUL byte,
|
// mbedTLS requires that PEM-encoded data is passed including the terminating NUL byte,
|
||||||
// and DER-encoded data is decoded properly even with an extra trailing NUL byte, so we simply add one to everything:
|
// and DER-encoded data is decoded properly even with an extra trailing NUL byte, so we simply add one to everything:
|
||||||
AString keyData(reinterpret_cast<const char *>(a_Data), a_NumBytes);
|
AString keyData(static_cast<const char *>(a_Data), a_NumBytes);
|
||||||
|
|
||||||
if (a_Password.empty())
|
if (a_Password.empty())
|
||||||
{
|
{
|
||||||
|
@ -41,7 +41,7 @@ int cCtrDrbgContext::Initialize(const void * a_Custom, size_t a_CustomSize)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int res = mbedtls_ctr_drbg_seed(&m_CtrDrbg, mbedtls_entropy_func, &(m_EntropyContext->m_Entropy), reinterpret_cast<const unsigned char *>(a_Custom), a_CustomSize);
|
int res = mbedtls_ctr_drbg_seed(&m_CtrDrbg, mbedtls_entropy_func, &(m_EntropyContext->m_Entropy), static_cast<const unsigned char *>(a_Custom), a_CustomSize);
|
||||||
m_IsValid = (res == 0);
|
m_IsValid = (res == 0);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ int cSslContext::WritePlain(const void * a_Data, size_t a_NumBytes)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return mbedtls_ssl_write(&m_Ssl, reinterpret_cast<const unsigned char *>(a_Data), a_NumBytes);
|
return mbedtls_ssl_write(&m_Ssl, static_cast<const unsigned char *>(a_Data), a_NumBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ int cSslContext::ReadPlain(void * a_Data, size_t a_MaxBytes)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return mbedtls_ssl_read(&m_Ssl, reinterpret_cast<unsigned char *>(a_Data), a_MaxBytes);
|
return mbedtls_ssl_read(&m_Ssl, static_cast<unsigned char *>(a_Data), a_MaxBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -103,13 +103,13 @@ protected:
|
|||||||
/** The callback used by mbedTLS when it wants to read encrypted data. */
|
/** The callback used by mbedTLS when it wants to read encrypted data. */
|
||||||
static int ReceiveEncrypted(void * a_This, unsigned char * a_Buffer, size_t a_NumBytes)
|
static int ReceiveEncrypted(void * a_This, unsigned char * a_Buffer, size_t a_NumBytes)
|
||||||
{
|
{
|
||||||
return (reinterpret_cast<cSslContext *>(a_This))->ReceiveEncrypted(a_Buffer, a_NumBytes);
|
return (static_cast<cSslContext *>(a_This))->ReceiveEncrypted(a_Buffer, a_NumBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The callback used by mbedTLS when it wants to write encrypted data. */
|
/** The callback used by mbedTLS when it wants to write encrypted data. */
|
||||||
static int SendEncrypted(void * a_This, const unsigned char * a_Buffer, size_t a_NumBytes)
|
static int SendEncrypted(void * a_This, const unsigned char * a_Buffer, size_t a_NumBytes)
|
||||||
{
|
{
|
||||||
return (reinterpret_cast<cSslContext *>(a_This))->SendEncrypted(a_Buffer, a_NumBytes);
|
return (static_cast<cSslContext *>(a_This))->SendEncrypted(a_Buffer, a_NumBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Called when mbedTLS wants to read encrypted data. */
|
/** Called when mbedTLS wants to read encrypted data. */
|
||||||
|
@ -32,7 +32,7 @@ int cX509Cert::Parse(const void * a_CertContents, size_t a_Size)
|
|||||||
{
|
{
|
||||||
// mbedTLS requires that PEM-encoded data is passed including the terminating NUL byte,
|
// mbedTLS requires that PEM-encoded data is passed including the terminating NUL byte,
|
||||||
// and DER-encoded data is decoded properly even with an extra trailing NUL byte, so we simply add one to everything:
|
// and DER-encoded data is decoded properly even with an extra trailing NUL byte, so we simply add one to everything:
|
||||||
AString certContents(reinterpret_cast<const char *>(a_CertContents), a_Size);
|
AString certContents(static_cast<const char *>(a_CertContents), a_Size);
|
||||||
return mbedtls_x509_crt_parse(&m_Cert, reinterpret_cast<const unsigned char *>(certContents.data()), a_Size + 1);
|
return mbedtls_x509_crt_parse(&m_Cert, reinterpret_cast<const unsigned char *>(certContents.data()), a_Size + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user