fix: add PSH interface for noise rate

This commit is contained in:
xtex 2023-07-29 15:48:09 +08:00
parent d2c1380b82
commit 46c304931d
Signed by: xtex
GPG Key ID: B918086ED8045B91
3 changed files with 7 additions and 0 deletions

View File

@ -99,6 +99,7 @@ data class NoiseProjectionEffect(var rate: Int = 10, var amount: Int = 3) : Proj
ProjectionEffectShell.Provider { ProjectionEffectShell.Provider {
companion object { companion object {
const val TAG_RATE = "Rate"
const val TAG_AMOUNT = "Amount" const val TAG_AMOUNT = "Amount"
} }
@ -106,17 +107,21 @@ data class NoiseProjectionEffect(var rate: Int = 10, var amount: Int = 3) : Proj
get() = SoundProjection.effect.get()!! get() = SoundProjection.effect.get()!!
override fun toNbt(tag: CompoundTag) { override fun toNbt(tag: CompoundTag) {
tag.putInt(TAG_RATE, rate)
tag.putInt(TAG_AMOUNT, amount) tag.putInt(TAG_AMOUNT, amount)
} }
override fun fromNbt(tag: CompoundTag, trusted: Boolean) { override fun fromNbt(tag: CompoundTag, trusted: Boolean) {
rate = tag.getInt(TAG_RATE)
amount = tag.getInt(TAG_AMOUNT) amount = tag.getInt(TAG_AMOUNT)
if (!trusted) { if (!trusted) {
amount = min(amount, 8) amount = min(amount, 8)
rate = min(rate, 500)
} }
} }
override fun createShell() = buildProjectionEffectShell(this) { override fun createShell() = buildProjectionEffectShell(this) {
intSlider("quaedam.shell.noise.rate", ::rate, 0..300 step 5)
intSlider("quaedam.shell.noise.amount", ::amount, 0..8) intSlider("quaedam.shell.noise.amount", ::amount, 0..8)
} }

View File

@ -16,6 +16,7 @@
"quaedam.screen.projection_shell.empty": "No Options Available!", "quaedam.screen.projection_shell.empty": "No Options Available!",
"quaedam.screen.projection_shell.close": "Close", "quaedam.screen.projection_shell.close": "Close",
"quaedam.shell.skylight.factor": "Factor", "quaedam.shell.skylight.factor": "Factor",
"quaedam.shell.noise.rate": "Rate",
"quaedam.shell.noise.amount": "Amount", "quaedam.shell.noise.amount": "Amount",
"quaedam.shell.swarm.max_count": "Max Count" "quaedam.shell.swarm.max_count": "Max Count"
} }

View File

@ -16,6 +16,7 @@
"quaedam.screen.projection_shell.empty": "无可用选项!", "quaedam.screen.projection_shell.empty": "无可用选项!",
"quaedam.screen.projection_shell.close": "关闭", "quaedam.screen.projection_shell.close": "关闭",
"quaedam.shell.skylight.factor": "因子", "quaedam.shell.skylight.factor": "因子",
"quaedam.shell.noise.rate": "速率",
"quaedam.shell.noise.amount": "数量", "quaedam.shell.noise.amount": "数量",
"quaedam.shell.swarm.max_count": "最大数量" "quaedam.shell.swarm.max_count": "最大数量"
} }