fix: dedicated server error
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
package quaedam.projection.misc
|
package quaedam.projection.misc
|
||||||
|
|
||||||
import dev.architectury.event.events.client.ClientTickEvent
|
import dev.architectury.event.events.client.ClientTickEvent
|
||||||
|
import dev.architectury.platform.Platform
|
||||||
|
import net.fabricmc.api.EnvType
|
||||||
import net.minecraft.client.Minecraft
|
import net.minecraft.client.Minecraft
|
||||||
import net.minecraft.client.resources.sounds.SimpleSoundInstance
|
import net.minecraft.client.resources.sounds.SimpleSoundInstance
|
||||||
import net.minecraft.client.resources.sounds.SoundInstance
|
import net.minecraft.client.resources.sounds.SoundInstance
|
||||||
@@ -48,6 +50,7 @@ object NoiseProjection {
|
|||||||
}!!
|
}!!
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
if (Platform.getEnv() == EnvType.CLIENT) {
|
||||||
ClientTickEvent.CLIENT_POST.register { game ->
|
ClientTickEvent.CLIENT_POST.register { game ->
|
||||||
val player = game.player ?: return@register
|
val player = game.player ?: return@register
|
||||||
val random = (game.level ?: return@register).random
|
val random = (game.level ?: return@register).random
|
||||||
@@ -64,6 +67,7 @@ object NoiseProjection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun playRandomNoise(random: RandomSource, game: Minecraft) {
|
private fun playRandomNoise(random: RandomSource, game: Minecraft) {
|
||||||
val sound = SimpleSoundInstance(
|
val sound = SimpleSoundInstance(
|
||||||
|
Reference in New Issue
Block a user