Use GJRAND64 in menus

This commit is contained in:
DBotThePony 2025-03-21 13:36:46 +07:00
parent b921658eb2
commit f9821aa552
Signed by: DBot
GPG Key ID: DCC23B5715498507
3 changed files with 7 additions and 5 deletions

View File

@ -29,6 +29,7 @@ import ru.dbotthepony.mc.otm.client.screen.panels.input.QueryUserPanel
import ru.dbotthepony.mc.otm.core.RandomSource2Generator
import ru.dbotthepony.mc.otm.core.collect.concatIterators
import ru.dbotthepony.mc.otm.core.collect.flatMap
import ru.dbotthepony.mc.otm.core.util.GJRAND64RandomSource
import java.util.*
import java.util.concurrent.CopyOnWriteArrayList
import java.util.function.Predicate
@ -224,11 +225,11 @@ open class EditablePanel<out S : Screen>(
}
}
val random: RandomSource by lazy {
val random: GJRAND64RandomSource by lazy {
if (screen is MatteryScreen<*>) {
screen.menu.random
} else {
RandomSource.create()
GJRAND64RandomSource()
}
}

View File

@ -445,8 +445,8 @@ private class AndroidResearchButton(
}
private enum class PreviewScrollers(
val init: (EditablePanel<*>, RandomSource) -> Unit,
val scroll: (EditablePanel<*>, RandomSource) -> Boolean
val init: (EditablePanel<*>, RandomGenerator) -> Unit,
val scroll: (EditablePanel<*>, RandomGenerator) -> Boolean
) {
LEFT_TO_RIGHT(
init = { it, random ->

View File

@ -44,6 +44,7 @@ import ru.dbotthepony.mc.otm.container.sortWithIndices
import ru.dbotthepony.mc.otm.core.ResourceLocation
import ru.dbotthepony.mc.otm.core.collect.ConditionalSet
import ru.dbotthepony.mc.otm.core.math.Decimal
import ru.dbotthepony.mc.otm.core.util.GJRAND64RandomSource
import ru.dbotthepony.mc.otm.menu.input.BooleanInputWithFeedback
import ru.dbotthepony.mc.otm.menu.widget.ProfiledLevelGaugeWidget
import ru.dbotthepony.mc.otm.network.MatteryStreamCodec
@ -81,7 +82,7 @@ abstract class MatteryMenu(
val mSynchronizer = SynchableGroup()
val synchronizerRemote = mSynchronizer.Remote()
val player: Player get() = inventory.player
val random: RandomSource = RandomSource.create()
val random = GJRAND64RandomSource()
private val _playerInventorySlots = ArrayList<InventorySlot>()
private val _playerHotbarSlots = ArrayList<InventorySlot>()