summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Entities/ProjectileEntity.cpp11
-rw-r--r--src/Entities/ProjectileEntity.h2
-rw-r--r--src/Protocol/Protocol17x.cpp2
3 files changed, 10 insertions, 5 deletions
diff --git a/src/Entities/ProjectileEntity.cpp b/src/Entities/ProjectileEntity.cpp
index ddcc0f7fd..50f62b018 100644
--- a/src/Entities/ProjectileEntity.cpp
+++ b/src/Entities/ProjectileEntity.cpp
@@ -216,7 +216,10 @@ protected:
cProjectileEntity::cProjectileEntity(eKind a_Kind, cEntity * a_Creator, double a_X, double a_Y, double a_Z, double a_Width, double a_Height) :
super(etProjectile, a_X, a_Y, a_Z, a_Width, a_Height),
m_ProjectileKind(a_Kind),
- m_CreatorData(a_Creator->GetUniqueID(), a_Creator->IsPlayer() ? ((cPlayer *)a_Creator)->GetName() : ""),
+ m_CreatorData(
+ ((a_Creator != NULL) ? a_Creator->GetUniqueID() : -1),
+ ((a_Creator != NULL) ? (a_Creator->IsPlayer() ? ((cPlayer *)a_Creator)->GetName() : "") : "")
+ ),
m_IsInGround(false)
{
}
@@ -298,7 +301,7 @@ void cProjectileEntity::OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_
cEntity * cProjectileEntity::GetCreator()
{
- if (m_CreatorData.m_Name.empty())
+ if (m_CreatorData.m_Name.empty() && (m_CreatorData.m_UniqueID >= 1))
{
class cProjectileCreatorCallback : public cEntityCallback
{
@@ -328,7 +331,7 @@ cEntity * cProjectileEntity::GetCreator()
GetWorld()->DoWithEntityByID(m_CreatorData.m_UniqueID, PCC);
return PCC.GetEntity();
}
- else
+ else if (!m_CreatorData.m_Name.empty())
{
class cProjectileCreatorCallbackForPlayers : public cPlayerListCallback
{
@@ -358,6 +361,8 @@ cEntity * cProjectileEntity::GetCreator()
GetWorld()->FindAndDoWithPlayer(m_CreatorData.m_Name, PCCFP);
return PCCFP.GetEntity();
}
+
+ return NULL;
}
diff --git a/src/Entities/ProjectileEntity.h b/src/Entities/ProjectileEntity.h
index e2ebe9f27..84eefb9ee 100644
--- a/src/Entities/ProjectileEntity.h
+++ b/src/Entities/ProjectileEntity.h
@@ -94,7 +94,7 @@ protected:
*/
struct CreatorData
{
- CreatorData(int a_UniqueID, AString & a_Name) :
+ CreatorData(int a_UniqueID, const AString & a_Name) :
m_UniqueID(a_UniqueID),
m_Name(a_Name)
{
diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp
index 02c577dc8..109e5a67b 100644
--- a/src/Protocol/Protocol17x.cpp
+++ b/src/Protocol/Protocol17x.cpp
@@ -2334,7 +2334,7 @@ void cProtocol172::ParseItemMetadata(cItem & a_Item, const AString & a_Metadata)
for (int loretag = NBT.GetFirstChild(displaytag); loretag >= 0; loretag = NBT.GetNextSibling(loretag)) // Loop through array of strings
{
- AppendPrintf(Lore, "%s`", NBT.GetString(loretag).c_str()); // Append the lore with a newline, used internally by MCS to display a new line in the client; don't forget to c_str ;)
+ AppendPrintf(Lore, "%s`", NBT.GetString(loretag).c_str()); // Append the lore with a grave accent/backtick, used internally by MCS to display a new line in the client; don't forget to c_str ;)
}
a_Item.m_Lore = Lore;