Skip to content

Commit

Permalink
优化缓存逻辑
Browse files Browse the repository at this point in the history
更改版本至 1.1.1
更新 README.md
  • Loading branch information
BillGoldenWater committed Oct 26, 2022
1 parent 2e9894a commit ad158d6
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
2 changes: 1 addition & 1 deletion ClientSide-Fabric/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ loom_version = 1.0-SNAPSHOT
java_version = 17
##########################################################################
# Mod Properties
mod_version = 1.1.0
mod_version = 1.1.1
maven_group = indi.goldenwater
archives_base_name = ChaosMusicPlayer
##########################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ val defaultBufferLengthInSecond: Double = if (System.getProperty("os.name") == "
}
var bufferLength = defaultBufferLengthInSecond
var minecraftClient: MinecraftClient? = null
var end = true

@Suppress("UNUSED")
object ChaosMusicPlayer : ClientModInitializer {
Expand All @@ -62,6 +63,7 @@ object ChaosMusicPlayer : ClientModInitializer {
val arr = ByteArray(packetByteBuf.readableBytes())
packetByteBuf.readBytes(arr)

end = false
val decoded = MusicData.fromEncoded(arr)
buffer.add(decoded)
}
Expand Down Expand Up @@ -113,7 +115,7 @@ fun startPlayLoop() {
// region buffer auto adjust
thread {
Thread.sleep(500)
if (buffer.size > 0) {
if (!end) {
bufferLength *= 1.2
println("[ChaosMusicPlayer] was out of buffer, adding buffer length to $bufferLength")
} else if (bufferLength != defaultBufferLengthInSecond) {
Expand All @@ -122,6 +124,7 @@ fun startPlayLoop() {
}
}
// endregion
end = true
} else {
Thread.sleep(10)
}
Expand Down
2 changes: 1 addition & 1 deletion Common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

group = "indi.goldenwater.chaosmusicplayer.common"
version = "1.1.0"
version = "1.1.1"

repositories {
mavenCentral()
Expand Down
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ ChaosMusicPlayer 是一个用于便捷播放音乐的 Minecraft 服务端插件

### 注:

- 对音质有要求的可以使用 客户端mod
- 需要以下版本或更高的 fabric
- fabric 1.18.2
- fabric loader 0.14.10
- fabric-api 0.59.1+1.18.2
- 前置 [Fabric Language Kotlin](https://www.curseforge.com/minecraft/mc-mods/fabric-language-kotlin)
- 对音质有要求的可以使用 客户端mod
- 需要以下版本或更高的 fabric
- fabric 1.18.2
- fabric loader 0.14.8
- fabric-api 0.59.1+1.18.2
- 前置 [Fabric Language Kotlin](https://www.curseforge.com/minecraft/mc-mods/fabric-language-kotlin)
- 因实现方法受 Minecraft 同时播放声音数(247)的限制 造成播放复杂音乐时噪音较多

### BUG反馈, 建议:
Expand Down Expand Up @@ -73,6 +73,13 @@ ChaosMusicPlayer 是一个用于便捷播放音乐的 Minecraft 服务端插件

### 更新记录:

- 2022-10-27 1.1.1
- 修复:
- 修复非 macOS 下播放异常的问题
- 修复特定情况下播放卡顿的问题
- 优化:
- 优化缓存控制 降低卡顿次数
- 降低 fabric loader 的版本需求至 0.14.8
- 2022-10-24 1.1.0
- 新增:
- 新增客户端 Fabric MOD 大幅优化音质
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
}

group = "indi.goldenwater"
version = "1.1.0"
version = "1.1.1"

repositories {
mavenCentral()
Expand All @@ -24,7 +24,7 @@ dependencies {

implementation(project(":Common"))

compileOnly("com.github.wendykierp:JTransforms:3.1")
implementation("com.github.wendykierp:JTransforms:3.1")

compileOnly("net.kyori:text-adapter-bukkit:3.0.6")

Expand Down

0 comments on commit ad158d6

Please sign in to comment.