Fix gravitation overflow on very weak gravtiations

This commit is contained in:
DBotThePony 2022-01-20 11:56:21 +07:00
parent 784c57d9eb
commit bb3da639b0
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -202,7 +202,7 @@ class BlockEntityBlackHole(p_155229_: BlockPos, p_155230_: BlockState) : BlockEn
private fun setDeltaMovement(living: Entity, center: Vec3, distance: Double, weaker: Boolean) {
//final double mult = Math.min(2, (30 * this.gravitation_strength) / Math.max(1, Math.pow(distance, 2)));
// Сила притяжения
val mult = Math.pow(1 - distance / (30 * gravitationStrength), 2.0) * gravitationStrength / 8
val mult = Math.pow((1 - distance / (30 * gravitationStrength)).coerceAtLeast(0.0), 2.0) * gravitationStrength / 8
// Притяжение к ядру
val delta = living.position().vectorTo(center).normalize()