Add throw sound and fix arrow server crash.
This commit is contained in:
parent
d4f90259b8
commit
e7a7c45c36
|
@ -19,7 +19,10 @@ cArrowEntity::cArrowEntity(cEntity * a_Creator, double a_X, double a_Y, double a
|
|||
m_bIsCollected(false),
|
||||
m_HitBlockPos(Vector3i(0, 0, 0))
|
||||
{
|
||||
SetPosY(GetPosY() + a_Creator->GetHeight() - 0.1000000014901161);
|
||||
if (a_Creator != NULL)
|
||||
{
|
||||
SetPosY(GetPosY() + a_Creator->GetHeight() - 0.1000000014901161);
|
||||
}
|
||||
SetSpeed(a_Speed);
|
||||
SetMass(0.1);
|
||||
SetYawFromSpeed();
|
||||
|
|
|
@ -36,10 +36,6 @@ void cThrownSnowballEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d &
|
|||
{
|
||||
TotalDamage = 3;
|
||||
}
|
||||
else if (MobType == cMonster::mtEnderDragon)
|
||||
{
|
||||
TotalDamage = 1;
|
||||
}
|
||||
}
|
||||
// TODO: If entity is Ender Crystal, destroy it
|
||||
a_EntityHit.TakeDamage(dtRangedAttack, this, TotalDamage, 1);
|
||||
|
|
|
@ -31,6 +31,17 @@ public:
|
|||
Vector3d Pos = a_Player->GetThrowStartPos();
|
||||
Vector3d Speed = a_Player->GetLookVector() * m_SpeedCoeff;
|
||||
|
||||
// Play sound
|
||||
cFastRandom Random;
|
||||
a_World->BroadcastSoundEffect(
|
||||
"random.bow",
|
||||
(int)std::floor(a_Player->GetPosX() * 8.0),
|
||||
(int)std::floor((a_Player->GetPosY() - a_Player->GetHeight()) * 8.0),
|
||||
(int)std::floor(a_Player->GetPosZ() * 8.0),
|
||||
0.5F,
|
||||
0.4F / (Random.NextFloat(1.0F) * 0.4F + 0.8F)
|
||||
);
|
||||
|
||||
if (a_World->CreateProjectile(Pos.x, Pos.y, Pos.z, m_ProjectileKind, a_Player, a_Player->GetEquippedItem(), &Speed) < 0)
|
||||
{
|
||||
return false;
|
||||
|
|
|
@ -608,6 +608,7 @@ void cNBTChunkSerializer::AddProjectileEntity(cProjectileEntity * a_Projectile)
|
|||
case cProjectileEntity::pkGhastFireball:
|
||||
{
|
||||
m_Writer.AddInt("ExplosionPower", 1);
|
||||
break;
|
||||
// fall-through:
|
||||
}
|
||||
case cProjectileEntity::pkFireCharge:
|
||||
|
|
Loading…
Reference in New Issue
Block a user