diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/block/entity/TMBlockEntity.kt b/common/src/main/kotlin/com/cobblemon/mod/common/block/entity/TMBlockEntity.kt index 31a5723b08..603db9c9fb 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/block/entity/TMBlockEntity.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/block/entity/TMBlockEntity.kt @@ -18,6 +18,8 @@ import com.cobblemon.mod.common.block.TMBlock import com.cobblemon.mod.common.gui.TMMScreenHandler import com.cobblemon.mod.common.item.components.TMMoveComponent import com.cobblemon.mod.common.util.itemRegistry +import com.cobblemon.mod.common.util.playSoundServer +import com.cobblemon.mod.common.util.toVec3d import net.minecraft.core.BlockPos import net.minecraft.core.Direction import net.minecraft.core.HolderLookup @@ -77,21 +79,11 @@ class TMBlockEntity(pos: BlockPos, state: BlockState) : BaseContainerBlockEntity } fun playSound(world: Level, pos: BlockPos, state: BlockState, sound: SoundEvent) { - var d = pos.x.toDouble() + 0.5 - val e = pos.y.toDouble() + 0.5 - var f = pos.z.toDouble() + 0.5 - val direction = state.getValue(BlockStateProperties.HORIZONTAL_FACING) - d += direction.stepX.toDouble() * 0.5 - f += direction.stepZ.toDouble() * 0.5 - world.playSound( - null, - d, - e, - f, - sound, - SoundSource.BLOCKS, - 0.5f, - world.random.nextFloat() * 0.1f + 0.9f + world.playSoundServer( + position = pos.toVec3d(), + sound = sound, + volume = 0.5F, + pitch = 1F ) } } @@ -254,10 +246,7 @@ class TMBlockEntity(pos: BlockPos, state: BlockState) : BaseContainerBlockEntity val recipe = TechnicalMachines.moveToTM[filterTM]?.recipe if (recipe != null) { - if (this.tmmInventory.getItem(2).item != this.level?.itemRegistry?.get(recipe.item) || this.tmmInventory.getItem( - 2 - ).count < recipe.count - ) return 0 + if (this.tmmInventory.getItem(2).item != this.level?.itemRegistry?.get(recipe.item) || this.tmmInventory.getItem(2).count < recipe.count) return 0 } return 15 diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/client/gui/tm/TMMHandledScreen.kt b/common/src/main/kotlin/com/cobblemon/mod/common/client/gui/tm/TMMHandledScreen.kt index 7cdd572e54..640106de02 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/client/gui/tm/TMMHandledScreen.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/client/gui/tm/TMMHandledScreen.kt @@ -609,7 +609,7 @@ class TMMHandledScreen( } override fun children(): MutableList { - val list : MutableList = Lists.newArrayList() + val list : MutableList = mutableListOf() for (child in children) { list.add(child.value) } diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/client/net/gui/CraftBlankTMPacketHandler.kt b/common/src/main/kotlin/com/cobblemon/mod/common/client/net/gui/CraftBlankTMPacketHandler.kt index 0c397b04f4..d0beee30fe 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/client/net/gui/CraftBlankTMPacketHandler.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/client/net/gui/CraftBlankTMPacketHandler.kt @@ -23,9 +23,8 @@ object CraftBlankTMPacketHandler : ServerNetworkPacketHandler= 1) { screen.inventory!!.removeItem(2, 1)