mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-16 10:55:01 -04:00
bump, adopt kutil 1.24
This commit is contained in:
parent
ec8dbbdcb4
commit
04edd74988
@ -17,5 +17,5 @@ lwjgl.version=3.3.3
|
|||||||
ikonli.version=12.3.1
|
ikonli.version=12.3.1
|
||||||
netty.version=4.1.100.Final
|
netty.version=4.1.100.Final
|
||||||
jackson.version=2.15.3
|
jackson.version=2.15.3
|
||||||
kutil.version=1.23.2
|
kutil.version=1.24.0
|
||||||
glm.version=0.9.9.1-12
|
glm.version=0.9.9.1-12
|
||||||
|
@ -100,9 +100,9 @@ object Minosoft {
|
|||||||
private fun boot() {
|
private fun boot() {
|
||||||
val taskWorker = TaskWorker(errorHandler = { _, error -> error.printStackTrace(); error.crash() })
|
val taskWorker = TaskWorker(errorHandler = { _, error -> error.printStackTrace(); error.crash() })
|
||||||
|
|
||||||
taskWorker += WorkerTask(identifier = BootTasks.PROFILES, priority = ThreadPool.HIGHER, executor = GlobalProfileManager::initialize)
|
|
||||||
taskWorker += WorkerTask(identifier = BootTasks.VERSIONS, priority = ThreadPool.HIGHER, executor = VersionLoader::load)
|
taskWorker += WorkerTask(identifier = BootTasks.VERSIONS, priority = ThreadPool.HIGHER, executor = VersionLoader::load)
|
||||||
taskWorker += WorkerTask(identifier = BootTasks.FILE_WATCHER, priority = ThreadPool.HIGH, optional = true, executor = this::startFileWatcherService)
|
taskWorker += WorkerTask(identifier = BootTasks.FILE_WATCHER, priority = ThreadPool.HIGHER, optional = true, executor = this::startFileWatcherService)
|
||||||
|
taskWorker += WorkerTask(identifier = BootTasks.PROFILES, priority = ThreadPool.HIGHER, dependencies = arrayOf(BootTasks.FILE_WATCHER), executor = GlobalProfileManager::initialize)
|
||||||
|
|
||||||
taskWorker += WorkerTask(identifier = BootTasks.LANGUAGE_FILES, dependencies = arrayOf(BootTasks.PROFILES), executor = this::loadLanguageFiles)
|
taskWorker += WorkerTask(identifier = BootTasks.LANGUAGE_FILES, dependencies = arrayOf(BootTasks.PROFILES), executor = this::loadLanguageFiles)
|
||||||
taskWorker += WorkerTask(identifier = BootTasks.ASSETS_PROPERTIES, dependencies = arrayOf(BootTasks.VERSIONS), executor = AssetsVersionProperties::load)
|
taskWorker += WorkerTask(identifier = BootTasks.ASSETS_PROPERTIES, dependencies = arrayOf(BootTasks.VERSIONS), executor = AssetsVersionProperties::load)
|
||||||
@ -171,13 +171,13 @@ object Minosoft {
|
|||||||
postBoot()
|
postBoot()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun startFileWatcherService(latch: AbstractLatch) {
|
private fun startFileWatcherService(latch: AbstractLatch?) {
|
||||||
Log.log(LogMessageType.GENERAL, LogLevels.VERBOSE) { "Starting file watcher service..." }
|
Log.log(LogMessageType.GENERAL, LogLevels.VERBOSE) { "Starting file watcher service..." }
|
||||||
FileWatcherService.start()
|
FileWatcherService.start()
|
||||||
Log.log(LogMessageType.GENERAL, LogLevels.VERBOSE) { "File watcher service started!" }
|
Log.log(LogMessageType.GENERAL, LogLevels.VERBOSE) { "File watcher service started!" }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadLanguageFiles(latch: AbstractLatch) {
|
private fun loadLanguageFiles(latch: AbstractLatch?) {
|
||||||
val language = ErosProfileManager.selected.general.language
|
val language = ErosProfileManager.selected.general.language
|
||||||
ErosProfileManager.selected.general::language.observe(this, true) {
|
ErosProfileManager.selected.general::language.observe(this, true) {
|
||||||
Log.log(LogMessageType.OTHER, LogLevels.VERBOSE) { "Loading language files (${language})" }
|
Log.log(LogMessageType.OTHER, LogLevels.VERBOSE) { "Loading language files (${language})" }
|
||||||
|
@ -237,7 +237,7 @@ abstract class Entity(
|
|||||||
|
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
Entity::class.java.getDeclaredField("physics").forceSet(this, createPhysics())
|
PHYSICS.forceSet(this, createPhysics())
|
||||||
forceTeleport(initialPosition)
|
forceTeleport(initialPosition)
|
||||||
forceRotate(initialRotation)
|
forceRotate(initialRotation)
|
||||||
if (!RunConfiguration.DISABLE_RENDERING) {
|
if (!RunConfiguration.DISABLE_RENDERING) {
|
||||||
@ -252,6 +252,7 @@ abstract class Entity(
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val renderInfo = Entity::renderInfo.javaField!!.apply { isAccessible = true }
|
private val renderInfo = Entity::renderInfo.javaField!!.apply { isAccessible = true }
|
||||||
|
private val PHYSICS = Entity::class.java.getDeclaredField("physics").apply { isAccessible = true }
|
||||||
|
|
||||||
val FLAGS_DATA = EntityDataField("ENTITY_FLAGS")
|
val FLAGS_DATA = EntityDataField("ENTITY_FLAGS")
|
||||||
val AIR_SUPPLY_DATA = EntityDataField("ENTITY_AIR_SUPPLY")
|
val AIR_SUPPLY_DATA = EntityDataField("ENTITY_AIR_SUPPLY")
|
||||||
|
@ -23,7 +23,7 @@ import de.bixilon.minosoft.data.registries.item.factory.PixLyzerItemFactory
|
|||||||
import de.bixilon.minosoft.data.registries.item.items.food.FoodItem
|
import de.bixilon.minosoft.data.registries.item.items.food.FoodItem
|
||||||
import de.bixilon.minosoft.data.registries.registries.Registries
|
import de.bixilon.minosoft.data.registries.registries.Registries
|
||||||
|
|
||||||
open class PixLyzerFoodItem(
|
class PixLyzerFoodItem(
|
||||||
resourceLocation: ResourceLocation,
|
resourceLocation: ResourceLocation,
|
||||||
registries: Registries,
|
registries: Registries,
|
||||||
data: Map<String, Any>,
|
data: Map<String, Any>,
|
||||||
|
@ -232,7 +232,7 @@ class ServerListController : EmbeddedJavaFXController<Pane>(), Refreshable {
|
|||||||
|
|
||||||
private fun updateServer(server: AbstractServer, refreshInfo: Boolean = false) {
|
private fun updateServer(server: AbstractServer, refreshInfo: Boolean = false) {
|
||||||
val serverType = serverType ?: return
|
val serverType = serverType ?: return
|
||||||
if (server !in serverType.servers) { // <- initial server not added (fixed in kutil 1.24)
|
if (server !in serverType.servers) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val card = ServerCard.CARDS[server] ?: ServerCard(server).apply {
|
val card = ServerCard.CARDS[server] ?: ServerCard(server).apply {
|
||||||
|
@ -40,7 +40,7 @@ class JavaFXInitializer internal constructor() : Application() {
|
|||||||
JavaFXUtil.HOST_SERVICES = hostServices
|
JavaFXUtil.HOST_SERVICES = hostServices
|
||||||
DesktopUtil.initialize()
|
DesktopUtil.initialize()
|
||||||
|
|
||||||
val worker = UnconditionalWorker()
|
val worker = UnconditionalWorker(autoWork = true)
|
||||||
worker += { JavaFXUtil.MINOSOFT_LOGO = Image(Minosoft.MINOSOFT_ASSETS_MANAGER[DesktopUtil.ICON]) }
|
worker += { JavaFXUtil.MINOSOFT_LOGO = Image(Minosoft.MINOSOFT_ASSETS_MANAGER[DesktopUtil.ICON]) }
|
||||||
worker += { catchAll { JavaFXUtil.BIXILON_LOGO = SvgLoader().loadSvg(Minosoft.MINOSOFT_ASSETS_MANAGER["minosoft:textures/icons/bixilon_logo.svg".toResourceLocation()]) } }
|
worker += { catchAll { JavaFXUtil.BIXILON_LOGO = SvgLoader().loadSvg(Minosoft.MINOSOFT_ASSETS_MANAGER["minosoft:textures/icons/bixilon_logo.svg".toResourceLocation()]) } }
|
||||||
worker.work(LATCH)
|
worker.work(LATCH)
|
||||||
|
@ -15,6 +15,7 @@ package de.bixilon.minosoft.gui.rendering.entities.feature.hitbox
|
|||||||
|
|
||||||
import de.bixilon.kotlinglm.vec3.Vec3
|
import de.bixilon.kotlinglm.vec3.Vec3
|
||||||
import de.bixilon.kotlinglm.vec3.Vec3i
|
import de.bixilon.kotlinglm.vec3.Vec3i
|
||||||
|
import de.bixilon.kutil.math.interpolation.Interpolator
|
||||||
import de.bixilon.minosoft.data.entities.EntityRotation
|
import de.bixilon.minosoft.data.entities.EntityRotation
|
||||||
import de.bixilon.minosoft.data.registries.shapes.aabb.AABB
|
import de.bixilon.minosoft.data.registries.shapes.aabb.AABB
|
||||||
import de.bixilon.minosoft.data.text.formatting.color.ChatColors
|
import de.bixilon.minosoft.data.text.formatting.color.ChatColors
|
||||||
@ -27,7 +28,6 @@ import de.bixilon.minosoft.gui.rendering.util.mesh.Mesh
|
|||||||
import de.bixilon.minosoft.gui.rendering.util.vec.vec3.Vec3Util
|
import de.bixilon.minosoft.gui.rendering.util.vec.vec3.Vec3Util
|
||||||
import de.bixilon.minosoft.gui.rendering.util.vec.vec3.Vec3Util.EMPTY
|
import de.bixilon.minosoft.gui.rendering.util.vec.vec3.Vec3Util.EMPTY
|
||||||
import de.bixilon.minosoft.protocol.protocol.ProtocolDefinition
|
import de.bixilon.minosoft.protocol.protocol.ProtocolDefinition
|
||||||
import de.bixilon.minosoft.util.interpolate.Interpolator
|
|
||||||
|
|
||||||
class HitboxFeature(renderer: EntityRenderer<*>) : EntityRenderFeature(renderer) {
|
class HitboxFeature(renderer: EntityRenderer<*>) : EntityRenderFeature(renderer) {
|
||||||
private val manager = renderer.renderer.features.hitbox
|
private val manager = renderer.renderer.features.hitbox
|
||||||
|
@ -15,6 +15,7 @@ package de.bixilon.minosoft.gui.rendering.entities.renderer
|
|||||||
|
|
||||||
import de.bixilon.kotlinglm.mat4x4.Mat4
|
import de.bixilon.kotlinglm.mat4x4.Mat4
|
||||||
import de.bixilon.kotlinglm.vec3.Vec3
|
import de.bixilon.kotlinglm.vec3.Vec3
|
||||||
|
import de.bixilon.kutil.math.interpolation.Interpolator
|
||||||
import de.bixilon.minosoft.data.entities.entities.Entity
|
import de.bixilon.minosoft.data.entities.entities.Entity
|
||||||
import de.bixilon.minosoft.data.entities.event.events.damage.DamageEvent
|
import de.bixilon.minosoft.data.entities.event.events.damage.DamageEvent
|
||||||
import de.bixilon.minosoft.data.entities.event.events.damage.DamageListener
|
import de.bixilon.minosoft.data.entities.event.events.damage.DamageListener
|
||||||
@ -30,7 +31,6 @@ import de.bixilon.minosoft.gui.rendering.entities.feature.text.EntityNameFeature
|
|||||||
import de.bixilon.minosoft.gui.rendering.util.mat.mat4.Mat4Util.reset
|
import de.bixilon.minosoft.gui.rendering.util.mat.mat4.Mat4Util.reset
|
||||||
import de.bixilon.minosoft.gui.rendering.util.mat.mat4.Mat4Util.rotateRadAssign
|
import de.bixilon.minosoft.gui.rendering.util.mat.mat4.Mat4Util.rotateRadAssign
|
||||||
import de.bixilon.minosoft.gui.rendering.util.mat.mat4.Mat4Util.translateYAssign
|
import de.bixilon.minosoft.gui.rendering.util.mat.mat4.Mat4Util.translateYAssign
|
||||||
import de.bixilon.minosoft.util.interpolate.Interpolator
|
|
||||||
|
|
||||||
abstract class EntityRenderer<E : Entity>(
|
abstract class EntityRenderer<E : Entity>(
|
||||||
val renderer: EntitiesRenderer,
|
val renderer: EntitiesRenderer,
|
||||||
|
@ -15,10 +15,10 @@ package de.bixilon.minosoft.gui.rendering.entities.util
|
|||||||
|
|
||||||
import de.bixilon.kotlinglm.vec3.Vec3d
|
import de.bixilon.kotlinglm.vec3.Vec3d
|
||||||
import de.bixilon.kutil.math.interpolation.FloatInterpolation
|
import de.bixilon.kutil.math.interpolation.FloatInterpolation
|
||||||
|
import de.bixilon.kutil.math.interpolation.Interpolator
|
||||||
import de.bixilon.minosoft.data.entities.entities.Entity
|
import de.bixilon.minosoft.data.entities.entities.Entity
|
||||||
import de.bixilon.minosoft.gui.rendering.util.vec.vec3.Vec3dUtil.EMPTY
|
import de.bixilon.minosoft.gui.rendering.util.vec.vec3.Vec3dUtil.EMPTY
|
||||||
import de.bixilon.minosoft.protocol.protocol.ProtocolDefinition
|
import de.bixilon.minosoft.protocol.protocol.ProtocolDefinition
|
||||||
import de.bixilon.minosoft.util.interpolate.Interpolator
|
|
||||||
|
|
||||||
class EntitySpeed(val entity: Entity) {
|
class EntitySpeed(val entity: Entity) {
|
||||||
private val interpolator = Interpolator(0.0f, FloatInterpolation::interpolateLinear)
|
private val interpolator = Interpolator(0.0f, FloatInterpolation::interpolateLinear)
|
||||||
|
@ -46,7 +46,7 @@ open class CloudParticle(connection: PlayConnection, position: Vec3d, velocity:
|
|||||||
if (dead) {
|
if (dead) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (DefaultThreadPool.isBacklog()) return // disable lagging a bit
|
if (DefaultThreadPool.isBacklogging()) return // disable lagging a bit
|
||||||
|
|
||||||
connection.world.entities.getClosestInRadius(position, 2.0, WorldEntities.CHECK_CLOSEST_PLAYER)?.let { // TODO: optimize
|
connection.world.entities.getClosestInRadius(position, 2.0, WorldEntities.CHECK_CLOSEST_PLAYER)?.let { // TODO: optimize
|
||||||
val y = it.physics.position.y
|
val y = it.physics.position.y
|
||||||
|
@ -60,14 +60,16 @@ class EntityPositionInfo(
|
|||||||
|
|
||||||
val velocityPosition = Vec3i(blockPosition.x, (position.y - 0.5000001).toInt(), blockPosition.z)
|
val velocityPosition = Vec3i(blockPosition.x, (position.y - 0.5000001).toInt(), blockPosition.z)
|
||||||
|
|
||||||
val chunks = physics.entity.connection.world.chunks
|
val world = physics.entity.connection.world
|
||||||
val revision = chunks.revision
|
world.lock.acquire()
|
||||||
|
val revision = world.chunks.revision
|
||||||
|
|
||||||
var chunk = if (previous.revision == revision) previous.chunk?.neighbours?.trace(chunkPosition - previous.chunkPosition) else null
|
var chunk = if (previous.revision == revision) previous.chunk?.neighbours?.trace(chunkPosition - previous.chunkPosition) else null
|
||||||
|
|
||||||
if (chunk == null) {
|
if (chunk == null) {
|
||||||
chunk = chunks[chunkPosition]
|
chunk = world.chunks.chunks.unsafe[chunkPosition]
|
||||||
}
|
}
|
||||||
|
world.lock.release()
|
||||||
|
|
||||||
val block = chunk?.get(inChunkPosition)
|
val block = chunk?.get(inChunkPosition)
|
||||||
val velocityBlock = chunk?.get(velocityPosition.inChunkPosition)
|
val velocityBlock = chunk?.get(velocityPosition.inChunkPosition)
|
||||||
|
@ -68,7 +68,6 @@ import de.bixilon.minosoft.terminal.RunConfiguration
|
|||||||
import de.bixilon.minosoft.terminal.cli.CLI
|
import de.bixilon.minosoft.terminal.cli.CLI
|
||||||
import de.bixilon.minosoft.util.KUtil
|
import de.bixilon.minosoft.util.KUtil
|
||||||
import de.bixilon.minosoft.util.KUtil.startInit
|
import de.bixilon.minosoft.util.KUtil.startInit
|
||||||
import de.bixilon.minosoft.util.KUtil.waitIfLess
|
|
||||||
import de.bixilon.minosoft.util.logging.Log
|
import de.bixilon.minosoft.util.logging.Log
|
||||||
import de.bixilon.minosoft.util.logging.LogLevels
|
import de.bixilon.minosoft.util.logging.LogLevels
|
||||||
import de.bixilon.minosoft.util.logging.LogMessageType
|
import de.bixilon.minosoft.util.logging.LogMessageType
|
||||||
|
@ -84,7 +84,7 @@ object VersionLoader {
|
|||||||
return version
|
return version
|
||||||
}
|
}
|
||||||
|
|
||||||
fun load(latch: AbstractLatch) {
|
fun load(latch: AbstractLatch?) {
|
||||||
Log.log(LogMessageType.LOADING, LogLevels.VERBOSE) { "Loading versions..." }
|
Log.log(LogMessageType.LOADING, LogLevels.VERBOSE) { "Loading versions..." }
|
||||||
val index: VersionIndex = Minosoft.MINOSOFT_ASSETS_MANAGER[INDEX].readJson()
|
val index: VersionIndex = Minosoft.MINOSOFT_ASSETS_MANAGER[INDEX].readJson()
|
||||||
|
|
||||||
|
@ -55,9 +55,9 @@ object CLI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun startThread(latch: AbstractLatch) {
|
fun startThread(latch: AbstractLatch?) {
|
||||||
latch.inc()
|
latch?.inc()
|
||||||
Thread({ latch.dec(); startLoop() }, "CLI").start()
|
Thread({ latch?.dec(); startLoop() }, "CLI").start()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun startLoop() {
|
private fun startLoop() {
|
||||||
|
@ -29,7 +29,6 @@ import de.bixilon.kutil.collections.CollectionUtil.toSynchronizedSet
|
|||||||
import de.bixilon.kutil.concurrent.pool.DefaultThreadPool
|
import de.bixilon.kutil.concurrent.pool.DefaultThreadPool
|
||||||
import de.bixilon.kutil.concurrent.schedule.TaskScheduler
|
import de.bixilon.kutil.concurrent.schedule.TaskScheduler
|
||||||
import de.bixilon.kutil.enums.ValuesEnum
|
import de.bixilon.kutil.enums.ValuesEnum
|
||||||
import de.bixilon.kutil.latch.AbstractLatch
|
|
||||||
import de.bixilon.kutil.primitive.BooleanUtil.decide
|
import de.bixilon.kutil.primitive.BooleanUtil.decide
|
||||||
import de.bixilon.kutil.primitive.DoubleUtil
|
import de.bixilon.kutil.primitive.DoubleUtil
|
||||||
import de.bixilon.kutil.primitive.DoubleUtil.matches
|
import de.bixilon.kutil.primitive.DoubleUtil.matches
|
||||||
@ -338,13 +337,6 @@ object KUtil {
|
|||||||
return table
|
return table
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated("kutil 1.24")
|
|
||||||
fun AbstractLatch.waitIfLess(value: Int, timeout: Long = 0L) = synchronized(notify) {
|
|
||||||
while (this.count < value) {
|
|
||||||
waitForChange(timeout)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated("kutil 1.24")
|
@Deprecated("kutil 1.24")
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
inline fun <reified T : Enum<T>> ValuesEnum<T>.set(): EnumSet<T> {
|
inline fun <reified T : Enum<T>> ValuesEnum<T>.set(): EnumSet<T> {
|
||||||
|
@ -91,7 +91,7 @@ class FragmentedArrayFloatList(
|
|||||||
return this.incomplete.firstOrNull() ?: grow(left)
|
return this.incomplete.firstOrNull() ?: grow(left)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun add(value1: Float, value2: Float) {
|
override fun add(value1: Float, value2: Float) {
|
||||||
var buffer = tryGrow(1)
|
var buffer = tryGrow(1)
|
||||||
buffer = batchAdd(value1, buffer, 1)
|
buffer = batchAdd(value1, buffer, 1)
|
||||||
batchAdd(value2, buffer, 0)
|
batchAdd(value2, buffer, 0)
|
||||||
@ -100,7 +100,7 @@ class FragmentedArrayFloatList(
|
|||||||
invalidateOutput()
|
invalidateOutput()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun add(value1: Float, value2: Float, value3: Float) {
|
override fun add(value1: Float, value2: Float, value3: Float) {
|
||||||
var buffer = tryGrow(1)
|
var buffer = tryGrow(1)
|
||||||
buffer = batchAdd(value1, buffer, 2)
|
buffer = batchAdd(value1, buffer, 2)
|
||||||
buffer = batchAdd(value2, buffer, 1)
|
buffer = batchAdd(value2, buffer, 1)
|
||||||
@ -110,7 +110,7 @@ class FragmentedArrayFloatList(
|
|||||||
invalidateOutput()
|
invalidateOutput()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun add(value1: Float, value2: Float, value3: Float, value4: Float) {
|
override fun add(value1: Float, value2: Float, value3: Float, value4: Float) {
|
||||||
var buffer = tryGrow(1)
|
var buffer = tryGrow(1)
|
||||||
buffer = batchAdd(value1, buffer, 3)
|
buffer = batchAdd(value1, buffer, 3)
|
||||||
buffer = batchAdd(value2, buffer, 2)
|
buffer = batchAdd(value2, buffer, 2)
|
||||||
@ -121,7 +121,32 @@ class FragmentedArrayFloatList(
|
|||||||
invalidateOutput()
|
invalidateOutput()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun add(value1: Float, value2: Float, value3: Float, value4: Float, value5: Float, value6: Float, value7: Float) {
|
override fun add(value1: Float, value2: Float, value3: Float, value4: Float, value5: Float) {
|
||||||
|
var buffer = tryGrow(1)
|
||||||
|
buffer = batchAdd(value1, buffer, 4)
|
||||||
|
buffer = batchAdd(value2, buffer, 3)
|
||||||
|
buffer = batchAdd(value3, buffer, 2)
|
||||||
|
buffer = batchAdd(value4, buffer, 1)
|
||||||
|
batchAdd(value5, buffer, 0)
|
||||||
|
|
||||||
|
size += 5
|
||||||
|
invalidateOutput()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun add(value1: Float, value2: Float, value3: Float, value4: Float, value5: Float, value6: Float) {
|
||||||
|
var buffer = tryGrow(1)
|
||||||
|
buffer = batchAdd(value1, buffer, 5)
|
||||||
|
buffer = batchAdd(value2, buffer, 4)
|
||||||
|
buffer = batchAdd(value3, buffer, 3)
|
||||||
|
buffer = batchAdd(value4, buffer, 2)
|
||||||
|
buffer = batchAdd(value5, buffer, 1)
|
||||||
|
batchAdd(value6, buffer, 0)
|
||||||
|
|
||||||
|
size += 6
|
||||||
|
invalidateOutput()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun add(value1: Float, value2: Float, value3: Float, value4: Float, value5: Float, value6: Float, value7: Float) {
|
||||||
var buffer = tryGrow(1)
|
var buffer = tryGrow(1)
|
||||||
buffer = batchAdd(value1, buffer, 6)
|
buffer = batchAdd(value1, buffer, 6)
|
||||||
buffer = batchAdd(value2, buffer, 5)
|
buffer = batchAdd(value2, buffer, 5)
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
/*
|
|
||||||
* Minosoft
|
|
||||||
* Copyright (C) 2020-2023 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.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.bixilon.minosoft.util.interpolate
|
|
||||||
|
|
||||||
@Deprecated("Kutil 1.24")
|
|
||||||
fun interface InterpolateFunction<T> {
|
|
||||||
|
|
||||||
fun interpolate(delta: Float, value0: T, value1: T): T
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
/*
|
|
||||||
* Minosoft
|
|
||||||
* Copyright (C) 2020-2023 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.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.bixilon.minosoft.util.interpolate
|
|
||||||
|
|
||||||
@Deprecated("Kutil 1.24")
|
|
||||||
class Interpolator<T>(
|
|
||||||
var initial: T,
|
|
||||||
var function: InterpolateFunction<T>,
|
|
||||||
) {
|
|
||||||
var value = initial
|
|
||||||
|
|
||||||
var value0 = initial
|
|
||||||
var value1 = initial
|
|
||||||
var delta = 0.0f
|
|
||||||
var identical = false
|
|
||||||
|
|
||||||
|
|
||||||
fun push(value: T) {
|
|
||||||
value0 = value1
|
|
||||||
value1 = value
|
|
||||||
this.identical = value0 == value1
|
|
||||||
delta = 0.0f
|
|
||||||
this.value = value0
|
|
||||||
}
|
|
||||||
|
|
||||||
fun add(delta: Float) {
|
|
||||||
if (this.delta >= 1.0f) return
|
|
||||||
this.delta += delta
|
|
||||||
if (this.identical) return
|
|
||||||
|
|
||||||
value = function.interpolate(this.delta, value0, value1)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun add(seconds: Float, step: Float) {
|
|
||||||
add(seconds / step)
|
|
||||||
}
|
|
||||||
}
|
|
@ -12,7 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
package de.bixilon.minosoft.util.logging
|
package de.bixilon.minosoft.util.logging
|
||||||
|
|
||||||
import de.bixilon.kutil.ansi.ANSI
|
import de.bixilon.kutil.ansi.ANSI.RESET
|
||||||
import de.bixilon.kutil.exception.ExceptionUtil.catchAll
|
import de.bixilon.kutil.exception.ExceptionUtil.catchAll
|
||||||
import de.bixilon.kutil.shutdown.ShutdownManager
|
import de.bixilon.kutil.shutdown.ShutdownManager
|
||||||
import de.bixilon.kutil.time.TimeUtil.millis
|
import de.bixilon.kutil.time.TimeUtil.millis
|
||||||
@ -37,8 +37,6 @@ import kotlin.contracts.contract
|
|||||||
|
|
||||||
@OptIn(ExperimentalContracts::class)
|
@OptIn(ExperimentalContracts::class)
|
||||||
object Log {
|
object Log {
|
||||||
@Deprecated("Kutil 1.24")
|
|
||||||
private val RESET = ANSI.formatting(0)
|
|
||||||
var ASYNC_LOGGING = true
|
var ASYNC_LOGGING = true
|
||||||
private val MINOSOFT_START_TIME = millis()
|
private val MINOSOFT_START_TIME = millis()
|
||||||
private val TIME_FORMAT = SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS")
|
private val TIME_FORMAT = SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS")
|
||||||
@ -108,6 +106,7 @@ object Log {
|
|||||||
for (line in this.message.ansiColoredMessage.lineSequence()) {
|
for (line in this.message.ansiColoredMessage.lineSequence()) {
|
||||||
stream.println(prefix + line + RESET)
|
stream.println(prefix + line + RESET)
|
||||||
}
|
}
|
||||||
|
stream.flush()
|
||||||
|
|
||||||
} catch (exception: Throwable) {
|
} catch (exception: Throwable) {
|
||||||
SYSTEM_ERR_STREAM.println("Can not send log message $this!")
|
SYSTEM_ERR_STREAM.println("Can not send log message $this!")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user