1
0
This commit is contained in:
madmaxoft 2014-07-17 22:23:08 +02:00
commit 7a9f9ab744
3 changed files with 12 additions and 25 deletions

View File

@ -21,7 +21,7 @@ public:
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
// 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));
}

View File

@ -1737,7 +1737,9 @@ void cChunkMap::RemoveEntity(cEntity * a_Entity)
{
cCSLock Lock(m_CSLayers);
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;
}

View File

@ -334,36 +334,21 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
if ((IsMob() || IsPlayer()) && (a_TDI.Attacker != NULL)) // Knockback for only players and mobs
{
int KnockbackLevel = 0;
if (a_TDI.Attacker->GetEquippedWeapon().m_ItemType == E_ITEM_BOW)
int KnockbackLevel = a_TDI.Attacker->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchKnockback); // More common enchantment
if (KnockbackLevel < 1)
{
// We support punch on swords and vice versa! :)
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)
{
case 1:
{
additionalSpeed.Set(5, .3, 5);
break;
}
case 2:
{
additionalSpeed.Set(8, .3, 8);
break;
}
default:
{
additionalSpeed.Set(2, .3, 2);
break;
}
case 1: AdditionalSpeed.Set(5, 0.3, 5); break;
case 2: AdditionalSpeed.Set(8, 0.3, 8); break;
default: break;
}
AddSpeed(a_TDI.Knockback * additionalSpeed);
AddSpeed(a_TDI.Knockback + AdditionalSpeed);
}
m_World->BroadcastEntityStatus(*this, esGenericHurt);