1
0

Rewrite explosion knock back (#4251)

1. Base knockback on an entity's bounding box intersection with the explosion 
2. Armor blast protection reduces knockback
3. Don't apply knockback to players flying in creative mode

Fixes #4139
This commit is contained in:
changyong guo
2018-07-23 17:24:00 +08:00
committed by peterbell10
parent 7b0db672d1
commit 01e72ddb65
7 changed files with 129 additions and 20 deletions

View File

@@ -3069,3 +3069,31 @@ float cPlayer::GetPlayerRelativeBlockHardness(BLOCKTYPE a_Block)
// LOGD("blockHardness: %f, digSpeed: %f, canHarvestBlockDivisor: %f\n", blockHardness, digSpeed, canHarvestBlockDivisor);
return (blockHardness < 0) ? 0 : ((digSpeed / blockHardness) / canHarvestBlockDivisor);
}
float cPlayer::GetExplosionExposureRate(Vector3d a_ExplosionPosition, float a_ExlosionPower)
{
if (
IsGameModeSpectator() ||
(IsGameModeCreative() && !IsOnGround())
)
{
return 0; // No impact from explosion
}
return super::GetExplosionExposureRate(a_ExplosionPosition, a_ExlosionPower);
}