mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-15 10:25:06 -04:00
port to kutil 1.27
This update has some qol updates and a lot of juicy performance updates. Locking now uses javas integrated ReentrantLock which is 10 times faster than the synchronized lock (benchmarked it). Due to minosofts async nature, a lot of locking is needed (especially for time critical parts like in rendering). Locking is already reduced to a minimum, but it should still give a small performance boost. (more ports in there)
This commit is contained in:
parent
6659a0fef9
commit
b2480980e9
@ -1,6 +1,6 @@
|
||||
#
|
||||
# Minosoft
|
||||
# Copyright (C) 2020-2024 Moritz Zwerger
|
||||
# Copyright (C) 2020-2025 Moritz Zwerger
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
#
|
||||
@ -17,5 +17,5 @@ lwjgl.version=3.3.5
|
||||
ikonli.version=12.3.1
|
||||
netty.version=4.1.115.Final
|
||||
jackson.version=2.18.2
|
||||
kutil.version=1.26.5
|
||||
kutil.version=1.27.0
|
||||
glm.version=0.9.9.1-12
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2024 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -14,7 +14,7 @@
|
||||
package de.bixilon.minosoft.data.world.chunk
|
||||
|
||||
import de.bixilon.kotlinglm.vec2.Vec2i
|
||||
import de.bixilon.kutil.concurrent.lock.thread.ThreadLock
|
||||
import de.bixilon.kutil.concurrent.lock.locks.reentrant.ReentrantRWLock
|
||||
import de.bixilon.kutil.observer.DataObserver
|
||||
import de.bixilon.kutil.reflection.ReflectionUtil.forceSet
|
||||
import de.bixilon.kutil.reflection.ReflectionUtil.jvmField
|
||||
@ -66,7 +66,7 @@ object LightTestingUtil {
|
||||
fun createEmptyChunk(position: ChunkPosition): Chunk {
|
||||
val objenesis = ObjenesisStd()
|
||||
val chunk = objenesis.newInstance(Chunk::class.java)
|
||||
chunk::lock.forceSet(ThreadLock())
|
||||
chunk::lock.forceSet(ReentrantRWLock())
|
||||
chunk::chunkPosition.forceSet(position)
|
||||
chunk::world.forceSet(world)
|
||||
chunk::maxSection.forceSet(chunk.world.dimension.maxSection)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -13,7 +13,6 @@
|
||||
|
||||
package de.bixilon.minosoft.config.profile.test
|
||||
|
||||
import de.bixilon.kutil.concurrent.lock.Lock
|
||||
import de.bixilon.minosoft.config.profile.ProfileLock
|
||||
import de.bixilon.minosoft.config.profile.ProfileType
|
||||
import de.bixilon.minosoft.config.profile.delegate.primitive.IntDelegate
|
||||
@ -24,7 +23,7 @@ import de.bixilon.minosoft.data.registries.identified.Namespaces.minosoft
|
||||
|
||||
class TestProfile(
|
||||
override var storage: ProfileStorage? = null,
|
||||
override val lock: Lock = ProfileLock(),
|
||||
override val lock: ProfileLock = ProfileLock(),
|
||||
) : Profile {
|
||||
val config = ConfigC(this)
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2024 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -15,7 +15,7 @@ package de.bixilon.minosoft.data.world
|
||||
|
||||
import de.bixilon.kotlinglm.vec2.Vec2i
|
||||
import de.bixilon.kotlinglm.vec3.Vec3i
|
||||
import de.bixilon.kutil.concurrent.lock.simple.SimpleLock
|
||||
import de.bixilon.kutil.concurrent.lock.RWLock
|
||||
import de.bixilon.kutil.observer.DataObserver
|
||||
import de.bixilon.kutil.reflection.ReflectionUtil.forceSet
|
||||
import de.bixilon.kutil.reflection.ReflectionUtil.getFieldOrNull
|
||||
@ -44,7 +44,7 @@ object WorldTestUtil {
|
||||
fun createWorld(session: PlaySession?, light: Boolean = false, capacity: Int = 0): World {
|
||||
val world = IT.OBJENESIS.newInstance(World::class.java)
|
||||
world::occlusion.forceSet(DataObserver(0))
|
||||
world::lock.forceSet(SimpleLock())
|
||||
world::lock.forceSet(RWLock.rwlock())
|
||||
world::chunks.forceSet(ChunkManager(world, maxOf(0, capacity), 0))
|
||||
world::border.forceSet(WorldBorder())
|
||||
world::dimension.forceSet(DataObserver(DimensionProperties(light = light, skyLight = light)))
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2024 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -14,7 +14,7 @@
|
||||
package de.bixilon.minosoft.data.world.chunk
|
||||
|
||||
import de.bixilon.kotlinglm.vec2.Vec2i
|
||||
import de.bixilon.kutil.concurrent.lock.thread.ThreadLock
|
||||
import de.bixilon.kutil.concurrent.lock.RWLock
|
||||
import de.bixilon.kutil.observer.DataObserver
|
||||
import de.bixilon.kutil.reflection.ReflectionUtil.forceSet
|
||||
import de.bixilon.kutil.reflection.ReflectionUtil.jvmField
|
||||
@ -57,7 +57,7 @@ object LightTestingUtil {
|
||||
fun createEmptyChunk(position: ChunkPosition): Chunk {
|
||||
val objenesis = ObjenesisStd()
|
||||
val chunk = objenesis.newInstance(Chunk::class.java)
|
||||
chunk::lock.forceSet(ThreadLock())
|
||||
chunk::lock.forceSet(RWLock.rwlock())
|
||||
chunk::chunkPosition.forceSet(position)
|
||||
chunk::world.forceSet(world)
|
||||
chunk::maxSection.forceSet(chunk.world.dimension.maxSection)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -13,6 +13,6 @@
|
||||
|
||||
package de.bixilon.minosoft.config.profile
|
||||
|
||||
import de.bixilon.kutil.concurrent.lock.thread.ThreadLock
|
||||
import de.bixilon.kutil.concurrent.lock.locks.reentrant.ReentrantRWLock
|
||||
|
||||
typealias ProfileLock = ThreadLock
|
||||
typealias ProfileLock = ReentrantRWLock
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -14,10 +14,10 @@
|
||||
package de.bixilon.minosoft.config.profile.profiles
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||
import de.bixilon.kutil.concurrent.lock.Lock
|
||||
import de.bixilon.minosoft.config.profile.ProfileLock
|
||||
import de.bixilon.minosoft.config.profile.storage.ProfileStorage
|
||||
|
||||
interface Profile {
|
||||
@get:JsonIgnore var storage: ProfileStorage?
|
||||
@get:JsonIgnore val lock: Lock
|
||||
@get:JsonIgnore val lock: ProfileLock
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2024 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -15,7 +15,7 @@ package de.bixilon.minosoft.config.profile.storage
|
||||
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.kutil.concurrent.lock.simple.SimpleLock
|
||||
import de.bixilon.kutil.concurrent.lock.Lock
|
||||
import de.bixilon.kutil.exception.ExceptionUtil.ignoreAll
|
||||
import de.bixilon.kutil.latch.SimpleLatch
|
||||
import de.bixilon.minosoft.config.profile.profiles.Profile
|
||||
@ -27,7 +27,7 @@ import de.bixilon.minosoft.util.logging.LogMessageType
|
||||
import java.io.FileInputStream
|
||||
|
||||
object ProfileIOManager {
|
||||
private val lock = SimpleLock()
|
||||
private val lock = Lock.lock()
|
||||
private val notify = SimpleLatch(0)
|
||||
private val save: MutableSet<FileStorage> = mutableSetOf()
|
||||
private val delete: MutableSet<FileStorage> = mutableSetOf()
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2024 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -20,7 +20,7 @@ import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeNull
|
||||
import de.bixilon.kutil.collections.CollectionUtil.mutableBiMapOf
|
||||
import de.bixilon.kutil.collections.map.bi.AbstractMutableBiMap
|
||||
import de.bixilon.kutil.concurrent.lock.simple.SimpleLock
|
||||
import de.bixilon.kutil.concurrent.lock.RWLock
|
||||
import de.bixilon.kutil.exception.Broken
|
||||
import de.bixilon.kutil.file.FileUtil.mkdirParent
|
||||
import de.bixilon.kutil.file.watcher.FileWatcherService
|
||||
@ -57,7 +57,7 @@ abstract class StorageProfileManager<P : Profile> : Iterable<P>, Identified {
|
||||
abstract val type: ProfileType<P>
|
||||
|
||||
|
||||
private val lock = SimpleLock()
|
||||
private val lock = RWLock.rwlock()
|
||||
val profiles: AbstractMutableBiMap<String, P> by observedBiMap(mutableBiMapOf())
|
||||
var selected: P by observed(unsafeNull())
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -16,7 +16,7 @@ package de.bixilon.minosoft.data.accounts.types.microsoft
|
||||
import com.fasterxml.jackson.annotation.JacksonInject
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import de.bixilon.kutil.concurrent.lock.simple.SimpleLock
|
||||
import de.bixilon.kutil.concurrent.lock.Lock
|
||||
import de.bixilon.kutil.exception.Broken
|
||||
import de.bixilon.kutil.latch.AbstractLatch
|
||||
import de.bixilon.kutil.latch.AbstractLatch.Companion.child
|
||||
@ -52,7 +52,7 @@ class MicrosoftAccount(
|
||||
override val type: ResourceLocation = identifier
|
||||
|
||||
@JsonIgnore
|
||||
private val keyLock = SimpleLock()
|
||||
private val keyLock = Lock.lock()
|
||||
|
||||
@Synchronized
|
||||
override fun join(serverId: String) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2024 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
package de.bixilon.minosoft.data.container
|
||||
|
||||
import de.bixilon.kutil.concurrent.lock.thread.ThreadLock
|
||||
import de.bixilon.kutil.concurrent.lock.locks.reentrant.ReentrantRWLock
|
||||
import de.bixilon.kutil.observer.DataObserver.Companion.observe
|
||||
import de.bixilon.kutil.observer.DataObserver.Companion.observed
|
||||
import de.bixilon.kutil.observer.map.MapObserver.Companion.observedMap
|
||||
@ -39,7 +39,7 @@ abstract class Container(
|
||||
) : Iterable<Map.Entry<Int, ItemStack>> {
|
||||
@Deprecated("Should not be accessed directly")
|
||||
val slots: MutableMap<Int, ItemStack> by observedMap(Int2ObjectOpenHashMap())
|
||||
val lock = ThreadLock()
|
||||
val lock = ReentrantRWLock()
|
||||
var propertiesRevision by observed(0L)
|
||||
var revision by observed(0L)
|
||||
var serverRevision = 0
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2024 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -12,8 +12,8 @@
|
||||
*/
|
||||
package de.bixilon.minosoft.data.container.stack
|
||||
|
||||
import de.bixilon.kutil.concurrent.lock.simple.ParentLock
|
||||
import de.bixilon.kutil.concurrent.lock.thread.ThreadLock
|
||||
import de.bixilon.kutil.concurrent.lock.locks.ParentLock
|
||||
import de.bixilon.kutil.concurrent.lock.locks.reentrant.ReentrantRWLock
|
||||
import de.bixilon.kutil.json.JsonObject
|
||||
import de.bixilon.kutil.json.MutableJsonObject
|
||||
import de.bixilon.kutil.observer.DataObserver.Companion.observed
|
||||
@ -28,7 +28,7 @@ import de.bixilon.minosoft.protocol.network.session.play.PlaySession
|
||||
import java.util.*
|
||||
|
||||
class ItemStack {
|
||||
val lock = ParentLock(lock = ThreadLock())
|
||||
val lock = ParentLock(lock = ReentrantRWLock())
|
||||
val item: ItemProperty
|
||||
var holder: HolderProperty? = null
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2024 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -16,7 +16,7 @@ package de.bixilon.minosoft.data.entities.data
|
||||
import de.bixilon.kutil.bit.BitByte.isBitMask
|
||||
import de.bixilon.kutil.cast.CastUtil.cast
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.kutil.concurrent.lock.simple.SimpleLock
|
||||
import de.bixilon.kutil.concurrent.lock.RWLock
|
||||
import de.bixilon.minosoft.data.text.ChatComponent
|
||||
import de.bixilon.minosoft.protocol.network.session.play.PlaySession
|
||||
import de.bixilon.minosoft.util.logging.Log
|
||||
@ -28,10 +28,10 @@ class EntityData(
|
||||
val session: PlaySession,
|
||||
data: Int2ObjectOpenHashMap<Any?>? = null,
|
||||
) {
|
||||
private val lock = SimpleLock()
|
||||
private val lock = RWLock.rwlock()
|
||||
private val data: Int2ObjectOpenHashMap<Any> = Int2ObjectOpenHashMap()
|
||||
private val observers: Int2ObjectOpenHashMap<MutableSet<(Any?) -> Unit>> = Int2ObjectOpenHashMap()
|
||||
private val observersLock = SimpleLock()
|
||||
private val observersLock = RWLock.rwlock()
|
||||
|
||||
init {
|
||||
data?.let { merge(it) }
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2024 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -14,7 +14,7 @@
|
||||
package de.bixilon.minosoft.data.entities.entities.player.local
|
||||
|
||||
import de.bixilon.kutil.cast.CastUtil.nullCast
|
||||
import de.bixilon.kutil.concurrent.lock.simple.SimpleLock
|
||||
import de.bixilon.kutil.concurrent.lock.RWLock
|
||||
import de.bixilon.kutil.concurrent.schedule.TaskScheduler.runLater
|
||||
import de.bixilon.kutil.latch.AbstractLatch
|
||||
import de.bixilon.kutil.time.TimeUtil.millis
|
||||
@ -36,7 +36,7 @@ class SignatureKeyManagement(
|
||||
val session: PlaySession,
|
||||
val account: Account,
|
||||
) {
|
||||
private val lock = SimpleLock()
|
||||
private val lock = RWLock.rwlock()
|
||||
|
||||
var key: PlayerPrivateKey? = null
|
||||
private set
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2024 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -14,10 +14,9 @@ package de.bixilon.minosoft.data.world
|
||||
|
||||
import de.bixilon.kotlinglm.vec2.Vec2i
|
||||
import de.bixilon.kotlinglm.vec3.Vec3i
|
||||
import de.bixilon.kutil.concurrent.lock.simple.SimpleLock
|
||||
import de.bixilon.kutil.concurrent.lock.RWLock
|
||||
import de.bixilon.kutil.concurrent.worker.unconditional.UnconditionalWorker
|
||||
import de.bixilon.kutil.observer.DataObserver.Companion.observed
|
||||
import de.bixilon.kutil.random.RandomUtil.nextInt
|
||||
import de.bixilon.minosoft.data.entities.block.BlockEntity
|
||||
import de.bixilon.minosoft.data.entities.entities.Entity
|
||||
import de.bixilon.minosoft.data.registries.blocks.state.BlockState
|
||||
@ -55,7 +54,7 @@ import java.util.*
|
||||
class World(
|
||||
val session: PlaySession,
|
||||
) : WorldAudioPlayer {
|
||||
val lock = SimpleLock()
|
||||
val lock = RWLock.rwlock()
|
||||
val random = Random()
|
||||
val biomes = WorldBiomes(this)
|
||||
val chunks = ChunkManager(this, 1000, 100)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2024 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -14,7 +14,7 @@ package de.bixilon.minosoft.data.world.chunk.chunk
|
||||
|
||||
import de.bixilon.kotlinglm.vec2.Vec2i
|
||||
import de.bixilon.kotlinglm.vec3.Vec3i
|
||||
import de.bixilon.kutil.concurrent.lock.thread.ThreadLock
|
||||
import de.bixilon.kutil.concurrent.lock.RWLock
|
||||
import de.bixilon.kutil.math.simple.IntMath.clamp
|
||||
import de.bixilon.minosoft.data.direction.Directions
|
||||
import de.bixilon.minosoft.data.entities.block.BlockEntity
|
||||
@ -45,7 +45,7 @@ class Chunk(
|
||||
val chunkPosition: ChunkPosition,
|
||||
var biomeSource: BiomeSource,
|
||||
) : Iterable<ChunkSection?>, BiomeAccessor {
|
||||
val lock = ThreadLock()
|
||||
val lock = RWLock.rwlock()
|
||||
val world = session.world
|
||||
val light = ChunkLight(this)
|
||||
val minSection = world.dimension.minSection
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2024 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -14,7 +14,7 @@
|
||||
package de.bixilon.minosoft.data.world.entities
|
||||
|
||||
import de.bixilon.kotlinglm.vec3.Vec3d
|
||||
import de.bixilon.kutil.concurrent.lock.simple.SimpleLock
|
||||
import de.bixilon.kutil.concurrent.lock.RWLock
|
||||
import de.bixilon.kutil.observer.set.SetObserver.Companion.observedSet
|
||||
import de.bixilon.minosoft.data.abilities.Gamemodes
|
||||
import de.bixilon.minosoft.data.entities.entities.Entity
|
||||
@ -34,7 +34,7 @@ class WorldEntities : Iterable<Entity> {
|
||||
val entities: MutableSet<Entity> by observedSet(mutableSetOf())
|
||||
private val ticker = EntityTicker(this)
|
||||
|
||||
val lock = SimpleLock()
|
||||
val lock = RWLock.rwlock()
|
||||
|
||||
val size: Int
|
||||
get() = entities.size
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -13,13 +13,13 @@
|
||||
|
||||
package de.bixilon.minosoft.gui.eros.util
|
||||
|
||||
import de.bixilon.kutil.concurrent.lock.simple.SimpleLock
|
||||
import de.bixilon.kutil.concurrent.lock.Lock
|
||||
import javafx.stage.Stage
|
||||
import java.lang.ref.WeakReference
|
||||
|
||||
class StageList : Iterable<Stage?> {
|
||||
private val stages: MutableList<WeakReference<Stage>> = mutableListOf()
|
||||
val lock = SimpleLock()
|
||||
val lock = Lock.lock()
|
||||
|
||||
private fun <T> MutableList<WeakReference<T>>.cleanup() {
|
||||
val iterator = this.iterator()
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -16,6 +16,7 @@ package de.bixilon.minosoft.gui.rendering
|
||||
import de.bixilon.minosoft.data.registries.identified.Namespaces.minosoft
|
||||
import de.bixilon.minosoft.data.text.formatting.color.RGBColor
|
||||
import de.bixilon.minosoft.gui.rendering.textures.TextureUtil.texture
|
||||
import kotlin.time.Duration.Companion.milliseconds
|
||||
|
||||
object RenderConstants {
|
||||
val TEXT_BACKGROUND_COLOR = RGBColor(0, 0, 0, 80)
|
||||
@ -25,7 +26,7 @@ object RenderConstants {
|
||||
const val OCCLUSION_CULLING_ENABLED = true
|
||||
const val SHOW_FPS_IN_WINDOW_TITLE = true
|
||||
|
||||
const val MAXIMUM_QUEUE_TIME_PER_FRAME = 20L
|
||||
val MAXIMUM_QUEUE_TIME_PER_FRAME = 20.milliseconds
|
||||
|
||||
|
||||
val DEBUG_TEXTURE_RESOURCE_LOCATION = minosoft("debug").texture()
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2024 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -19,7 +19,7 @@ import de.bixilon.kotlinglm.func.rad
|
||||
import de.bixilon.kotlinglm.mat4x4.Mat4
|
||||
import de.bixilon.kotlinglm.vec2.Vec2
|
||||
import de.bixilon.kotlinglm.vec3.Vec3
|
||||
import de.bixilon.kutil.avg.FloatAverage
|
||||
import de.bixilon.kutil.avg._float.FloatAverage
|
||||
import de.bixilon.minosoft.gui.rendering.RenderContext
|
||||
import de.bixilon.minosoft.gui.rendering.camera.CameraDefinition.CAMERA_UP_VEC3
|
||||
import de.bixilon.minosoft.gui.rendering.camera.CameraDefinition.NEAR_PLANE
|
||||
@ -36,6 +36,7 @@ import de.bixilon.minosoft.gui.rendering.util.vec.vec3.Vec3iUtil.chunkPosition
|
||||
import de.bixilon.minosoft.gui.rendering.util.vec.vec3.Vec3iUtil.sectionHeight
|
||||
import de.bixilon.minosoft.modding.event.listener.CallbackEventListener.Companion.listen
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolDefinition
|
||||
import kotlin.time.Duration.Companion.milliseconds
|
||||
|
||||
class MatrixHandler(
|
||||
private val context: RenderContext,
|
||||
@ -68,7 +69,7 @@ class MatrixHandler(
|
||||
var viewProjectionMatrix = projectionMatrix * viewMatrix
|
||||
private set
|
||||
|
||||
private var dynamicFOV = FloatAverage(3 * ProtocolDefinition.TICK_TIME * 1_000_000L, 1.0f)
|
||||
private var dynamicFOV = FloatAverage((3 * ProtocolDefinition.TICK_TIME).milliseconds, 1.0f)
|
||||
|
||||
private fun calculateFOV(): Float {
|
||||
var fov = profile.fov
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2024 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -16,7 +16,7 @@ package de.bixilon.minosoft.gui.rendering.camera.shaking
|
||||
import de.bixilon.kotlinglm.mat4x4.Mat4
|
||||
import de.bixilon.kotlinglm.vec3.Vec3
|
||||
import de.bixilon.kotlinglm.vec3.swizzle.xz
|
||||
import de.bixilon.kutil.avg.FloatAverage
|
||||
import de.bixilon.kutil.avg._float.FloatAverage
|
||||
import de.bixilon.kutil.math.Trigonometry.sin
|
||||
import de.bixilon.kutil.time.TimeUtil.millis
|
||||
import de.bixilon.minosoft.config.profile.profiles.rendering.camera.shaking.ShakingC
|
||||
@ -24,14 +24,15 @@ import de.bixilon.minosoft.gui.rendering.camera.Camera
|
||||
import de.bixilon.minosoft.gui.rendering.renderer.drawable.Drawable
|
||||
import de.bixilon.minosoft.gui.rendering.util.vec.vec3.Vec3Util.Z
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolDefinition
|
||||
import kotlin.time.Duration.Companion.milliseconds
|
||||
|
||||
class CameraShaking(
|
||||
private val camera: Camera,
|
||||
private val profile: ShakingC,
|
||||
) : Drawable {
|
||||
private var rotation = 0.0f
|
||||
private var strength = FloatAverage(5 * ProtocolDefinition.TICK_TIME * 1_000_000L, 1.0f)
|
||||
private val speed = FloatAverage(5 * ProtocolDefinition.TICK_TIME * 1_000_000L, 0.0f)
|
||||
private var strength = FloatAverage((5 * ProtocolDefinition.TICK_TIME).milliseconds, 1.0f)
|
||||
private val speed = FloatAverage((5 * ProtocolDefinition.TICK_TIME).milliseconds, 0.0f)
|
||||
|
||||
val isEmpty: Boolean get() = rotation == 0.0f
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2024 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -15,7 +15,7 @@ package de.bixilon.minosoft.gui.rendering.chunk
|
||||
|
||||
import de.bixilon.kotlinglm.vec2.Vec2i
|
||||
import de.bixilon.kotlinglm.vec3.Vec3
|
||||
import de.bixilon.kutil.concurrent.lock.simple.SimpleLock
|
||||
import de.bixilon.kutil.concurrent.lock.RWLock
|
||||
import de.bixilon.kutil.latch.AbstractLatch
|
||||
import de.bixilon.kutil.observer.DataObserver.Companion.observe
|
||||
import de.bixilon.minosoft.config.key.KeyActions
|
||||
@ -63,7 +63,7 @@ class ChunkRenderer(
|
||||
val visibilityGraph = context.camera.visibilityGraph
|
||||
private val shader = renderSystem.createShader(minosoft("chunk")) { ChunkShader(it) }
|
||||
private val textShader = renderSystem.createShader(minosoft("chunk")) { ChunkShader(it) }
|
||||
val lock = SimpleLock()
|
||||
val lock = RWLock.rwlock()
|
||||
val world: World = session.world
|
||||
|
||||
val loaded = LoadedMeshes(this)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -14,7 +14,7 @@
|
||||
package de.bixilon.minosoft.gui.rendering.chunk
|
||||
|
||||
import de.bixilon.kotlinglm.vec2.Vec2i
|
||||
import de.bixilon.kutil.concurrent.lock.simple.SimpleLock
|
||||
import de.bixilon.kutil.concurrent.lock.RWLock
|
||||
import de.bixilon.minosoft.data.world.positions.ChunkPosition
|
||||
import de.bixilon.minosoft.gui.rendering.chunk.mesh.ChunkMeshes
|
||||
import de.bixilon.minosoft.gui.rendering.chunk.mesh.VisibleMeshes
|
||||
@ -24,7 +24,7 @@ class LoadedMeshes(
|
||||
private val renderer: ChunkRenderer,
|
||||
) {
|
||||
val meshes: MutableMap<Vec2i, Int2ObjectOpenHashMap<ChunkMeshes>> = hashMapOf() // all prepared (and up to date) meshes
|
||||
private val lock = SimpleLock()
|
||||
private val lock = RWLock.rwlock()
|
||||
|
||||
|
||||
val size: Int get() = meshes.size
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -14,7 +14,7 @@
|
||||
package de.bixilon.minosoft.gui.rendering.chunk.queue
|
||||
|
||||
import de.bixilon.kotlinglm.vec2.Vec2i
|
||||
import de.bixilon.kutil.concurrent.lock.simple.SimpleLock
|
||||
import de.bixilon.kutil.concurrent.lock.RWLock
|
||||
import de.bixilon.minosoft.data.world.chunk.chunk.Chunk
|
||||
import de.bixilon.minosoft.data.world.positions.ChunkPosition
|
||||
import de.bixilon.minosoft.data.world.positions.SectionHeight
|
||||
@ -25,7 +25,7 @@ class CulledQueue(
|
||||
private val renderer: ChunkRenderer,
|
||||
) {
|
||||
private val queue: MutableMap<Vec2i, IntOpenHashSet> = mutableMapOf() // Chunk sections that can be prepared or have changed, but are not required to get rendered yet (i.e. culled chunks)
|
||||
private val lock = SimpleLock()
|
||||
private val lock = RWLock.rwlock()
|
||||
|
||||
val size: Int get() = queue.size
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -14,7 +14,7 @@
|
||||
package de.bixilon.minosoft.gui.rendering.chunk.queue.loading
|
||||
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeNull
|
||||
import de.bixilon.kutil.concurrent.lock.simple.SimpleLock
|
||||
import de.bixilon.kutil.concurrent.lock.Lock
|
||||
import de.bixilon.kutil.time.TimeUtil
|
||||
import de.bixilon.minosoft.data.world.positions.ChunkPosition
|
||||
import de.bixilon.minosoft.gui.rendering.chunk.ChunkRenderer
|
||||
@ -28,7 +28,7 @@ class MeshLoadingQueue(
|
||||
) {
|
||||
private val meshes: MutableList<ChunkMeshes> = mutableListOf() // prepared meshes, that can be loaded in the (next) frame
|
||||
private val positions: MutableSet<QueuePosition> = HashSet()
|
||||
private val lock = SimpleLock()
|
||||
private val lock = Lock.lock()
|
||||
|
||||
val size: Int get() = meshes.size
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2024 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
package de.bixilon.minosoft.gui.rendering.chunk.queue.loading
|
||||
|
||||
import de.bixilon.kutil.concurrent.lock.simple.SimpleLock
|
||||
import de.bixilon.kutil.concurrent.lock.Lock
|
||||
import de.bixilon.kutil.time.TimeUtil
|
||||
import de.bixilon.minosoft.gui.rendering.chunk.ChunkRenderer
|
||||
import de.bixilon.minosoft.gui.rendering.chunk.mesh.ChunkMeshes
|
||||
@ -25,7 +25,7 @@ class MeshUnloadingQueue(
|
||||
) {
|
||||
private val meshes: MutableList<ChunkMeshes> = mutableListOf() // prepared meshes, that can be loaded in the (next) frame
|
||||
private val positions: MutableSet<QueuePosition> = mutableSetOf()
|
||||
private val lock = SimpleLock()
|
||||
private val lock = Lock.lock()
|
||||
|
||||
|
||||
private fun forceWork() {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -14,7 +14,7 @@
|
||||
package de.bixilon.minosoft.gui.rendering.chunk.queue.meshing
|
||||
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.kutil.concurrent.lock.simple.SimpleLock
|
||||
import de.bixilon.kutil.concurrent.lock.Lock
|
||||
import de.bixilon.kutil.concurrent.pool.ThreadPool
|
||||
import de.bixilon.kutil.concurrent.pool.runnable.HeavyPoolRunnable
|
||||
import de.bixilon.minosoft.data.world.positions.ChunkPosition
|
||||
@ -37,7 +37,7 @@ class ChunkMeshingQueue(
|
||||
private val queue: MutableList<WorldQueueItem> = ArrayList()
|
||||
private val set: MutableSet<WorldQueueItem> = HashSet()
|
||||
|
||||
private val lock = SimpleLock()
|
||||
private val lock = Lock.lock()
|
||||
|
||||
|
||||
val size: Int get() = queue.size
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
package de.bixilon.minosoft.gui.rendering.chunk.queue.meshing.tasks
|
||||
|
||||
import de.bixilon.kutil.concurrent.lock.simple.SimpleLock
|
||||
import de.bixilon.kutil.concurrent.lock.RWLock
|
||||
import de.bixilon.kutil.concurrent.pool.DefaultThreadPool
|
||||
import de.bixilon.minosoft.data.world.positions.ChunkPosition
|
||||
import de.bixilon.minosoft.data.world.positions.SectionHeight
|
||||
@ -24,7 +24,7 @@ class MeshPrepareTaskManager(
|
||||
val max: Int = maxOf(minOf(Runtime.getRuntime().availableProcessors() - 1, DefaultThreadPool.threadCount - 1), 1)
|
||||
) {
|
||||
private val tasks: MutableSet<MeshPrepareTask> = mutableSetOf() // current running section preparing tasks
|
||||
private val lock = SimpleLock()
|
||||
private val lock = RWLock.rwlock()
|
||||
|
||||
val size: Int get() = tasks.size
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2024 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -16,7 +16,7 @@ package de.bixilon.minosoft.gui.rendering.entities
|
||||
import de.bixilon.kutil.cast.CastUtil.nullCast
|
||||
import de.bixilon.kutil.collections.map.LockMap
|
||||
import de.bixilon.kutil.collections.spliterator.async.ConcurrentSpliterator
|
||||
import de.bixilon.kutil.concurrent.lock.simple.SimpleLock
|
||||
import de.bixilon.kutil.concurrent.lock.RWLock
|
||||
import de.bixilon.kutil.concurrent.pool.ThreadPool
|
||||
import de.bixilon.kutil.exception.ExceptionUtil.ignoreAll
|
||||
import de.bixilon.kutil.observer.set.SetObserver.Companion.observeSet
|
||||
@ -30,7 +30,7 @@ import de.bixilon.minosoft.util.logging.LogLevels
|
||||
import de.bixilon.minosoft.util.logging.LogMessageType
|
||||
|
||||
class EntityRendererManager(val renderer: EntitiesRenderer) : Iterable<EntityRenderer<*>> {
|
||||
val lock = SimpleLock()
|
||||
val lock = RWLock.rwlock()
|
||||
private val renderers: LockMap<Entity, EntityRenderer<*>> = LockMap(HashMap(), lock)
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2024 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
package de.bixilon.minosoft.gui.rendering.entities.visibility
|
||||
|
||||
import de.bixilon.kutil.concurrent.lock.simple.SimpleLock
|
||||
import de.bixilon.kutil.concurrent.lock.Lock
|
||||
import de.bixilon.kutil.observer.DataObserver.Companion.observe
|
||||
import de.bixilon.minosoft.data.world.view.ViewDistanceChangeEvent
|
||||
import de.bixilon.minosoft.gui.rendering.entities.EntitiesRenderer
|
||||
@ -36,7 +36,7 @@ class VisibilityManager(val renderer: EntitiesRenderer) {
|
||||
|
||||
val opaque: ArrayList<EntityRenderFeature> = ArrayList(1000)
|
||||
val translucent: ArrayList<EntityRenderFeature> = ArrayList(1000)
|
||||
private val lock = SimpleLock()
|
||||
private val lock = Lock.lock()
|
||||
private val graph = renderer.context.camera.visibilityGraph
|
||||
private val frustum = renderer.context.camera.matrixHandler.frustum
|
||||
private var renderDistance = 0
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2024 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -13,18 +13,19 @@
|
||||
|
||||
package de.bixilon.minosoft.gui.rendering.framebuffer.world.overlay.overlays.simple
|
||||
|
||||
import de.bixilon.kutil.avg.FloatAverage
|
||||
import de.bixilon.kutil.avg._float.FloatAverage
|
||||
import de.bixilon.minosoft.data.text.formatting.color.RGBColor
|
||||
import de.bixilon.minosoft.gui.rendering.RenderContext
|
||||
import de.bixilon.minosoft.gui.rendering.framebuffer.world.overlay.OverlayFactory
|
||||
import de.bixilon.minosoft.gui.rendering.system.base.texture.texture.Texture
|
||||
import de.bixilon.minosoft.gui.rendering.textures.TextureUtil.texture
|
||||
import de.bixilon.minosoft.util.KUtil.toResourceLocation
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
|
||||
class PowderSnowOverlay(context: RenderContext) : SimpleOverlay(context) {
|
||||
private val config = context.session.profiles.rendering.overlay
|
||||
override val texture: Texture = context.textures.static.create(OVERLAY_TEXTURE)
|
||||
private val strength = FloatAverage(1L * 1000000000L, 0.0f)
|
||||
private val strength = FloatAverage(1.seconds, 0.0f)
|
||||
override var render: Boolean = false
|
||||
get() = config.powderSnow && field
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -15,7 +15,7 @@ package de.bixilon.minosoft.gui.rendering.gui.gui
|
||||
|
||||
import de.bixilon.kotlinglm.vec2.Vec2
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.kutil.concurrent.lock.simple.SimpleLock
|
||||
import de.bixilon.kutil.concurrent.lock.locks.reentrant.ReentrantRWLock
|
||||
import de.bixilon.kutil.concurrent.pool.DefaultThreadPool
|
||||
import de.bixilon.kutil.latch.SimpleLatch
|
||||
import de.bixilon.kutil.time.TimeUtil.millis
|
||||
@ -49,7 +49,7 @@ class GUIManager(
|
||||
private val guiRenderer: GUIRenderer,
|
||||
) : Initializable, InputHandler, DraggableHandler, Drawable, AsyncDrawable {
|
||||
private val elementCache: MutableMap<GUIBuilder<*>, GUIElement> = mutableMapOf()
|
||||
private var orderLock = SimpleLock()
|
||||
private var orderLock = ReentrantRWLock()
|
||||
var elementOrder: MutableList<GUIElement> = mutableListOf()
|
||||
private val context = guiRenderer.context
|
||||
private var lastTickTime: Long = -1L
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -13,12 +13,12 @@
|
||||
|
||||
package de.bixilon.minosoft.gui.rendering.particle
|
||||
|
||||
import de.bixilon.kutil.concurrent.lock.simple.SimpleLock
|
||||
import de.bixilon.kutil.concurrent.lock.Lock
|
||||
import de.bixilon.minosoft.gui.rendering.particle.types.Particle
|
||||
|
||||
class ParticleList(maxAmount: Int) {
|
||||
val particles: MutableList<Particle> = ArrayList(maxAmount)
|
||||
val lock = SimpleLock()
|
||||
val lock = Lock.lock()
|
||||
|
||||
val size get() = particles.size
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -13,11 +13,11 @@
|
||||
|
||||
package de.bixilon.minosoft.gui.rendering.particle
|
||||
|
||||
import de.bixilon.kutil.concurrent.lock.simple.SimpleLock
|
||||
import de.bixilon.kutil.concurrent.lock.Lock
|
||||
import de.bixilon.minosoft.gui.rendering.particle.types.Particle
|
||||
|
||||
class ParticleQueue(val renderer: ParticleRenderer) {
|
||||
private val lock = SimpleLock()
|
||||
private val lock = Lock.lock()
|
||||
private val queue: MutableList<Particle> = ArrayList(QUEUE_CAPACITY)
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -13,14 +13,14 @@
|
||||
|
||||
package de.bixilon.minosoft.gui.rendering.skeletal.instance
|
||||
|
||||
import de.bixilon.kutil.concurrent.lock.simple.SimpleLock
|
||||
import de.bixilon.kutil.concurrent.lock.Lock
|
||||
import de.bixilon.kutil.time.TimeUtil.millis
|
||||
import de.bixilon.minosoft.gui.rendering.skeletal.baked.animation.AbstractAnimation
|
||||
import de.bixilon.minosoft.gui.rendering.skeletal.baked.animation.keyframe.instance.KeyframeInstance.Companion.OVER
|
||||
|
||||
class AnimationManager(val instance: SkeletalInstance) {
|
||||
private val playing: MutableMap<String, AbstractAnimation> = mutableMapOf()
|
||||
private val lock = SimpleLock()
|
||||
private val lock = Lock.lock()
|
||||
private var lastDraw = -1L
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2024 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -40,6 +40,7 @@ import org.lwjgl.openal.EXTThreadLocalContext.alcSetThreadContext
|
||||
import org.lwjgl.system.MemoryUtil
|
||||
import java.nio.ByteBuffer
|
||||
import java.nio.IntBuffer
|
||||
import kotlin.time.Duration.Companion.milliseconds
|
||||
|
||||
|
||||
class AudioPlayer(
|
||||
@ -234,7 +235,7 @@ class AudioPlayer(
|
||||
if (session.established || session.error != null) {
|
||||
break
|
||||
}
|
||||
queue.workBlocking(500L)
|
||||
queue.workBlocking(500.milliseconds)
|
||||
calculateAvailableSources()
|
||||
while (!enabled) {
|
||||
Thread.sleep(1L)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -13,11 +13,11 @@
|
||||
|
||||
package de.bixilon.minosoft.gui.rendering.stats
|
||||
|
||||
import de.bixilon.kutil.avg.Average
|
||||
import de.bixilon.kutil.avg._long.LongAverage
|
||||
|
||||
interface AbstractRenderStats {
|
||||
val avgDrawTime: Average<Long>
|
||||
val avgFrameTime: Average<Long>
|
||||
val avgDrawTime: LongAverage
|
||||
val avgFrameTime: LongAverage
|
||||
|
||||
val avgFPS: Double
|
||||
val smoothAvgFPS: Double
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -14,12 +14,10 @@
|
||||
package de.bixilon.minosoft.gui.rendering.stats
|
||||
|
||||
import de.bixilon.kotlinglm.func.common.clamp
|
||||
import de.bixilon.kutil.avg.Average
|
||||
import de.bixilon.kutil.avg.LongAverage
|
||||
import de.bixilon.kutil.random.RandomUtil.nextFloat
|
||||
import de.bixilon.kutil.random.RandomUtil.nextInt
|
||||
import de.bixilon.kutil.avg._long.LongAverage
|
||||
import de.bixilon.kutil.time.TimeUtil.millis
|
||||
import java.util.*
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
|
||||
class ExperimentalRenderStats : AbstractRenderStats {
|
||||
private val renderStats = RenderStats()
|
||||
@ -28,8 +26,8 @@ class ExperimentalRenderStats : AbstractRenderStats {
|
||||
private val baseMultiplier = random.nextFloat(1.0f, 1.5f)
|
||||
private val baseJitter = random.nextInt(0, 20)
|
||||
|
||||
override val avgFrameTime: Average<Long> = LongAverage(Long.MAX_VALUE)
|
||||
override val avgDrawTime: Average<Long> = LongAverage(Long.MAX_VALUE)
|
||||
override val avgFrameTime = LongAverage(3.seconds)
|
||||
override val avgDrawTime = LongAverage(3.seconds)
|
||||
|
||||
private var lastSmoothFPSCalculationTime = 0L
|
||||
override var smoothAvgFPS: Double = 0.0
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -13,12 +13,13 @@
|
||||
|
||||
package de.bixilon.minosoft.gui.rendering.stats
|
||||
|
||||
import de.bixilon.kutil.avg.LongAverage
|
||||
import de.bixilon.kutil.avg._long.LongAverage
|
||||
import de.bixilon.kutil.time.TimeUtil.millis
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
|
||||
class RenderStats : AbstractRenderStats {
|
||||
override val avgDrawTime: LongAverage = LongAverage(1L * 1000000000L, Long.MAX_VALUE) // 1 second * SECOND_SCALE
|
||||
override val avgFrameTime: LongAverage = LongAverage(1L * 1000000000L, Long.MAX_VALUE) // 1 second * SECOND_SCALE
|
||||
override val avgDrawTime = LongAverage(3.seconds, Long.MAX_VALUE)
|
||||
override val avgFrameTime = LongAverage(3.seconds, Long.MAX_VALUE)
|
||||
override var totalFrames: Long = 0L
|
||||
private set
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -14,7 +14,7 @@
|
||||
package de.bixilon.minosoft.gui.rendering.system.base.texture.array
|
||||
|
||||
import de.bixilon.kotlinglm.vec2.Vec2i
|
||||
import de.bixilon.kutil.concurrent.lock.simple.SimpleLock
|
||||
import de.bixilon.kutil.concurrent.lock.RWLock
|
||||
import de.bixilon.kutil.concurrent.pool.DefaultThreadPool
|
||||
import de.bixilon.kutil.concurrent.pool.ThreadPool
|
||||
import de.bixilon.kutil.concurrent.pool.runnable.ForcePooledRunnable
|
||||
@ -35,7 +35,7 @@ abstract class StaticTextureArray(
|
||||
) : TextureArray {
|
||||
protected val named: MutableMap<ResourceLocation, Texture> = mutableMapOf()
|
||||
protected val other: MutableSet<Texture> = mutableSetOf()
|
||||
private val lock = SimpleLock()
|
||||
private val lock = RWLock.rwlock()
|
||||
|
||||
val animator = SpriteAnimator(context)
|
||||
var state: TextureArrayStates = TextureArrayStates.DECLARED
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
package de.bixilon.minosoft.gui.rendering.system.base.texture.array.font
|
||||
|
||||
import de.bixilon.kutil.concurrent.lock.simple.SimpleLock
|
||||
import de.bixilon.kutil.concurrent.lock.Lock
|
||||
import de.bixilon.kutil.concurrent.pool.DefaultThreadPool
|
||||
import de.bixilon.kutil.concurrent.pool.ThreadPool.Priorities.HIGH
|
||||
import de.bixilon.kutil.concurrent.pool.runnable.ForcePooledRunnable
|
||||
@ -29,7 +29,7 @@ abstract class FontTextureArray(
|
||||
val compression: FontCompressions,
|
||||
) : TextureArray {
|
||||
protected val textures: MutableSet<Texture> = mutableSetOf()
|
||||
private val lock = SimpleLock()
|
||||
private val lock = Lock.lock()
|
||||
var state: TextureArrayStates = TextureArrayStates.DECLARED
|
||||
protected set
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -14,7 +14,7 @@
|
||||
package de.bixilon.minosoft.gui.rendering.system.base.texture.dynamic
|
||||
|
||||
import de.bixilon.kotlinglm.vec2.Vec2
|
||||
import de.bixilon.kutil.concurrent.lock.simple.SimpleLock
|
||||
import de.bixilon.kutil.concurrent.lock.RWLock
|
||||
import de.bixilon.kutil.exception.ExceptionUtil.ignoreAll
|
||||
import de.bixilon.minosoft.gui.rendering.system.base.texture.data.MipmapTextureData
|
||||
import de.bixilon.minosoft.gui.rendering.system.base.texture.shader.ShaderTexture
|
||||
@ -23,7 +23,7 @@ abstract class DynamicTexture(
|
||||
val identifier: Any,
|
||||
) : ShaderTexture {
|
||||
private val callbacks: MutableSet<DynamicTextureListener> = mutableSetOf()
|
||||
private val lock = SimpleLock()
|
||||
private val lock = RWLock.rwlock()
|
||||
|
||||
var data: MipmapTextureData? = null
|
||||
var state: DynamicTextureState = DynamicTextureState.WAITING
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
package de.bixilon.minosoft.gui.rendering.system.base.texture.dynamic
|
||||
|
||||
import de.bixilon.kutil.concurrent.lock.thread.ThreadLock
|
||||
import de.bixilon.kutil.concurrent.lock.locks.reentrant.ReentrantRWLock
|
||||
import de.bixilon.kutil.concurrent.pool.DefaultThreadPool
|
||||
import de.bixilon.kutil.concurrent.pool.runnable.ForcePooledRunnable
|
||||
import de.bixilon.kutil.latch.AbstractLatch
|
||||
@ -37,7 +37,7 @@ abstract class DynamicTextureArray(
|
||||
) : TextureArray {
|
||||
protected var textures: Array<WeakReference<DynamicTexture>?> = arrayOfNulls(initialSize)
|
||||
protected val shaders: MutableSet<NativeShader> = mutableSetOf()
|
||||
private val lock = ThreadLock()
|
||||
private val lock = ReentrantRWLock()
|
||||
private var reload = false
|
||||
|
||||
val capacity get() = textures.size
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2024 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -14,7 +14,6 @@
|
||||
package de.bixilon.minosoft.gui.rendering.system.opengl
|
||||
|
||||
import de.bixilon.kotlinglm.vec2.Vec2i
|
||||
import de.bixilon.kutil.concurrent.lock.thread.ThreadMissmatchException
|
||||
import de.bixilon.minosoft.data.registries.identified.ResourceLocation
|
||||
import de.bixilon.minosoft.data.text.formatting.color.Colors
|
||||
import de.bixilon.minosoft.data.text.formatting.color.RGBColor
|
||||
@ -307,7 +306,7 @@ class OpenGLRenderSystem(
|
||||
val thread = thread ?: throw IllegalStateException("Not yet initialized!")
|
||||
val current = Thread.currentThread()
|
||||
if (thread !== current) {
|
||||
throw ThreadMissmatchException(thread, current)
|
||||
throw Exception("Thread mismatch: thread=$thread, current=$current")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -14,7 +14,7 @@
|
||||
package de.bixilon.minosoft.modding.event.master
|
||||
|
||||
import de.bixilon.kutil.collections.CollectionUtil.toSynchronizedList
|
||||
import de.bixilon.kutil.concurrent.lock.simple.SimpleLock
|
||||
import de.bixilon.kutil.concurrent.lock.RWLock
|
||||
import de.bixilon.kutil.concurrent.worker.unconditional.UnconditionalWorker
|
||||
import de.bixilon.minosoft.modding.event.events.AsyncEvent
|
||||
import de.bixilon.minosoft.modding.event.events.CancelableEvent
|
||||
@ -26,9 +26,9 @@ import java.util.*
|
||||
|
||||
open class EventMaster(vararg parents: AbstractEventMaster) : AbstractEventMaster {
|
||||
private val parents: MutableSet<AbstractEventMaster> = mutableSetOf(*parents)
|
||||
private val parentLock = SimpleLock()
|
||||
private val parentLock = RWLock.rwlock()
|
||||
private val eventListeners: PriorityQueue<EventListener> = PriorityQueue()
|
||||
private val eventInvokerLock = SimpleLock()
|
||||
private val eventInvokerLock = RWLock.rwlock()
|
||||
|
||||
override val size: Int
|
||||
get() {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2024 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
package de.bixilon.minosoft.protocol.network
|
||||
|
||||
import de.bixilon.kutil.concurrent.lock.thread.ThreadLock
|
||||
import de.bixilon.kutil.concurrent.lock.RWLock
|
||||
import de.bixilon.kutil.observer.DataObserver
|
||||
import de.bixilon.kutil.observer.DataObserver.Companion.observe
|
||||
import de.bixilon.kutil.observer.DataObserver.Companion.observed
|
||||
@ -37,7 +37,7 @@ class NetworkConnection(
|
||||
override val identifier = address.toString()
|
||||
override var active by observed(false)
|
||||
private set
|
||||
var state: ProtocolStates? by DataObserver(null, ThreadLock())
|
||||
var state: ProtocolStates? by DataObserver(null, RWLock.rwlock())
|
||||
|
||||
init {
|
||||
this::state.observe(this) { active = it != null }
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -29,7 +29,7 @@ class PacketInflater(
|
||||
val buffer = InByteBuffer(data)
|
||||
|
||||
val uncompressedLength = buffer.readVarInt()
|
||||
val rest = buffer.readRest()
|
||||
val rest = buffer.readRemaining()
|
||||
if (uncompressedLength == 0) {
|
||||
out += rest
|
||||
return
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2024 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -36,7 +36,7 @@ class PacketDecoder(
|
||||
override fun decode(context: ChannelHandlerContext, array: ByteArray, out: MutableList<Any>) {
|
||||
val buffer = InByteBuffer(array)
|
||||
val packetId = buffer.readVarInt()
|
||||
val data = buffer.readRest()
|
||||
val data = buffer.readRemaining()
|
||||
|
||||
val state = client.connection.state ?: throw IllegalStateException("Not connected!")
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2024 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
package de.bixilon.minosoft.protocol.network.session.play.tick
|
||||
|
||||
import de.bixilon.kutil.concurrent.lock.simple.SimpleLock
|
||||
import de.bixilon.kutil.concurrent.lock.Lock
|
||||
import de.bixilon.kutil.concurrent.schedule.RepeatedTask
|
||||
import de.bixilon.kutil.concurrent.schedule.TaskScheduler
|
||||
import de.bixilon.kutil.concurrent.schedule.TaskScheduler.runLater
|
||||
@ -27,7 +27,7 @@ import de.bixilon.minosoft.protocol.protocol.ProtocolDefinition
|
||||
|
||||
class SessionTicker(private val session: PlaySession) {
|
||||
private val tasks: MutableSet<RepeatedTask> = mutableSetOf()
|
||||
private val lock = SimpleLock()
|
||||
private val lock = Lock.lock()
|
||||
private var registered = false
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2024 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -33,7 +33,7 @@ class ChannelS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket {
|
||||
}
|
||||
}
|
||||
|
||||
val data = buffer.readRest()
|
||||
val data = buffer.readRemaining()
|
||||
|
||||
override fun handle(session: PlaySession) {
|
||||
session.channels.play.handle(channel, data)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2024 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -22,7 +22,7 @@ import de.bixilon.minosoft.util.logging.LogMessageType
|
||||
class ChannelS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket {
|
||||
val messageId = buffer.readVarInt()
|
||||
val channel = buffer.readResourceLocation()
|
||||
val data: ByteArray = buffer.readRest()
|
||||
val data: ByteArray = buffer.readRemaining()
|
||||
|
||||
override fun handle(session: PlaySession) {
|
||||
session.channels.login.handle(messageId, channel, data)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -24,7 +24,7 @@ class DataLegacyMapS2CP(
|
||||
buffer: PlayInByteBuffer,
|
||||
) : LegacyMapS2CP {
|
||||
val start = Vec2i(buffer.readUnsignedByte(), buffer.readUnsignedByte())
|
||||
val colors = buffer.readRest()
|
||||
val colors = buffer.readRemaining()
|
||||
|
||||
override fun log(reducedLog: Boolean) {
|
||||
if (reducedLog) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2024 Moritz Zwerger
|
||||
* Copyright (C) 2020-2025 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -340,7 +340,7 @@ object KUtil {
|
||||
fun PlayInByteBuffer.dump(name: String) {
|
||||
val pointer = pointer
|
||||
this.pointer = 0
|
||||
val data = readRest()
|
||||
val data = readRemaining()
|
||||
this.pointer = pointer
|
||||
|
||||
val path = "/home/moritz/${name}_${Versions.getById(this.versionId)?.name?.replace(".", "_")}.bin"
|
||||
|
Loading…
x
Reference in New Issue
Block a user