попытка в амбиент звук для чёрной дыры.
не факт что правильная и не факт что будет работать нормально.
This commit is contained in:
parent
d5d4637fff
commit
652e7d5238
@ -42,7 +42,10 @@ class SoundDataProvider(event: GatherDataEvent) : SoundDefinitionsProvider(event
|
|||||||
add(
|
add(
|
||||||
MSoundEvents.BLACK_HOLE,
|
MSoundEvents.BLACK_HOLE,
|
||||||
definition().subtitle("otm.sound.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(
|
add(
|
||||||
MSoundEvents.ANDROID_PROJ_PARRY,
|
MSoundEvents.ANDROID_PROJ_PARRY,
|
||||||
|
@ -20,12 +20,16 @@ import net.minecraft.world.level.block.state.BlockState
|
|||||||
import net.minecraft.world.level.levelgen.structure.BoundingBox
|
import net.minecraft.world.level.levelgen.structure.BoundingBox
|
||||||
import net.minecraft.world.phys.AABB
|
import net.minecraft.world.phys.AABB
|
||||||
import net.minecraft.world.phys.Vec3
|
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 net.neoforged.neoforge.common.Tags
|
||||||
import ru.dbotthepony.kommons.util.getValue
|
import ru.dbotthepony.kommons.util.getValue
|
||||||
import ru.dbotthepony.kommons.util.setValue
|
import ru.dbotthepony.kommons.util.setValue
|
||||||
import ru.dbotthepony.mc.otm.block.BlackHoleBlock
|
import ru.dbotthepony.mc.otm.block.BlackHoleBlock
|
||||||
import ru.dbotthepony.mc.otm.block.entity.tech.GravitationStabilizerBlockEntity
|
import ru.dbotthepony.mc.otm.block.entity.tech.GravitationStabilizerBlockEntity
|
||||||
import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity
|
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.config.ServerConfig
|
||||||
import ru.dbotthepony.mc.otm.core.addAll
|
import ru.dbotthepony.mc.otm.core.addAll
|
||||||
import ru.dbotthepony.mc.otm.core.collect.map
|
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 {
|
companion object {
|
||||||
const val ITERATIONS = 30_000
|
const val ITERATIONS = 30_000
|
||||||
val HAWKING_MASS_LOSE_STEP = Decimal(-100)
|
val HAWKING_MASS_LOSE_STEP = Decimal(-100)
|
||||||
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
@ -4,14 +4,15 @@ import net.minecraft.core.registries.BuiltInRegistries
|
|||||||
import net.minecraft.sounds.SoundEvent
|
import net.minecraft.sounds.SoundEvent
|
||||||
import net.neoforged.bus.api.IEventBus
|
import net.neoforged.bus.api.IEventBus
|
||||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
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
|
import ru.dbotthepony.mc.otm.registry.MDeferredRegister
|
||||||
|
|
||||||
object MSoundEvents {
|
object MSoundEvents {
|
||||||
private val registry: MDeferredRegister<SoundEvent> = MDeferredRegister(BuiltInRegistries.SOUND_EVENT, OverdriveThatMatters.MOD_ID)
|
private val registry: MDeferredRegister<SoundEvent> = MDeferredRegister(BuiltInRegistries.SOUND_EVENT, OverdriveThatMatters.MOD_ID)
|
||||||
|
|
||||||
// TODO: 1.19.3
|
// 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 RIFLE_SHOT by make("item.rifle_shot")
|
||||||
val PLASMA_WEAPON_OVERHEAT by make("item.plasma_weapon_overheat")
|
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_SHOCKWAVE by make("android.shockwave")
|
||||||
val ANDROID_PROJ_PARRY by make("android.projectile_parry")
|
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) {
|
fun register(bus: IEventBus) {
|
||||||
registry.register(bus)
|
registry.register(bus)
|
||||||
|
Loading…
Reference in New Issue
Block a user