This commit is contained in:
GearShocky 2025-02-21 16:04:30 +05:00
commit e53676a91f
5 changed files with 43 additions and 5 deletions

View File

@ -42,7 +42,10 @@ class SoundDataProvider(event: GatherDataEvent) : SoundDefinitionsProvider(event
add(
MSoundEvents.BLACK_HOLE,
definition().subtitle("otm.sound.black_hole")
.with(SoundDefinition.Sound.sound(modLocation("singularity/amb_singularity"), SoundDefinition.SoundType.SOUND).stream()))
.with(SoundDefinition.Sound.sound(modLocation("singularity/amb_singularity"), SoundDefinition.SoundType.SOUND)
.attenuationDistance(32)
.stream()
))
add(
MSoundEvents.ANDROID_PROJ_PARRY,

View File

@ -742,7 +742,7 @@ private fun items(provider: MatteryLanguageProvider) {
add(MItems.BATTERY_CREATIVE, "Творческий аккумулятор")
add(MItems.QUANTUM_BATTERY, "Квантовый аккумулятор")
add(MItems.QUANTUM_CAPACITOR, "Квантовый аккумулятор-накопитель")
add(MItems.QUANTUM_CAPACITOR, "Квантовый аккумулятор-конденсатор")
add(MItems.QUANTUM_BATTERY_CREATIVE, "Творческий квантовый аккумулятор")
add(MItems.TRITANIUM_SWORD, "Тритановый меч")

View File

@ -20,12 +20,16 @@ import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.level.levelgen.structure.BoundingBox
import net.minecraft.world.phys.AABB
import net.minecraft.world.phys.Vec3
import net.neoforged.api.distmarker.Dist
import net.neoforged.api.distmarker.OnlyIn
import net.neoforged.neoforge.common.Tags
import ru.dbotthepony.kommons.util.getValue
import ru.dbotthepony.kommons.util.setValue
import ru.dbotthepony.mc.otm.block.BlackHoleBlock
import ru.dbotthepony.mc.otm.block.entity.tech.GravitationStabilizerBlockEntity
import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity
import ru.dbotthepony.mc.otm.client.minecraft
import ru.dbotthepony.mc.otm.client.sound.BlackHoleAmbientSoundInstance
import ru.dbotthepony.mc.otm.config.ServerConfig
import ru.dbotthepony.mc.otm.core.addAll
import ru.dbotthepony.mc.otm.core.collect.map
@ -305,6 +309,13 @@ class BlackHoleBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Mattery
}
}
@OnlyIn(Dist.CLIENT)
private val ambientSound = BlackHoleAmbientSoundInstance(this)
init {
minecraft.soundManager.play(ambientSound)
}
companion object {
const val ITERATIONS = 30_000
val HAWKING_MASS_LOSE_STEP = Decimal(-100)

View File

@ -0,0 +1,23 @@
package ru.dbotthepony.mc.otm.client.sound
import net.minecraft.client.resources.sounds.AbstractSoundInstance
import net.minecraft.client.resources.sounds.SoundInstance
import net.minecraft.sounds.SoundSource
import net.minecraft.world.phys.Vec3
import net.neoforged.api.distmarker.Dist
import net.neoforged.api.distmarker.OnlyIn
import ru.dbotthepony.mc.otm.block.entity.blackhole.BlackHoleBlockEntity
import ru.dbotthepony.mc.otm.registry.game.MSoundEvents
@OnlyIn(Dist.CLIENT)
class BlackHoleAmbientSoundInstance(val tile: BlackHoleBlockEntity)
: AbstractSoundInstance(MSoundEvents.BLACK_HOLE, SoundSource.AMBIENT, SoundInstance.createUnseededRandom()) {
private val center = Vec3.atCenterOf(tile.blockPos)
init {
looping = true
x = center.x
y = center.y
z = center.z
}
}

View File

@ -4,14 +4,15 @@ import net.minecraft.core.registries.BuiltInRegistries
import net.minecraft.sounds.SoundEvent
import net.neoforged.bus.api.IEventBus
import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.core.ResourceLocation
import ru.dbotthepony.mc.otm.OverdriveThatMatters.loc
import ru.dbotthepony.mc.otm.registry.MDeferredRegister
object MSoundEvents {
private val registry: MDeferredRegister<SoundEvent> = MDeferredRegister(BuiltInRegistries.SOUND_EVENT, OverdriveThatMatters.MOD_ID)
// TODO: 1.19.3
private fun make(name: String): MDeferredRegister<SoundEvent>.Entry<SoundEvent> = registry.register(name) { SoundEvent.createVariableRangeEvent(ResourceLocation(OverdriveThatMatters.MOD_ID, name)) }
private fun make(name: String): MDeferredRegister<SoundEvent>.Entry<SoundEvent> = registry.register(name) { SoundEvent.createVariableRangeEvent(loc(name)) }
private fun make(name: String, range: Float): MDeferredRegister<SoundEvent>.Entry<SoundEvent> = registry.register(name) { SoundEvent.createFixedRangeEvent(loc(name), range) }
val RIFLE_SHOT by make("item.rifle_shot")
val PLASMA_WEAPON_OVERHEAT by make("item.plasma_weapon_overheat")
@ -22,7 +23,7 @@ object MSoundEvents {
val ANDROID_SHOCKWAVE by make("android.shockwave")
val ANDROID_PROJ_PARRY by make("android.projectile_parry")
val BLACK_HOLE by make("black_hole")
val BLACK_HOLE by make("black_hole", 32F)
fun register(bus: IEventBus) {
registry.register(bus)