Make event horizon smaller
This commit is contained in:
parent
0fff4c003b
commit
e83075b5f1
@ -33,6 +33,7 @@ import ru.dbotthepony.mc.otm.registry.MItems
|
||||
import ru.dbotthepony.mc.otm.registry.MRegistry
|
||||
import ru.dbotthepony.mc.otm.container.set
|
||||
import ru.dbotthepony.mc.otm.core.set
|
||||
import kotlin.math.pow
|
||||
import kotlin.math.roundToInt
|
||||
import kotlin.math.sqrt
|
||||
|
||||
@ -261,31 +262,35 @@ class BlackHoleBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : BlockEn
|
||||
|
||||
val center = Vec3.atCenterOf(blockPos)
|
||||
|
||||
for (living in level.getEntitiesOfClass(LivingEntity::class.java, affectedBoundsAABB)) {
|
||||
val distance = living.position().distanceTo(center)
|
||||
kotlin.run {
|
||||
val gravitationStrength = gravitationStrength.pow(0.5)
|
||||
|
||||
if (living !is Player || !living.abilities.mayfly && living.getItemBySlot(EquipmentSlot.CHEST).item != MItems.PORTABLE_GRAVITATION_STABILIZER) {
|
||||
setDeltaMovement(living, center, distance, living !is Player)
|
||||
for (living in level.getEntitiesOfClass(LivingEntity::class.java, affectedBoundsAABB)) {
|
||||
val distance = living.position().distanceTo(center)
|
||||
|
||||
if (living !is Player || !living.abilities.mayfly && living.getItemBySlot(EquipmentSlot.CHEST).item != MItems.PORTABLE_GRAVITATION_STABILIZER) {
|
||||
setDeltaMovement(living, center, distance, living !is Player)
|
||||
}
|
||||
|
||||
if (distance < gravitationStrength + 1) {
|
||||
living.hurt(MRegistry.DAMAGE_EVENT_HORIZON, (gravitationStrength / distance).toFloat())
|
||||
}
|
||||
}
|
||||
|
||||
if (distance < gravitationStrength + 1) {
|
||||
living.hurt(MRegistry.DAMAGE_EVENT_HORIZON, (gravitationStrength / distance).toFloat())
|
||||
}
|
||||
}
|
||||
for (item in level.getEntitiesOfClass(ItemEntity::class.java, affectedBoundsAABB)) {
|
||||
val distance = item.position().distanceTo(center)
|
||||
setDeltaMovement(item, center, distance, false)
|
||||
|
||||
for (item in level.getEntitiesOfClass(ItemEntity::class.java, affectedBoundsAABB)) {
|
||||
val distance = item.position().distanceTo(center)
|
||||
setDeltaMovement(item, center, distance, false)
|
||||
if (distance < gravitationStrength + 1) {
|
||||
if (item.hurt(MRegistry.DAMAGE_EVENT_HORIZON, (gravitationStrength / distance).toFloat()) && item.isRemoved) {
|
||||
if (item.item.item === MItems.GRAVITATIONAL_DISRUPTOR) {
|
||||
collapse()
|
||||
} else {
|
||||
val mass = getMatterValue(item.item)
|
||||
|
||||
if (distance < gravitationStrength + 1) {
|
||||
if (item.hurt(MRegistry.DAMAGE_EVENT_HORIZON, (gravitationStrength / distance).toFloat()) && item.isRemoved) {
|
||||
if (item.item.item === MItems.GRAVITATIONAL_DISRUPTOR) {
|
||||
collapse()
|
||||
} else {
|
||||
val mass = getMatterValue(item.item)
|
||||
|
||||
if (!mass.isZero)
|
||||
this.mass += mass.value * item.item.count
|
||||
if (!mass.isZero)
|
||||
this.mass += mass.value * item.item.count
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -296,7 +301,7 @@ class BlackHoleBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : BlockEn
|
||||
this.mass += HAWKING_MASS_LOSE_STEP
|
||||
}
|
||||
|
||||
if (gravitationStrength > 0.4f) {
|
||||
if (gravitationStrength > 0.4) {
|
||||
val sphere = getSphericalShape((gravitationStrength * 6.0).roundToInt())
|
||||
|
||||
if (sphere.size != lastSphereSizeOuter) {
|
||||
|
@ -20,6 +20,7 @@ import ru.dbotthepony.mc.otm.client.render.*
|
||||
import ru.dbotthepony.mc.otm.core.*
|
||||
import ru.dbotthepony.mc.otm.registry.MItems
|
||||
import kotlin.math.PI
|
||||
import kotlin.math.pow
|
||||
|
||||
private const val BEAM_WIDTH = 0.2
|
||||
|
||||
@ -103,7 +104,7 @@ class BlackHoleRenderer(private val context: BlockEntityRendererProvider.Context
|
||||
|
||||
poseStack.pushPose()
|
||||
poseStack.translate(0.5, -tile.gravitationStrength / 2 + 0.5, 0.5)
|
||||
colorSphere(poseStack, tile.gravitationStrength.toFloat())
|
||||
colorSphere(poseStack, tile.gravitationStrength.pow(0.5).toFloat())
|
||||
|
||||
RenderSystem.enableCull()
|
||||
RenderSystem.enableTexture()
|
||||
|
Loading…
Reference in New Issue
Block a user