Plasma rifle fire sound

This commit is contained in:
DBotThePony 2022-05-14 22:31:43 +07:00
parent 813a6f0ceb
commit 25916f920d
Signed by: DBot
GPG Key ID: DCC23B5715498507
6 changed files with 44 additions and 0 deletions

View File

@ -1,5 +1,6 @@
package ru.dbotthepony.mc.otm.item.weapon
import net.minecraft.sounds.SoundSource
import net.minecraft.util.Mth
import net.minecraft.world.entity.Entity
import net.minecraft.world.entity.player.Player
@ -9,6 +10,7 @@ import ru.dbotthepony.mc.otm.core.*
import ru.dbotthepony.mc.otm.core.Vector
import ru.dbotthepony.mc.otm.entity.PlasmaProjectile
import ru.dbotthepony.mc.otm.position
import ru.dbotthepony.mc.otm.registry.MSoundEvents
import java.util.*
import kotlin.math.PI
import kotlin.math.cos
@ -145,6 +147,15 @@ class PlasmaRifleItem : PlasmaWeaponItem<WeaponDataTable>(WeaponDataTable::class
dt.doFireAnim(deviation = rotFireAnimDeviation)
}
player.level.playSound(
player,
player,
MSoundEvents.RIFLE_SHOT,
SoundSource.NEUTRAL,
1f,
1f
)
return true
}

View File

@ -104,6 +104,7 @@ object MRegistry {
MItems.register()
AndroidFeatures.register()
AndroidResearch.register()
MSoundEvents.register()
}
private fun register(event: NewRegistryEvent) {

View File

@ -0,0 +1,19 @@
package ru.dbotthepony.mc.otm.registry
import net.minecraft.resources.ResourceLocation
import net.minecraft.sounds.SoundEvent
import net.minecraft.world.entity.EntityType
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext
import net.minecraftforge.registries.DeferredRegister
import net.minecraftforge.registries.ForgeRegistries
import ru.dbotthepony.mc.otm.OverdriveThatMatters
object MSoundEvents {
private val registry: DeferredRegister<SoundEvent> = DeferredRegister.create(ForgeRegistries.SOUND_EVENTS, OverdriveThatMatters.MOD_ID)
val RIFLE_SHOT by registry.register("item.rifle_shot") { SoundEvent(ResourceLocation(OverdriveThatMatters.MOD_ID, "item.rifle_shot")) }
internal fun register() {
registry.register(FMLJavaModLoadingContext.get().modEventBus)
}
}

View File

@ -1,4 +1,5 @@
{
"otm.sound.rifle_shoot": "Plasma rifle fire",
"itemGroup.otm": "Overdrive That Matters",
"otm.pill.warning": "WARNING: This will INSTANTLY decommission you upon ingestion!",

View File

@ -0,0 +1,12 @@
{
"item.rifle_shot": {
"subtitle": "otm.sound.rifle_shoot",
"sounds": [
{
"name": "overdrive_that_matters:item/rifle_shot",
"volume": 1.0,
"weight": 1
}
]
}
}