Implemented more sounds

This commit is contained in:
whatsy committed 2026-11-09 15:22:37 -05:00
1 parent 149c1f85e0
commit 19508df8d1
36 files changed
+102 -14

No files matched your search

+1
View File
@@ -6,6 +6,7 @@
- A Pokémon holding a Power item now gains 1 point in the corresponding riding stat every two minutes while being ridden. The interval is configurable, and can be disabled with `-1`.
- Added sounds to Gigaton Hammer and Pyro Ball
- Added stepsounds to Venusaur, Blastoise, Dewgong, Rhydon, Rhyhorn, Parasect and Mr. Mime.
- Added the Copper Oven, Copper Fridge, Copper Washer, Copper Fan, and Copper Mower.
### Changes
- Amethyst now grows from Typegem core blocks like typegems do
@@ -414,6 +414,14 @@ object CobblemonSounds : PlatformRegistry<Registry<SoundEvent>, ResourceKey<Regi
val APPLIANCE_BREAK = this.create("block.appliance.roto_appliance_break")
@JvmField
val MOWER_CUT = this.create("block.appliance.roto_mower_cut")
@JvmField
val WASHER_WASH = this.create("block.appliance.roto_washer_wash")
@JvmField
val FAN_BLOW = this.create("block.appliance.roto_fan_blow")
@JvmField
val FAN_START = this.create("block.appliance.roto_fan_start")
@JvmField
val FAN_STOP = this.create("block.appliance.roto_fan_stop")
// Note to self or whoever's peeking, block sounds have to be at 1.1f pitch
// For some reason, the game pitches them down and compensating for it here returns them to normal
@@ -8,6 +8,9 @@
package com.cobblemon.mod.common.block.appliances
import com.cobblemon.mod.common.CobblemonSounds
import com.cobblemon.mod.common.client.sound.BlockEntitySoundTracker
import com.cobblemon.mod.common.client.sound.instances.CancellableSoundInstance
import com.cobblemon.mod.common.util.rotateShape
import com.mojang.serialization.MapCodec
import com.mojang.serialization.codecs.RecordCodecBuilder
@@ -75,7 +78,11 @@ open class CopperFanBlock(settings: Properties) : HorizontalDirectionalBlock(set
): InteractionResult {
if (!level.isClientSide) {
level.setBlockAndUpdate(pos, state.setValue(PUSH, !state.getValue(PUSH)))
level.playSound(null, pos, SoundEvents.STONE_BUTTON_CLICK_ON, SoundSource.BLOCKS)
if (state.getValue(PUSH)) {
level.playSound(null, pos, CobblemonSounds.FAN_START, SoundSource.BLOCKS)
} else {
level.playSound(null, pos, CobblemonSounds.FAN_STOP, SoundSource.BLOCKS)
}
}
return InteractionResult.SUCCESS
}
@@ -122,7 +129,22 @@ open class CopperFanBlock(settings: Properties) : HorizontalDirectionalBlock(set
val facing = state.getValue(HORIZONTAL_FACING)
val power = state.getValue(POWER)
if (power == 0) return
if (power == 0) {
if (BlockEntitySoundTracker.isActive(pos, CobblemonSounds.FAN_BLOW.location)) {
BlockEntitySoundTracker.stop(pos, CobblemonSounds.FAN_BLOW.location)
}
return
}
val sound = CancellableSoundInstance(
sound = CobblemonSounds.FAN_BLOW,
pos = pos,
repeat = true
)
if (!BlockEntitySoundTracker.isActive(pos, CobblemonSounds.FAN_BLOW.location)) {
BlockEntitySoundTracker.play(pos, sound)
}
if (state.getValue(PUSH)) {
val area = AABB(pos.relative(facing)).expandTowards(
@@ -5,6 +5,7 @@ import com.cobblemon.mod.common.CobblemonNetwork.sendPacket
import com.cobblemon.mod.common.net.messages.client.effect.SpawnSnowstormParticlePacket
import com.cobblemon.mod.common.util.cobblemonResource
import net.minecraft.core.BlockPos
import net.minecraft.core.Direction
import net.minecraft.server.level.ServerLevel
import net.minecraft.world.Container
import net.minecraft.world.item.ItemStack
@@ -20,23 +21,34 @@ class CopperFridgeBlockEntity(val pos: BlockPos, val state: BlockState) : BlockE
), ContainerSingleItem.BlockContainerSingleItem {
private var item: ItemStack = Items.AIR.defaultInstance
private var spawnedReadyParticle = false
var timer: Int = -1
fun processTick() {
val serverLevel = level as? ServerLevel ?: return
if (item.`is`(Items.ICE) && serverLevel.gameTime % 20L == 0L) {
if (item.`is`(Items.ICE) && !spawnedReadyParticle) {
val facing = state.getValue(CopperFridgeBlock.FACING)
val particlePosition = Vec3(
pos.x + 0.5 + facing.stepX * 0.55,
pos.y + 1.0,
pos.z + 0.5 + facing.stepZ * 0.55
pos.x + 0.5,
pos.y + 1.5,
pos.z + 0.5
)
val packet = SpawnSnowstormParticlePacket(cobblemonResource("rotomfridge_doorready"), particlePosition)
val rotation = when (facing) {
Direction.NORTH -> 180F
Direction.EAST -> 90F
Direction.SOUTH -> 0F
Direction.WEST -> 270F
else -> 0F
}
val packet = SpawnSnowstormParticlePacket(cobblemonResource("rotomfridge_doorready"), particlePosition, rotation)
serverLevel.players()
.filter { it.distanceToSqr(particlePosition.x, particlePosition.y, particlePosition.z) <= 32.0 * 32.0 }
.forEach { it.sendPacket(packet) }
spawnedReadyParticle = true
} else if (!item.`is`(Items.ICE)) {
spawnedReadyParticle = false
}
if (!serverLevel.getBlockState(pos).getValue(CopperFridgeBlock.POWERED)) return
@@ -2,9 +2,11 @@ package com.cobblemon.mod.common.block.appliances
import com.cobblemon.mod.common.CobblemonBlockEntities
import com.cobblemon.mod.common.CobblemonRecipeTypes
import com.cobblemon.mod.common.CobblemonSounds
import com.cobblemon.mod.common.item.crafting.washer.WasherInput
import com.cobblemon.mod.common.util.isServerSide
import net.minecraft.core.BlockPos
import net.minecraft.sounds.SoundSource
import net.minecraft.world.item.ItemStack
import net.minecraft.world.level.block.entity.BlockEntity
import net.minecraft.world.level.block.state.BlockState
@@ -35,6 +37,7 @@ class CopperWasherBlockEntity(val pos: BlockPos, val state: BlockState): BlockEn
theItem = recipe.value().assemble(input, level.registryAccess())
setChanged()
level.playSound(null, pos, CobblemonSounds.WASHER_WASH, SoundSource.BLOCKS)
level.sendBlockUpdated(worldPosition, blockState, blockState, 3)
}
}
@@ -13,6 +13,7 @@ import com.cobblemon.mod.common.client.particle.BedrockParticleOptionsRepository
import com.cobblemon.mod.common.client.particle.ParticleStorm
import com.cobblemon.mod.common.client.render.MatrixWrapper
import com.cobblemon.mod.common.net.messages.client.effect.SpawnSnowstormParticlePacket
import com.mojang.math.Axis
import net.minecraft.client.Minecraft
import com.mojang.blaze3d.vertex.PoseStack
@@ -20,6 +21,7 @@ object SpawnSnowstormParticleHandler : ClientNetworkPacketHandler<SpawnSnowstorm
override fun handle(packet: SpawnSnowstormParticlePacket, client: Minecraft) {
val wrapper = MatrixWrapper()
val matrix = PoseStack()
matrix.mulPose(Axis.YP.rotationDegrees(packet.rotation))
wrapper.updateMatrix(matrix.last().pose())
wrapper.updatePosition(packet.position)
val world = Minecraft.getInstance().level ?: return
@@ -28,6 +28,7 @@ import net.minecraft.world.phys.Vec3
class SpawnSnowstormParticlePacket(
val effectId: ResourceLocation,
val position: Vec3,
val rotation: Float = 0F,
) : NetworkPacket<SpawnSnowstormParticlePacket> {
override val id = ID
companion object {
@@ -39,7 +40,8 @@ class SpawnSnowstormParticlePacket(
buffer.readDouble(),
buffer.readDouble(),
buffer.readDouble()
)
),
rotation = buffer.readFloat()
)
}
}
@@ -48,5 +50,6 @@ class SpawnSnowstormParticlePacket(
buffer.writeDouble(position.x)
buffer.writeDouble(position.y)
buffer.writeDouble(position.z)
buffer.writeFloat(rotation)
}
}
@@ -17,12 +17,11 @@
}
},
"components": {
"minecraft:emitter_rate_steady": {
"spawn_rate": 8,
"max_particles": 100
"minecraft:emitter_rate_instant": {
"num_particles": 1
},
"minecraft:emitter_lifetime_expression": {
"activation_expression": 1
"minecraft:emitter_lifetime_once": {
"active_time": 0.05
},
"minecraft:emitter_shape_box": {
"offset": [0, -1, 0.5],
@@ -2155,6 +2155,11 @@
"cobblemon.subtitle.block.tm_machine.tm_retrieve": "TM taken from TM Machine",
"cobblemon.subtitle.block.tm_machine.item_insert": "Item placed in TM Machine",
"cobblemon.subtitle.block.tm_machine.item_retrieve": "Item taken from TM Machine",
"cobblemon.subtitle.block.fan.start": "Copper Fan starts",
"cobblemon.subtitle.block.fan.stop": "Copper Fan stops",
"cobblemon.subtitle.block.fan.blow": "Copper Fan blowing",
"cobblemon.subtitle.block.washer.wash": "Copper Washer washes",
"cobblemon.subtitle.block.mower.cut": "Copper Mower revs",
"cobblemon.healingmachine.alreadyinuse": "This healing machine is already in use!",
"cobblemon.healingmachine.nopokemon": "You don't have any Pokémon in your party to heal!",
"cobblemon.healingmachine.alreadyhealed": "Your Pokémon party is already fully healed!",
@@ -1184,7 +1184,7 @@
]
},
"block.appliance.roto_mower_cut": {
"subtitle": "subtitles.block.generic.footsteps",
"subtitle": "cobblemon.subtitle.block.mower.cut",
"sounds": [
{ "name": "cobblemon:block/appliance/roto_mower_cut_1", "volume": 0.7 },
{ "name": "cobblemon:block/appliance/roto_mower_cut_2", "volume": 0.7 },
@@ -1192,6 +1192,39 @@
{ "name": "cobblemon:block/appliance/roto_mower_cut_4", "volume": 0.7 }
]
},
"block.appliance.roto_fan_blow": {
"subtitle": "cobblemon.subtitle.block.fan.blow",
"sounds": [
{ "name": "cobblemon:block/appliance/roto_fan_blow", "volume": 0.7 }
]
},
"block.appliance.roto_fan_start": {
"subtitle": "cobblemon.subtitle.block.fan.start",
"sounds": [
{ "name": "cobblemon:block/appliance/roto_fan_start_1", "volume": 0.7 },
{ "name": "cobblemon:block/appliance/roto_fan_start_2", "volume": 0.7 },
{ "name": "cobblemon:block/appliance/roto_fan_start_3", "volume": 0.7 },
{ "name": "cobblemon:block/appliance/roto_fan_start_4", "volume": 0.7 }
]
},
"block.appliance.roto_fan_stop": {
"subtitle": "cobblemon.subtitle.block.fan.stop",
"sounds": [
{ "name": "cobblemon:block/appliance/roto_fan_stop_1", "volume": 0.7 },
{ "name": "cobblemon:block/appliance/roto_fan_stop_2", "volume": 0.7 },
{ "name": "cobblemon:block/appliance/roto_fan_stop_3", "volume": 0.7 },
{ "name": "cobblemon:block/appliance/roto_fan_stop_4", "volume": 0.7 }
]
},
"block.appliance.roto_washer_wash": {
"subtitle": "cobblemon.subtitle.block.washer.wash",
"sounds": [
{ "name": "cobblemon:block/appliance/roto_washer_wash_1", "volume": 0.7 },
{ "name": "cobblemon:block/appliance/roto_washer_wash_2", "volume": 0.7 },
{ "name": "cobblemon:block/appliance/roto_washer_wash_3", "volume": 0.7 },
{ "name": "cobblemon:block/appliance/roto_washer_wash_4", "volume": 0.7 }
]
},
"move.absorb.actor": {
"sounds": [ { "name": "cobblemon:move/absorb/absorb_actor", "volume": 0.3 } ]
},