From 987eb68189ee183ffe1f5adb516cab2f5b810b21 Mon Sep 17 00:00:00 2001 From: orpos Date: Sun, 6 Sep 2026 18:31:29 -0300 Subject: [PATCH 1/2] add death sound and change from whitelist to blacklist for sound filtering --- .../snowii/extractor/extractors/Entities.kt | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/main/kotlin/de/snowii/extractor/extractors/Entities.kt b/src/main/kotlin/de/snowii/extractor/extractors/Entities.kt index 9e19971..6e8cbaa 100644 --- a/src/main/kotlin/de/snowii/extractor/extractors/Entities.kt +++ b/src/main/kotlin/de/snowii/extractor/extractors/Entities.kt @@ -40,12 +40,18 @@ class Entities : Extractor.Extractor { if (entity is LivingEntity) { entityJson.addProperty("experience_reward", entity.getBaseExperienceReward(server.overworld())) - if (entityName in TARGET_HURT_SOUND_ENTITIES) { + if (entityName !in TARGET_SOUND_BLACKLIST) { val hurtSound = getHurtSound(entity, damageSource) val hurtSoundId = hurtSound?.let(BuiltInRegistries.SOUND_EVENT::getKey)?.path if (hurtSoundId != null) { entityJson.addProperty("hurt_sound", hurtSoundId) } + + val deathSound = getDeathSound(entity) + val deathSoundId = deathSound?.let(BuiltInRegistries.SOUND_EVENT::getKey)?.path + if (deathSound != null) { + entityJson.addProperty("death_sound", deathSoundId) + } } } entityJson.addProperty("attackable", entity.isAttackable) @@ -121,22 +127,20 @@ class Entities : Extractor.Extractor { private fun getHurtSound(entity: LivingEntity, damageSource: DamageSource) = getHurtSoundMethod.invoke(entity, damageSource) as? net.minecraft.sounds.SoundEvent + private fun getDeathSound(entity: LivingEntity) = + getDeathSoundMethod.invoke(entity) as? net.minecraft.sounds.SoundEvent + companion object { - private val TARGET_HURT_SOUND_ENTITIES = setOf( - "bogged", - "drowned", - "enderman", - "husk", - "parched", - "skeleton", - "stray", - "wither_skeleton", - "zombie", - "zombie_villager", + private val TARGET_SOUND_BLACKLIST = setOf( + "slime", + "copper_golem" ) private val getHurtSoundMethod = LivingEntity::class.java .getDeclaredMethod("getHurtSound", DamageSource::class.java) .apply { isAccessible = true } + private val getDeathSoundMethod = LivingEntity::class.java + .getDeclaredMethod("getDeathSound") + .apply { isAccessible = true } } } From ee721db5dc2153a4c4ccde57bc1a0029dc8f6062 Mon Sep 17 00:00:00 2001 From: orpos <58054927+orpos@users.noreply.github.com> Date: Sun, 6 Sep 2026 21:41:23 -0300 Subject: [PATCH 2/2] Update src/main/kotlin/de/snowii/extractor/extractors/Entities.kt Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- src/main/kotlin/de/snowii/extractor/extractors/Entities.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/de/snowii/extractor/extractors/Entities.kt b/src/main/kotlin/de/snowii/extractor/extractors/Entities.kt index 6e8cbaa..5c72d47 100644 --- a/src/main/kotlin/de/snowii/extractor/extractors/Entities.kt +++ b/src/main/kotlin/de/snowii/extractor/extractors/Entities.kt @@ -49,7 +49,7 @@ class Entities : Extractor.Extractor { val deathSound = getDeathSound(entity) val deathSoundId = deathSound?.let(BuiltInRegistries.SOUND_EVENT::getKey)?.path - if (deathSound != null) { + if (deathSoundId != null) { entityJson.addProperty("death_sound", deathSoundId) } }