Merge branch 'master' of https://github.com/mc-server/MCServer
This commit is contained in:
commit
7a9f9ab744
@ -21,7 +21,7 @@ public:
|
|||||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||||
{
|
{
|
||||||
// Only the first 2 bits contain the display information, the others are for growing
|
// Only the first 2 bits contain the display information, the others are for growing
|
||||||
a_Pickups.push_back(cItem(E_BLOCK_SAPLING, 1, a_BlockMeta & 3));
|
a_Pickups.push_back(cItem(E_BLOCK_SAPLING, 1, a_BlockMeta & 0x7));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1737,7 +1737,9 @@ void cChunkMap::RemoveEntity(cEntity * a_Entity)
|
|||||||
{
|
{
|
||||||
cCSLock Lock(m_CSLayers);
|
cCSLock Lock(m_CSLayers);
|
||||||
cChunkPtr Chunk = GetChunkNoGen(a_Entity->GetChunkX(), ZERO_CHUNK_Y, a_Entity->GetChunkZ());
|
cChunkPtr Chunk = GetChunkNoGen(a_Entity->GetChunkX(), ZERO_CHUNK_Y, a_Entity->GetChunkZ());
|
||||||
if ((Chunk == NULL) || !Chunk->IsValid())
|
|
||||||
|
// Even if a chunk is not valid, it may still contain entities such as players; make sure to remove them (#1190)
|
||||||
|
if (Chunk == NULL)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -334,36 +334,21 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
|
|||||||
|
|
||||||
if ((IsMob() || IsPlayer()) && (a_TDI.Attacker != NULL)) // Knockback for only players and mobs
|
if ((IsMob() || IsPlayer()) && (a_TDI.Attacker != NULL)) // Knockback for only players and mobs
|
||||||
{
|
{
|
||||||
int KnockbackLevel = 0;
|
int KnockbackLevel = a_TDI.Attacker->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchKnockback); // More common enchantment
|
||||||
if (a_TDI.Attacker->GetEquippedWeapon().m_ItemType == E_ITEM_BOW)
|
if (KnockbackLevel < 1)
|
||||||
{
|
{
|
||||||
|
// We support punch on swords and vice versa! :)
|
||||||
KnockbackLevel = a_TDI.Attacker->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchPunch);
|
KnockbackLevel = a_TDI.Attacker->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchPunch);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
KnockbackLevel = a_TDI.Attacker->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchKnockback);
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector3d additionalSpeed(0, 0, 0);
|
Vector3d AdditionalSpeed(0, 0, 0);
|
||||||
switch (KnockbackLevel)
|
switch (KnockbackLevel)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1: AdditionalSpeed.Set(5, 0.3, 5); break;
|
||||||
{
|
case 2: AdditionalSpeed.Set(8, 0.3, 8); break;
|
||||||
additionalSpeed.Set(5, .3, 5);
|
default: break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 2:
|
|
||||||
{
|
|
||||||
additionalSpeed.Set(8, .3, 8);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
additionalSpeed.Set(2, .3, 2);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
AddSpeed(a_TDI.Knockback * additionalSpeed);
|
AddSpeed(a_TDI.Knockback + AdditionalSpeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_World->BroadcastEntityStatus(*this, esGenericHurt);
|
m_World->BroadcastEntityStatus(*this, esGenericHurt);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user