Splash potions: Renamed PotionParticleType to PotionColor for clarity
This commit is contained in:
parent
93c6520e1e
commit
f5bcfdc58c
@ -76,12 +76,12 @@ cSplashPotionEntity::cSplashPotionEntity(
|
|||||||
const Vector3d & a_Speed,
|
const Vector3d & a_Speed,
|
||||||
cEntityEffect::eType a_EntityEffectType,
|
cEntityEffect::eType a_EntityEffectType,
|
||||||
cEntityEffect a_EntityEffect,
|
cEntityEffect a_EntityEffect,
|
||||||
int a_PotionParticleType
|
int a_PotionColor
|
||||||
) :
|
) :
|
||||||
super(pkSplashPotion, a_Creator, a_X, a_Y, a_Z, 0.25, 0.25),
|
super(pkSplashPotion, a_Creator, a_X, a_Y, a_Z, 0.25, 0.25),
|
||||||
m_EntityEffectType(a_EntityEffectType),
|
m_EntityEffectType(a_EntityEffectType),
|
||||||
m_EntityEffect(a_EntityEffect),
|
m_EntityEffect(a_EntityEffect),
|
||||||
m_PotionParticleType(a_PotionParticleType)
|
m_PotionColor(a_PotionColor)
|
||||||
{
|
{
|
||||||
SetSpeed(a_Speed);
|
SetSpeed(a_Speed);
|
||||||
}
|
}
|
||||||
@ -116,7 +116,7 @@ void cSplashPotionEntity::Splash(const Vector3d & a_HitPos)
|
|||||||
cSplashPotionCallback Callback(a_HitPos, m_EntityEffectType, m_EntityEffect);
|
cSplashPotionCallback Callback(a_HitPos, m_EntityEffectType, m_EntityEffect);
|
||||||
m_World->ForEachEntity(Callback);
|
m_World->ForEachEntity(Callback);
|
||||||
|
|
||||||
m_World->BroadcastSoundParticleEffect(2002, (int)a_HitPos.x, (int)a_HitPos.y, (int)a_HitPos.z, m_PotionParticleType);
|
m_World->BroadcastSoundParticleEffect(2002, (int)a_HitPos.x, (int)a_HitPos.y, (int)a_HitPos.z, m_PotionColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ void cSplashPotionEntity::Splash(const Vector3d & a_HitPos)
|
|||||||
|
|
||||||
void cSplashPotionEntity::SpawnOn(cClientHandle & a_Client)
|
void cSplashPotionEntity::SpawnOn(cClientHandle & a_Client)
|
||||||
{
|
{
|
||||||
a_Client.SendSpawnObject(*this, 73, m_PotionParticleType, ANGLE_TO_PROTO(GetYaw()), ANGLE_TO_PROTO(GetPitch()));
|
a_Client.SendSpawnObject(*this, 73, m_PotionColor, ANGLE_TO_PROTO(GetYaw()), ANGLE_TO_PROTO(GetPitch()));
|
||||||
a_Client.SendEntityMetadata(*this);
|
a_Client.SendEntityMetadata(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,22 +31,22 @@ public:
|
|||||||
const Vector3d & a_Speed,
|
const Vector3d & a_Speed,
|
||||||
cEntityEffect::eType a_EntityEffectType,
|
cEntityEffect::eType a_EntityEffectType,
|
||||||
cEntityEffect a_EntityEffect,
|
cEntityEffect a_EntityEffect,
|
||||||
int a_PotionParticleType
|
int a_PotionColor
|
||||||
);
|
);
|
||||||
|
|
||||||
cEntityEffect::eType GetEntityEffectType (void) const { return m_EntityEffectType; }
|
cEntityEffect::eType GetEntityEffectType(void) const { return m_EntityEffectType; }
|
||||||
cEntityEffect GetEntityEffect (void) const { return m_EntityEffect; }
|
cEntityEffect GetEntityEffect(void) const { return m_EntityEffect; }
|
||||||
int GetPotionParticleType(void) const { return m_PotionParticleType; }
|
int GetPotionColor(void) const { return m_PotionColor; }
|
||||||
|
|
||||||
void SetEntityEffectType(cEntityEffect::eType a_EntityEffectType) { m_EntityEffectType = a_EntityEffectType; }
|
void SetEntityEffectType(cEntityEffect::eType a_EntityEffectType) { m_EntityEffectType = a_EntityEffectType; }
|
||||||
void SetEntityEffect(cEntityEffect a_EntityEffect) { m_EntityEffect = a_EntityEffect; }
|
void SetEntityEffect(cEntityEffect a_EntityEffect) { m_EntityEffect = a_EntityEffect; }
|
||||||
void SetPotionParticleType(int a_PotionParticleType) { m_PotionParticleType = a_PotionParticleType; }
|
void SetPotionColor(int a_PotionColor) { m_PotionColor = a_PotionColor; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
cEntityEffect::eType m_EntityEffectType;
|
cEntityEffect::eType m_EntityEffectType;
|
||||||
cEntityEffect m_EntityEffect;
|
cEntityEffect m_EntityEffect;
|
||||||
int m_PotionParticleType;
|
int m_PotionColor;
|
||||||
|
|
||||||
|
|
||||||
// cProjectileEntity overrides:
|
// cProjectileEntity overrides:
|
||||||
|
@ -17,8 +17,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Returns the potion particle type (used by the client for visuals), based on the potion's damage value */
|
/** Returns the potion color (used by the client for visuals), based on the potion's damage value */
|
||||||
static int GetPotionParticleType(short a_ItemDamage)
|
static int GetPotionColor(short a_ItemDamage)
|
||||||
{
|
{
|
||||||
// Lowest six bits
|
// Lowest six bits
|
||||||
return (a_ItemDamage & 0x3f);
|
return (a_ItemDamage & 0x3f);
|
||||||
@ -156,7 +156,7 @@ public:
|
|||||||
cSplashPotionEntity * Projectile = new cSplashPotionEntity(
|
cSplashPotionEntity * Projectile = new cSplashPotionEntity(
|
||||||
a_Player, Pos.x, Pos.y, Pos.z, Speed,
|
a_Player, Pos.x, Pos.y, Pos.z, Speed,
|
||||||
GetEntityEffectType(PotionDamage), cEntityEffect(GetEntityEffectDuration(PotionDamage),
|
GetEntityEffectType(PotionDamage), cEntityEffect(GetEntityEffectDuration(PotionDamage),
|
||||||
GetEntityEffectIntensity(PotionDamage)), GetPotionParticleType(PotionDamage)
|
GetEntityEffectIntensity(PotionDamage)), GetPotionColor(PotionDamage)
|
||||||
);
|
);
|
||||||
if (Projectile == NULL)
|
if (Projectile == NULL)
|
||||||
{
|
{
|
||||||
|
@ -613,7 +613,7 @@ void cNBTChunkSerializer::AddProjectileEntity(cProjectileEntity * a_Projectile)
|
|||||||
m_Writer.AddInt("EffectDuration", (Int16)Potion->GetEntityEffect().GetDuration());
|
m_Writer.AddInt("EffectDuration", (Int16)Potion->GetEntityEffect().GetDuration());
|
||||||
m_Writer.AddShort("EffectIntensity", Potion->GetEntityEffect().GetIntensity());
|
m_Writer.AddShort("EffectIntensity", Potion->GetEntityEffect().GetIntensity());
|
||||||
m_Writer.AddDouble("EffectDistanceModifier", Potion->GetEntityEffect().GetDistanceModifier());
|
m_Writer.AddDouble("EffectDistanceModifier", Potion->GetEntityEffect().GetDistanceModifier());
|
||||||
m_Writer.AddInt("PotionName", Potion->GetPotionParticleType());
|
m_Writer.AddInt("PotionName", Potion->GetPotionColor());
|
||||||
}
|
}
|
||||||
case cProjectileEntity::pkGhastFireball:
|
case cProjectileEntity::pkGhastFireball:
|
||||||
{
|
{
|
||||||
|
@ -1681,7 +1681,7 @@ void cWSSAnvil::LoadSplashPotionFromNBT(cEntityList & a_Entities, const cParsedN
|
|||||||
|
|
||||||
SplashPotion->SetEntityEffectType((cEntityEffect::eType) a_NBT.FindChildByName(a_TagIdx, "EffectType"));
|
SplashPotion->SetEntityEffectType((cEntityEffect::eType) a_NBT.FindChildByName(a_TagIdx, "EffectType"));
|
||||||
SplashPotion->SetEntityEffect(cEntityEffect(EffectDuration, EffectIntensity, EffectDistanceModifier));
|
SplashPotion->SetEntityEffect(cEntityEffect(EffectDuration, EffectIntensity, EffectDistanceModifier));
|
||||||
SplashPotion->SetPotionParticleType(a_NBT.FindChildByName(a_TagIdx, "PotionName"));
|
SplashPotion->SetPotionColor(a_NBT.FindChildByName(a_TagIdx, "PotionName"));
|
||||||
|
|
||||||
// Store the new splash potion in the entities list:
|
// Store the new splash potion in the entities list:
|
||||||
a_Entities.push_back(SplashPotion.release());
|
a_Entities.push_back(SplashPotion.release());
|
||||||
|
Loading…
Reference in New Issue
Block a user