mirror of https://github.com/kami-blue/client
[fix] StashLogger and ModuleList indexed hue
This commit is contained in:
parent
385fb1660d
commit
6d001dc57d
|
@ -128,7 +128,7 @@ object ModuleList : HudElement(
|
||||||
GlStateManager.translate(animationXOffset - stringPosX - margin, 0.0f, 0.0f)
|
GlStateManager.translate(animationXOffset - stringPosX - margin, 0.0f, 0.0f)
|
||||||
|
|
||||||
if (rainbow.value) {
|
if (rainbow.value) {
|
||||||
val hue = timedHue + indexedHue.value * 0.005f * index++
|
val hue = timedHue + indexedHue.value * 0.05f * index++
|
||||||
val color = ColorConverter.hexToRgb(Color.HSBtoRGB(hue, primaryHsb[1], primaryHsb[2]))
|
val color = ColorConverter.hexToRgb(Color.HSBtoRGB(hue, primaryHsb[1], primaryHsb[2]))
|
||||||
|
|
||||||
TextComponent.TextLine(" ").run {
|
TextComponent.TextLine(" ").run {
|
||||||
|
|
|
@ -43,15 +43,10 @@ object StashLogger : Module(
|
||||||
private val logHoppers by setting("Hoppers", true)
|
private val logHoppers by setting("Hoppers", true)
|
||||||
private val hopperDensity by setting("MinHoppers", 5, 1..20, 1, { logHoppers })
|
private val hopperDensity by setting("MinHoppers", 5, 1..20, 1, { logHoppers })
|
||||||
|
|
||||||
private val chunkData = Collections.synchronizedMap(LinkedHashMap<Long, ChunkStats>())
|
private val chunkData = LinkedHashMap<Long, ChunkStats>()
|
||||||
private val knownPositions = HashSet<BlockPos>()
|
private val knownPositions = HashSet<BlockPos>()
|
||||||
private val timer = TickTimer(TimeUnit.SECONDS)
|
private val timer = TickTimer(TimeUnit.SECONDS)
|
||||||
|
|
||||||
override fun onEnable() {
|
|
||||||
chunkData.clear()
|
|
||||||
knownPositions.clear()
|
|
||||||
}
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
safeListener<TickEvent.ClientTickEvent> {
|
safeListener<TickEvent.ClientTickEvent> {
|
||||||
if (it.phase != TickEvent.Phase.END || !timer.tick(3L)) return@safeListener
|
if (it.phase != TickEvent.Phase.END || !timer.tick(3L)) return@safeListener
|
||||||
|
@ -60,8 +55,7 @@ object StashLogger : Module(
|
||||||
coroutineScope {
|
coroutineScope {
|
||||||
launch {
|
launch {
|
||||||
world.loadedTileEntityList.toList().forEach(::logTileEntity)
|
world.loadedTileEntityList.toList().forEach(::logTileEntity)
|
||||||
}
|
|
||||||
launch {
|
|
||||||
for (chunkStats in chunkData.values) {
|
for (chunkStats in chunkData.values) {
|
||||||
if (!chunkStats.hot) continue
|
if (!chunkStats.hot) continue
|
||||||
|
|
||||||
|
@ -94,7 +88,7 @@ object StashLogger : Module(
|
||||||
if (!checkTileEntityType(tileEntity)) return
|
if (!checkTileEntityType(tileEntity)) return
|
||||||
if (!knownPositions.add(tileEntity.pos)) return
|
if (!knownPositions.add(tileEntity.pos)) return
|
||||||
|
|
||||||
val chunk = ChunkPos.asLong(tileEntity.pos.x shl 4, tileEntity.pos.z shl 4)
|
val chunk = ChunkPos.asLong(tileEntity.pos.x shr 4, tileEntity.pos.z shr 4)
|
||||||
val chunkStats = chunkData.getOrPut(chunk, ::ChunkStats)
|
val chunkStats = chunkData.getOrPut(chunk, ::ChunkStats)
|
||||||
|
|
||||||
chunkStats.add(tileEntity)
|
chunkStats.add(tileEntity)
|
||||||
|
@ -108,13 +102,13 @@ object StashLogger : Module(
|
||||||
|| logHoppers && tileEntity is TileEntityHopper
|
|| logHoppers && tileEntity is TileEntityHopper
|
||||||
|
|
||||||
private class ChunkStats {
|
private class ChunkStats {
|
||||||
var chests: Int = 0; private set
|
var chests = 0; private set
|
||||||
var shulkers: Int = 0; private set
|
var shulkers = 0; private set
|
||||||
var droppers: Int = 0; private set
|
var droppers = 0; private set
|
||||||
var dispensers: Int = 0; private set
|
var dispensers = 0; private set
|
||||||
var hoppers: Int = 0; private set
|
var hoppers = 0; private set
|
||||||
|
|
||||||
var hot: Boolean = false
|
var hot = false
|
||||||
|
|
||||||
private val tileEntities = Collections.synchronizedList(ArrayList<TileEntity>())
|
private val tileEntities = Collections.synchronizedList(ArrayList<TileEntity>())
|
||||||
|
|
||||||
|
@ -125,6 +119,7 @@ object StashLogger : Module(
|
||||||
is TileEntityDropper -> droppers++
|
is TileEntityDropper -> droppers++
|
||||||
is TileEntityDispenser -> dispensers++
|
is TileEntityDispenser -> dispensers++
|
||||||
is TileEntityHopper -> hoppers++
|
is TileEntityHopper -> hoppers++
|
||||||
|
else -> return
|
||||||
}
|
}
|
||||||
|
|
||||||
tileEntities.add(tileEntity)
|
tileEntities.add(tileEntity)
|
||||||
|
|
Loading…
Reference in New Issue