From 3b61973040475d389053c931467f84a1ead6764b Mon Sep 17 00:00:00 2001 From: Moritz Zwerger Date: Thu, 1 Feb 2024 18:20:28 +0100 Subject: [PATCH] port to kutil 1.26 --- gradle.properties | 4 +- .../minosoft/data/physics/PhysicsTestUtil.kt | 16 ++--- .../data/physics/parkour/ParkourUtil.kt | 4 +- .../registries/registry/RegistryTest.kt | 12 +--- .../unicode/unihex/UnihexFontTypeTest.kt | 23 ++----- .../models/baked/BakedModelTestUtil.kt | 2 +- .../models/loader/SkeletalLoaderTest.kt | 2 +- .../base/texture/skin/SkinManagerTest.kt | 2 +- .../rendering/textures/TextureReadingTest.kt | 2 +- .../tints/grass/GrassTintCalculatorTest.kt | 2 +- .../connection/play/ConnectionTestUtil.kt | 62 +++++++++--------- .../packets/s2c/play/PacketReadingTestUtil.kt | 2 +- .../packets/s2c/play/chunk/ChunkS2CPTest.kt | 2 +- .../packets/s2c/play/chunk/ChunksS2CPTest.kt | 2 +- .../minosoft/modding/dummy/DummyMod.class | Bin 2868 -> 2855 bytes .../minosoft/modding/dummy/DummyMod.kt | 4 +- .../directory/DirectoryAssetsManager.kt | 2 +- .../minosoft/assets/file/ZipAssetsManager.kt | 2 +- .../minosoft/assets/util/FileAssetsUtil.kt | 2 +- .../minosoft/assets/util/InputStreamUtil.kt | 31 +-------- .../profile/storage/StorageProfileManager.kt | 4 +- .../minosoft/data/entities/entities/Entity.kt | 16 ++--- .../de/bixilon/minosoft/example/ExampleMod.kt | 4 +- .../types/unicode/unihex/UnihexFontType.kt | 15 ++--- .../gui/rendering/sound/sounds/SoundData.kt | 2 +- .../base/shader/code/glsl/GLSLShaderCode.kt | 4 +- .../system/opengl/OpenGLNativeShader.kt | 4 +- .../gui/rendering/util/vec/vec3/Vec3iUtil.kt | 6 +- .../minosoft/modding/loader/LoaderUtil.kt | 2 +- .../loader/mod/source/DirectorySource.kt | 2 +- .../minosoft/updater/MinosoftUpdater.kt | 2 +- .../java/de/bixilon/minosoft/util/KUtil.kt | 31 --------- .../util/signature/SignatureSigner.kt | 2 +- .../minosoft/util/system/DesktopAPI.kt | 2 +- 34 files changed, 92 insertions(+), 182 deletions(-) diff --git a/gradle.properties b/gradle.properties index ecef40819c..e1ed919dd4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ # # Minosoft -# Copyright (C) 2020-2023 Moritz Zwerger +# Copyright (C) 2020-2024 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.3 ikonli.version=12.3.1 netty.version=4.1.101.Final jackson.version=2.16.0 -kutil.version=1.25.0 +kutil.version=1.26.0 glm.version=0.9.9.1-12 diff --git a/src/integration-test/kotlin/de/bixilon/minosoft/data/physics/PhysicsTestUtil.kt b/src/integration-test/kotlin/de/bixilon/minosoft/data/physics/PhysicsTestUtil.kt index 77f7ab78f4..9fab3e4ae0 100644 --- a/src/integration-test/kotlin/de/bixilon/minosoft/data/physics/PhysicsTestUtil.kt +++ b/src/integration-test/kotlin/de/bixilon/minosoft/data/physics/PhysicsTestUtil.kt @@ -1,6 +1,6 @@ /* * Minosoft - * Copyright (C) 2020-2023 Moritz Zwerger + * Copyright (C) 2020-2024 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. * @@ -18,7 +18,7 @@ import de.bixilon.kutil.primitive.DoubleUtil import de.bixilon.kutil.primitive.DoubleUtil.matches import de.bixilon.kutil.primitive.FloatUtil import de.bixilon.kutil.primitive.FloatUtil.matches -import de.bixilon.kutil.reflection.ReflectionUtil.forceSet +import de.bixilon.kutil.reflection.ReflectionUtil.field import de.bixilon.kutil.reflection.ReflectionUtil.jvmField import de.bixilon.minosoft.camera.ConnectionCamera import de.bixilon.minosoft.data.entities.StatusEffectInstance @@ -42,17 +42,17 @@ object PhysicsTestUtil { const val MATCH_EXACTLY = true val VALUE_MARGIN = if (MATCH_EXACTLY) 0.0 else DoubleUtil.DEFAULT_MARGIN - private val PLAYER_ATTRIBUTES = LocalPlayerEntity::attributes.jvmField - private val CONNECTION_PLAYER = PlayConnection::player.jvmField - private val CONNECTION_CAMERA = PlayConnection::camera.jvmField + private val PLAYER_ATTRIBUTES = LocalPlayerEntity::attributes.jvmField.field + private val CONNECTION_PLAYER = PlayConnection::player.jvmField.field + private val CONNECTION_CAMERA = PlayConnection::camera.jvmField.field fun createPlayer(connection: PlayConnection = createConnection(light = false)): LocalPlayerEntity { val player = LocalPlayerEntity(connection.account, connection, SignatureKeyManagement(connection, connection.account)) - PLAYER_ATTRIBUTES.forceSet(player, EntityAttributes(player.type.attributes)) + PLAYER_ATTRIBUTES.set(player, EntityAttributes(player.type.attributes)) player.startInit() - CONNECTION_PLAYER.forceSet(connection, player) - CONNECTION_CAMERA.forceSet(connection, ConnectionCamera(connection)) + CONNECTION_PLAYER.set(connection, player) + CONNECTION_CAMERA.set(connection, ConnectionCamera(connection)) connection.camera.init() connection.world.entities.remove(0) connection.world.entities.add(0, null, player) diff --git a/src/integration-test/kotlin/de/bixilon/minosoft/data/physics/parkour/ParkourUtil.kt b/src/integration-test/kotlin/de/bixilon/minosoft/data/physics/parkour/ParkourUtil.kt index c5725acc92..b5a5532da3 100644 --- a/src/integration-test/kotlin/de/bixilon/minosoft/data/physics/parkour/ParkourUtil.kt +++ b/src/integration-test/kotlin/de/bixilon/minosoft/data/physics/parkour/ParkourUtil.kt @@ -1,6 +1,6 @@ /* * Minosoft - * Copyright (C) 2020-2023 Moritz Zwerger + * Copyright (C) 2020-2024 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,8 +14,8 @@ package de.bixilon.minosoft.data.physics.parkour import de.bixilon.kotlinglm.vec3.Vec3d +import de.bixilon.kutil.stream.InputStreamUtil.readAsString import de.bixilon.kutil.string.WhitespaceUtil.trimWhitespaces -import de.bixilon.minosoft.assets.util.InputStreamUtil.readAsString import de.bixilon.minosoft.commands.parser.brigadier._double.DoubleParser.Companion.readDouble import de.bixilon.minosoft.commands.parser.brigadier._float.FloatParser.Companion.readFloat import de.bixilon.minosoft.commands.util.StringReader diff --git a/src/integration-test/kotlin/de/bixilon/minosoft/data/registries/registries/registry/RegistryTest.kt b/src/integration-test/kotlin/de/bixilon/minosoft/data/registries/registries/registry/RegistryTest.kt index f72019e15d..9525f2762c 100644 --- a/src/integration-test/kotlin/de/bixilon/minosoft/data/registries/registries/registry/RegistryTest.kt +++ b/src/integration-test/kotlin/de/bixilon/minosoft/data/registries/registries/registry/RegistryTest.kt @@ -1,6 +1,6 @@ /* * Minosoft - * Copyright (C) 2020-2023 Moritz Zwerger + * Copyright (C) 2020-2024 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.data.registries.registries.registry +import de.bixilon.kutil.collections.spliterator.SpliteratorUtil.collect import de.bixilon.minosoft.data.registries.identified.Namespaces.minosoft import de.bixilon.minosoft.data.registries.identified.ResourceLocation import org.testng.Assert.* import org.testng.annotations.Test -import java.util.* @Test(groups = ["registry"]) class RegistryTest { @@ -114,14 +114,6 @@ class RegistryTest { assertEquals(secondList.toSet(), setOf(c, d)) } - - @Deprecated("kutil 1.25") - fun Spliterator.collect(): List { - val list: MutableList = mutableListOf() - forEachRemaining { list += it } - - return list - } // TODO: codec, spliterating private class Entry(override val identifier: ResourceLocation) : RegistryItem() { diff --git a/src/integration-test/kotlin/de/bixilon/minosoft/gui/rendering/font/types/unicode/unihex/UnihexFontTypeTest.kt b/src/integration-test/kotlin/de/bixilon/minosoft/gui/rendering/font/types/unicode/unihex/UnihexFontTypeTest.kt index a8f0ca2ff1..6d9582a239 100644 --- a/src/integration-test/kotlin/de/bixilon/minosoft/gui/rendering/font/types/unicode/unihex/UnihexFontTypeTest.kt +++ b/src/integration-test/kotlin/de/bixilon/minosoft/gui/rendering/font/types/unicode/unihex/UnihexFontTypeTest.kt @@ -1,6 +1,6 @@ /* * Minosoft - * Copyright (C) 2020-2023 Moritz Zwerger + * Copyright (C) 2020-2024 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,14 +15,14 @@ package de.bixilon.minosoft.gui.rendering.font.types.unicode.unihex import de.bixilon.kotlinglm.vec2.Vec2 import de.bixilon.kotlinglm.vec2.Vec2i -import de.bixilon.kutil.buffer.ByteBufferUtil.toByteArray +import de.bixilon.kutil.buffer.ByteBufferUtil.readRemaining import de.bixilon.kutil.reflection.ReflectionUtil.getFieldOrNull import de.bixilon.kutil.unsafe.UnsafeUtil.setUnsafeAccessible import de.bixilon.minosoft.gui.rendering.font.types.unicode.UnicodeCodeRenderer -import de.bixilon.minosoft.gui.rendering.font.types.unicode.unihex.UnihexFontType.Companion.fromHex import de.bixilon.minosoft.test.IT.OBJENESIS import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap -import org.testng.Assert.* +import org.testng.Assert.assertEquals +import org.testng.Assert.assertTrue import org.testng.annotations.Test import java.io.ByteArrayInputStream import java.io.InputStream @@ -33,19 +33,6 @@ class UnihexFontTypeTest { private val textureRemaining = UnifontTexture::class.java.getFieldOrNull("remaining")!! val readUnihex = UnihexFontType::class.companionObject!!.java.getDeclaredMethod("readUnihex", InputStream::class.java, Int2ObjectOpenHashMap::class.java).apply { setUnsafeAccessible() } - fun `from hex`() { - assertEquals('0'.code.fromHex(), 0x00) - assertEquals('9'.code.fromHex(), 0x09) - - assertEquals('a'.code.fromHex(), 0x0A) - assertEquals('A'.code.fromHex(), 0x0A) - - assertEquals('f'.code.fromHex(), 0x0F) - assertEquals('F'.code.fromHex(), 0x0F) - - assertThrows { 'z'.code.fromHex() } - } - fun `read unihex`() { val data = "0E01DB:555580000001A2382241A238140588380001B31808A1913020A9BB100001AAAA\n298B:0000000E0808080808080808080E000E" @@ -112,7 +99,7 @@ class UnihexFontTypeTest { assertEquals(code.uvEnd, Vec2(0.18749f, 1.0f)) assertEquals(remaining, intArrayOf(13)) - val data = texture.data.buffer.data.toByteArray() + val data = texture.data.buffer.data.readRemaining() for (index in 0 until 48) { diff --git a/src/integration-test/kotlin/de/bixilon/minosoft/gui/rendering/models/baked/BakedModelTestUtil.kt b/src/integration-test/kotlin/de/bixilon/minosoft/gui/rendering/models/baked/BakedModelTestUtil.kt index 876f0edef7..c89cd1934d 100644 --- a/src/integration-test/kotlin/de/bixilon/minosoft/gui/rendering/models/baked/BakedModelTestUtil.kt +++ b/src/integration-test/kotlin/de/bixilon/minosoft/gui/rendering/models/baked/BakedModelTestUtil.kt @@ -15,10 +15,10 @@ package de.bixilon.minosoft.gui.rendering.models.baked import de.bixilon.kotlinglm.vec2.Vec2i import de.bixilon.kutil.reflection.ReflectionUtil.forceSet +import de.bixilon.kutil.stream.InputStreamUtil.readAll import de.bixilon.minosoft.Minosoft import de.bixilon.minosoft.assets.MemoryAssetsManager import de.bixilon.minosoft.assets.TestAssetsManager.box -import de.bixilon.minosoft.assets.util.InputStreamUtil.readAll import de.bixilon.minosoft.data.direction.Directions import de.bixilon.minosoft.gui.rendering.Rendering import de.bixilon.minosoft.gui.rendering.models.block.element.face.ModelFace diff --git a/src/integration-test/kotlin/de/bixilon/minosoft/gui/rendering/models/loader/SkeletalLoaderTest.kt b/src/integration-test/kotlin/de/bixilon/minosoft/gui/rendering/models/loader/SkeletalLoaderTest.kt index 61672a5f4b..84547d2ec1 100644 --- a/src/integration-test/kotlin/de/bixilon/minosoft/gui/rendering/models/loader/SkeletalLoaderTest.kt +++ b/src/integration-test/kotlin/de/bixilon/minosoft/gui/rendering/models/loader/SkeletalLoaderTest.kt @@ -18,8 +18,8 @@ import de.bixilon.kutil.cast.CastUtil.unsafeCast import de.bixilon.kutil.latch.SimpleLatch import de.bixilon.kutil.reflection.ReflectionUtil.forceSet import de.bixilon.kutil.reflection.ReflectionUtil.getFieldOrNull +import de.bixilon.kutil.stream.InputStreamUtil.readAll import de.bixilon.minosoft.assets.MemoryAssetsManager -import de.bixilon.minosoft.assets.util.InputStreamUtil.readAll import de.bixilon.minosoft.data.registries.identified.Namespaces.minosoft import de.bixilon.minosoft.data.registries.identified.ResourceLocation import de.bixilon.minosoft.gui.rendering.RenderContext diff --git a/src/integration-test/kotlin/de/bixilon/minosoft/gui/rendering/system/base/texture/skin/SkinManagerTest.kt b/src/integration-test/kotlin/de/bixilon/minosoft/gui/rendering/system/base/texture/skin/SkinManagerTest.kt index e78290c817..f3d02668a4 100644 --- a/src/integration-test/kotlin/de/bixilon/minosoft/gui/rendering/system/base/texture/skin/SkinManagerTest.kt +++ b/src/integration-test/kotlin/de/bixilon/minosoft/gui/rendering/system/base/texture/skin/SkinManagerTest.kt @@ -15,10 +15,10 @@ package de.bixilon.minosoft.gui.rendering.system.base.texture.skin import de.bixilon.kotlinglm.vec2.Vec2i import de.bixilon.kutil.reflection.ReflectionUtil.forceSet +import de.bixilon.kutil.stream.InputStreamUtil.readAll import de.bixilon.kutil.unsafe.UnsafeUtil.setUnsafeAccessible import de.bixilon.kutil.url.URLUtil.toURL import de.bixilon.minosoft.assets.MemoryAssetsManager -import de.bixilon.minosoft.assets.util.InputStreamUtil.readAll import de.bixilon.minosoft.data.entities.entities.player.RemotePlayerEntity import de.bixilon.minosoft.data.entities.entities.player.additional.PlayerAdditional import de.bixilon.minosoft.data.entities.entities.player.properties.PlayerProperties diff --git a/src/integration-test/kotlin/de/bixilon/minosoft/gui/rendering/textures/TextureReadingTest.kt b/src/integration-test/kotlin/de/bixilon/minosoft/gui/rendering/textures/TextureReadingTest.kt index cc1fd6aab8..0c6697a1b4 100644 --- a/src/integration-test/kotlin/de/bixilon/minosoft/gui/rendering/textures/TextureReadingTest.kt +++ b/src/integration-test/kotlin/de/bixilon/minosoft/gui/rendering/textures/TextureReadingTest.kt @@ -14,8 +14,8 @@ package de.bixilon.minosoft.gui.rendering.textures import de.bixilon.kotlinglm.vec2.Vec2i +import de.bixilon.kutil.stream.InputStreamUtil.readAll import de.bixilon.kutil.unsafe.UnsafeUtil.setUnsafeAccessible -import de.bixilon.minosoft.assets.util.InputStreamUtil.readAll import de.bixilon.minosoft.gui.rendering.system.base.texture.data.buffer.RGB8Buffer import de.bixilon.minosoft.gui.rendering.system.base.texture.data.buffer.RGBA8Buffer import de.bixilon.minosoft.gui.rendering.system.base.texture.data.buffer.TextureBuffer diff --git a/src/integration-test/kotlin/de/bixilon/minosoft/gui/rendering/tint/tints/grass/GrassTintCalculatorTest.kt b/src/integration-test/kotlin/de/bixilon/minosoft/gui/rendering/tint/tints/grass/GrassTintCalculatorTest.kt index 03611f2c11..03bfa0bcdd 100644 --- a/src/integration-test/kotlin/de/bixilon/minosoft/gui/rendering/tint/tints/grass/GrassTintCalculatorTest.kt +++ b/src/integration-test/kotlin/de/bixilon/minosoft/gui/rendering/tint/tints/grass/GrassTintCalculatorTest.kt @@ -13,8 +13,8 @@ package de.bixilon.minosoft.gui.rendering.tint.tints.grass +import de.bixilon.kutil.stream.InputStreamUtil.readAll import de.bixilon.minosoft.assets.MemoryAssetsManager -import de.bixilon.minosoft.assets.util.InputStreamUtil.readAll import org.testng.Assert.assertEquals import org.testng.annotations.Test diff --git a/src/integration-test/kotlin/de/bixilon/minosoft/protocol/network/connection/play/ConnectionTestUtil.kt b/src/integration-test/kotlin/de/bixilon/minosoft/protocol/network/connection/play/ConnectionTestUtil.kt index c0233c29a4..273c613835 100644 --- a/src/integration-test/kotlin/de/bixilon/minosoft/protocol/network/connection/play/ConnectionTestUtil.kt +++ b/src/integration-test/kotlin/de/bixilon/minosoft/protocol/network/connection/play/ConnectionTestUtil.kt @@ -15,7 +15,7 @@ package de.bixilon.minosoft.protocol.network.connection.play import de.bixilon.kotlinglm.pow import de.bixilon.kutil.observer.DataObserver -import de.bixilon.kutil.reflection.ReflectionUtil.forceSet +import de.bixilon.kutil.reflection.ReflectionUtil.field import de.bixilon.kutil.reflection.ReflectionUtil.jvmField import de.bixilon.minosoft.assets.connection.ConnectionAssetsManager import de.bixilon.minosoft.assets.minecraft.MinecraftPackFormat.packFormat @@ -51,21 +51,21 @@ object ConnectionTestUtil { reference() } - private val LANGUAGE = PlayConnection::language.jvmField - private val SEQUENCE = PlayConnection::sequence.jvmField - private val ACCOUNT = PlayConnection::account.jvmField - private val VERSION = PlayConnection::version.jvmField - private val REGISTRIES = PlayConnection::registries.jvmField - private val WORLD = PlayConnection::world.jvmField - private val PLAYER = PlayConnection::player.jvmField - private val NETWORK = PlayConnection::network.jvmField - private val EVENTS = PlayConnection::events.jvmField - private val PROFILES = PlayConnection::profiles.jvmField - private val ASSETS_MANAGER = PlayConnection::assetsManager.jvmField - private val STATE = PlayConnection::state.jvmField - private val TAGS = PlayConnection::tags.jvmField - private val LEGACY_TAGS = PlayConnection::legacyTags.jvmField - private val CAMERA = PlayConnection::camera.jvmField + private val LANGUAGE = PlayConnection::language.jvmField.field + private val SEQUENCE = PlayConnection::sequence.jvmField.field + private val ACCOUNT = PlayConnection::account.jvmField.field + private val VERSION = PlayConnection::version.jvmField.field + private val REGISTRIES = PlayConnection::registries.jvmField.field + private val WORLD = PlayConnection::world.jvmField.field + private val PLAYER = PlayConnection::player.jvmField.field + private val NETWORK = PlayConnection::network.jvmField.field + private val EVENTS = PlayConnection::events.jvmField.field + private val PROFILES = PlayConnection::profiles.jvmField.field + private val ASSETS_MANAGER = PlayConnection::assetsManager.jvmField.field + private val STATE = PlayConnection::state.jvmField.field + private val TAGS = PlayConnection::tags.jvmField.field + private val LEGACY_TAGS = PlayConnection::legacyTags.jvmField.field + private val CAMERA = PlayConnection::camera.jvmField.field private val language = LanguageManager() private val signature = OBJENESIS.newInstance(SignatureKeyManagement::class.java) @@ -73,25 +73,25 @@ object ConnectionTestUtil { fun createConnection(worldSize: Int = 0, light: Boolean = false, version: String? = null): PlayConnection { val connection = OBJENESIS.newInstance(PlayConnection::class.java) - LANGUAGE.forceSet(connection, language) + LANGUAGE.set(connection, language) val version = if (version == null) IT.VERSION else Versions[version] ?: throw IllegalArgumentException("Can not find version: $version") - SEQUENCE.forceSet(connection, AtomicInteger(1)) - ACCOUNT.forceSet(connection, TestAccount) - VERSION.forceSet(connection, version) - REGISTRIES.forceSet(connection, Registries()) + SEQUENCE.set(connection, AtomicInteger(1)) + ACCOUNT.set(connection, TestAccount) + VERSION.set(connection, version) + REGISTRIES.set(connection, Registries()) connection.registries.updateFlattened(version.flattened) connection.registries.parent = if (version == IT.VERSION) IT.REGISTRIES else ITUtil.loadRegistries(version) - WORLD.forceSet(connection, createWorld(connection, light, (worldSize * 2 + 1).pow(2))) - PLAYER.forceSet(connection, LocalPlayerEntity(connection.account, connection, signature)) + WORLD.set(connection, createWorld(connection, light, (worldSize * 2 + 1).pow(2))) + PLAYER.set(connection, LocalPlayerEntity(connection.account, connection, signature)) connection.player.startInit() - NETWORK.forceSet(connection, TestNetwork(connection)) - EVENTS.forceSet(connection, EventMaster()) - PROFILES.forceSet(connection, profiles) - ASSETS_MANAGER.forceSet(connection, ConnectionAssetsManager(AssetsManagerProperties(PackProperties(version.packFormat)))) - STATE.forceSet(connection, DataObserver(PlayConnectionStates.PLAYING)) - TAGS.forceSet(connection, TagManager()) - LEGACY_TAGS.forceSet(connection, FALLBACK_TAGS) - CAMERA.forceSet(connection, ConnectionCamera(connection)) + NETWORK.set(connection, TestNetwork(connection)) + EVENTS.set(connection, EventMaster()) + PROFILES.set(connection, profiles) + ASSETS_MANAGER.set(connection, ConnectionAssetsManager(AssetsManagerProperties(PackProperties(version.packFormat)))) + STATE.set(connection, DataObserver(PlayConnectionStates.PLAYING)) + TAGS.set(connection, TagManager()) + LEGACY_TAGS.set(connection, FALLBACK_TAGS) + CAMERA.set(connection, ConnectionCamera(connection)) connection.camera.init() if (worldSize > 0) { connection.world.initialize(worldSize) { DummyBiomeSource(null) } diff --git a/src/integration-test/kotlin/de/bixilon/minosoft/protocol/packets/s2c/play/PacketReadingTestUtil.kt b/src/integration-test/kotlin/de/bixilon/minosoft/protocol/packets/s2c/play/PacketReadingTestUtil.kt index b69f6e5b8f..dce8fdc788 100644 --- a/src/integration-test/kotlin/de/bixilon/minosoft/protocol/packets/s2c/play/PacketReadingTestUtil.kt +++ b/src/integration-test/kotlin/de/bixilon/minosoft/protocol/packets/s2c/play/PacketReadingTestUtil.kt @@ -13,7 +13,7 @@ package de.bixilon.minosoft.protocol.packets.s2c.play -import de.bixilon.minosoft.assets.util.InputStreamUtil.readAll +import de.bixilon.kutil.stream.InputStreamUtil.readAll import de.bixilon.minosoft.protocol.network.connection.play.ConnectionTestUtil import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection import de.bixilon.minosoft.protocol.packets.s2c.S2CPacket diff --git a/src/integration-test/kotlin/de/bixilon/minosoft/protocol/packets/s2c/play/chunk/ChunkS2CPTest.kt b/src/integration-test/kotlin/de/bixilon/minosoft/protocol/packets/s2c/play/chunk/ChunkS2CPTest.kt index d51b1c6b4b..4a0039d4de 100644 --- a/src/integration-test/kotlin/de/bixilon/minosoft/protocol/packets/s2c/play/chunk/ChunkS2CPTest.kt +++ b/src/integration-test/kotlin/de/bixilon/minosoft/protocol/packets/s2c/play/chunk/ChunkS2CPTest.kt @@ -17,8 +17,8 @@ import de.bixilon.kotlinglm.vec2.Vec2i import de.bixilon.kutil.cast.CastUtil.unsafeCast import de.bixilon.kutil.observer.DataObserver import de.bixilon.kutil.reflection.ReflectionUtil.forceSet +import de.bixilon.kutil.stream.InputStreamUtil.readAll import de.bixilon.mbf.MBFBinaryReader -import de.bixilon.minosoft.assets.util.InputStreamUtil.readAll import de.bixilon.minosoft.data.registries.blocks.MinecraftBlocks import de.bixilon.minosoft.data.registries.blocks.state.BlockState import de.bixilon.minosoft.data.registries.blocks.types.building.stone.StoneBlock diff --git a/src/integration-test/kotlin/de/bixilon/minosoft/protocol/packets/s2c/play/chunk/ChunksS2CPTest.kt b/src/integration-test/kotlin/de/bixilon/minosoft/protocol/packets/s2c/play/chunk/ChunksS2CPTest.kt index 1c34d555dd..f1e2165eba 100644 --- a/src/integration-test/kotlin/de/bixilon/minosoft/protocol/packets/s2c/play/chunk/ChunksS2CPTest.kt +++ b/src/integration-test/kotlin/de/bixilon/minosoft/protocol/packets/s2c/play/chunk/ChunksS2CPTest.kt @@ -15,7 +15,7 @@ package de.bixilon.minosoft.protocol.packets.s2c.play.chunk import de.bixilon.kutil.observer.DataObserver import de.bixilon.kutil.reflection.ReflectionUtil.forceSet -import de.bixilon.minosoft.assets.util.InputStreamUtil.readAll +import de.bixilon.kutil.stream.InputStreamUtil.readAll import de.bixilon.minosoft.data.registries.dimension.DimensionProperties import de.bixilon.minosoft.data.world.positions.ChunkPosition import de.bixilon.minosoft.protocol.network.connection.play.ConnectionTestUtil.createConnection diff --git a/src/integration-test/resources/mods/dummy/dummy/de/bixilon/minosoft/modding/dummy/DummyMod.class b/src/integration-test/resources/mods/dummy/dummy/de/bixilon/minosoft/modding/dummy/DummyMod.class index d1c1e5d7e9ff42093597e8c34efa4f7a8150e5aa..8f0dbed72850f68b3061b2a1defa8d302f34a76a 100644 GIT binary patch delta 185 zcmdlYwp?sO6qAH{N~(TRW<_RBex81IX-Q^|esM`rYGUr>DkcR`+|0cE;{3Fd_{_YL)bygn zlFaCs7_=t~a4G6BvoP*p@Y>9vvJoi6#E=9e`52giqyhsM YgCc_#gAzkBkjKNo2qd*9CvY7H0IaSvcK`qY diff --git a/src/integration-test/resources/mods/dummy/dummy/de/bixilon/minosoft/modding/dummy/DummyMod.kt b/src/integration-test/resources/mods/dummy/dummy/de/bixilon/minosoft/modding/dummy/DummyMod.kt index 12a86dc316..329ce1c203 100644 --- a/src/integration-test/resources/mods/dummy/dummy/de/bixilon/minosoft/modding/dummy/DummyMod.kt +++ b/src/integration-test/resources/mods/dummy/dummy/de/bixilon/minosoft/modding/dummy/DummyMod.kt @@ -1,6 +1,6 @@ /* * Minosoft - * Copyright (C) 2020-2023 Moritz Zwerger + * Copyright (C) 2020-2024 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.modding.dummy -import de.bixilon.minosoft.assets.util.InputStreamUtil.readAsString +import de.bixilon.kutil.stream.InputStreamUtil.readAsString import de.bixilon.minosoft.data.registries.identified.ResourceLocation import de.bixilon.minosoft.modding.loader.mod.ModMain diff --git a/src/main/java/de/bixilon/minosoft/assets/directory/DirectoryAssetsManager.kt b/src/main/java/de/bixilon/minosoft/assets/directory/DirectoryAssetsManager.kt index b2a2a37603..cb2a7c8e20 100644 --- a/src/main/java/de/bixilon/minosoft/assets/directory/DirectoryAssetsManager.kt +++ b/src/main/java/de/bixilon/minosoft/assets/directory/DirectoryAssetsManager.kt @@ -14,12 +14,12 @@ package de.bixilon.minosoft.assets.directory import de.bixilon.kutil.latch.AbstractLatch +import de.bixilon.kutil.stream.InputStreamUtil.readAll import de.bixilon.minosoft.assets.AssetsManager import de.bixilon.minosoft.assets.properties.manager.AssetsManagerProperties import de.bixilon.minosoft.assets.util.FileAssetsUtil.normalizePath import de.bixilon.minosoft.assets.util.FileAssetsUtil.toAssetName import de.bixilon.minosoft.assets.util.FileUtil -import de.bixilon.minosoft.assets.util.InputStreamUtil.readAll import de.bixilon.minosoft.assets.util.InputStreamUtil.readJson import de.bixilon.minosoft.data.registries.identified.ResourceLocation import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet diff --git a/src/main/java/de/bixilon/minosoft/assets/file/ZipAssetsManager.kt b/src/main/java/de/bixilon/minosoft/assets/file/ZipAssetsManager.kt index 322a2b6c58..f7738bf8ee 100644 --- a/src/main/java/de/bixilon/minosoft/assets/file/ZipAssetsManager.kt +++ b/src/main/java/de/bixilon/minosoft/assets/file/ZipAssetsManager.kt @@ -14,10 +14,10 @@ package de.bixilon.minosoft.assets.file import de.bixilon.kutil.latch.AbstractLatch +import de.bixilon.kutil.stream.InputStreamUtil.readAll import de.bixilon.minosoft.assets.AssetsManager import de.bixilon.minosoft.assets.util.FileAssetsUtil.normalizePath import de.bixilon.minosoft.assets.util.FileAssetsUtil.toAssetName -import de.bixilon.minosoft.assets.util.InputStreamUtil.readAll import de.bixilon.minosoft.assets.util.InputStreamUtil.readJson import de.bixilon.minosoft.data.registries.identified.ResourceLocation import java.io.File diff --git a/src/main/java/de/bixilon/minosoft/assets/util/FileAssetsUtil.kt b/src/main/java/de/bixilon/minosoft/assets/util/FileAssetsUtil.kt index 87f5d25669..a1be8a48b7 100644 --- a/src/main/java/de/bixilon/minosoft/assets/util/FileAssetsUtil.kt +++ b/src/main/java/de/bixilon/minosoft/assets/util/FileAssetsUtil.kt @@ -17,10 +17,10 @@ import com.github.luben.zstd.ZstdInputStream import com.github.luben.zstd.ZstdOutputStream import de.bixilon.kutil.array.ByteArrayUtil.toHex import de.bixilon.kutil.file.FileUtil.createParent +import de.bixilon.kutil.stream.InputStreamUtil.copy import de.bixilon.minosoft.assets.AssetsManager import de.bixilon.minosoft.assets.util.HashTypes.Companion.hashType import de.bixilon.minosoft.data.registries.identified.ResourceLocation -import de.bixilon.minosoft.util.KUtil.copy import de.bixilon.minosoft.util.logging.Log import de.bixilon.minosoft.util.logging.LogLevels import de.bixilon.minosoft.util.logging.LogMessageType diff --git a/src/main/java/de/bixilon/minosoft/assets/util/InputStreamUtil.kt b/src/main/java/de/bixilon/minosoft/assets/util/InputStreamUtil.kt index 4dfcf7ffad..a6fd61d396 100644 --- a/src/main/java/de/bixilon/minosoft/assets/util/InputStreamUtil.kt +++ b/src/main/java/de/bixilon/minosoft/assets/util/InputStreamUtil.kt @@ -16,10 +16,10 @@ package de.bixilon.minosoft.assets.util import com.fasterxml.jackson.databind.JavaType import com.fasterxml.jackson.databind.ObjectReader import com.fasterxml.jackson.module.kotlin.readValue -import de.bixilon.kutil.buffer.BufferDefinition import de.bixilon.kutil.cast.CastUtil.unsafeCast import de.bixilon.kutil.exception.ExceptionUtil.ignoreAll import de.bixilon.kutil.json.JsonObject +import de.bixilon.kutil.stream.InputStreamUtil.readAll import de.bixilon.mbf.MBFBinaryReader import de.bixilon.minosoft.util.json.Jackson import org.kamranzafar.jtar.TarInputStream @@ -28,27 +28,6 @@ import java.util.zip.ZipInputStream object InputStreamUtil { - @Deprecated("kutil 1.26") - fun InputStream.readAsString(close: Boolean = true): String { - val builder = StringBuilder() - - val buffer = ByteArray(BufferDefinition.DEFAULT_BUFFER_SIZE) - var length: Int - - while (true) { - length = this.read(buffer, 0, buffer.size) - if (length < 0) { - break - } - builder.append(String(buffer, 0, length, Charsets.UTF_8)) - } - if (close) { - this.close() - } - - return builder.toString() - } - fun InputStream.readJsonObject(close: Boolean = true): JsonObject { return readJson(close = close, reader = Jackson.MAP_READER) } @@ -110,12 +89,4 @@ object InputStreamUtil { fun InputStream.readMBFMap(): Map { return this.use { MBFBinaryReader(this).readMBF().data.unsafeCast() } } - - @Deprecated("kutil 1.26") - fun InputStream.readAll(close: Boolean = true): ByteArray { - if (close) { - return use { readAllBytes() } - } - return readAllBytes() - } } diff --git a/src/main/java/de/bixilon/minosoft/config/profile/storage/StorageProfileManager.kt b/src/main/java/de/bixilon/minosoft/config/profile/storage/StorageProfileManager.kt index c91ae56678..7e6ec20d95 100644 --- a/src/main/java/de/bixilon/minosoft/config/profile/storage/StorageProfileManager.kt +++ b/src/main/java/de/bixilon/minosoft/config/profile/storage/StorageProfileManager.kt @@ -1,6 +1,6 @@ /* * Minosoft - * Copyright (C) 2020-2023 Moritz Zwerger + * Copyright (C) 2020-2024 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. * @@ -26,8 +26,8 @@ import de.bixilon.kutil.file.watcher.FileWatcherService import de.bixilon.kutil.observer.DataObserver.Companion.observe import de.bixilon.kutil.observer.DataObserver.Companion.observed import de.bixilon.kutil.observer.map.bi.BiMapObserver.Companion.observedBiMap +import de.bixilon.kutil.stream.InputStreamUtil.readAsString import de.bixilon.minosoft.assets.util.FileUtil.mkdirParent -import de.bixilon.minosoft.assets.util.InputStreamUtil.readAsString import de.bixilon.minosoft.config.profile.ProfileType import de.bixilon.minosoft.config.profile.ProfileUtil.isValidName import de.bixilon.minosoft.config.profile.profiles.Profile diff --git a/src/main/java/de/bixilon/minosoft/data/entities/entities/Entity.kt b/src/main/java/de/bixilon/minosoft/data/entities/entities/Entity.kt index 97537fb111..ca019b920d 100644 --- a/src/main/java/de/bixilon/minosoft/data/entities/entities/Entity.kt +++ b/src/main/java/de/bixilon/minosoft/data/entities/entities/Entity.kt @@ -1,6 +1,6 @@ /* * Minosoft - * Copyright (C) 2020-2023 Moritz Zwerger + * Copyright (C) 2020-2024 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.kutil.bit.BitByte.isBitMask import de.bixilon.kutil.cast.CastUtil.unsafeCast import de.bixilon.kutil.cast.CastUtil.unsafeNull import de.bixilon.kutil.primitive.BooleanUtil.toBoolean -import de.bixilon.kutil.reflection.ReflectionUtil.forceSet +import de.bixilon.kutil.reflection.ReflectionUtil.field import de.bixilon.kutil.reflection.ReflectionUtil.getFieldOrNull import de.bixilon.kutil.reflection.ReflectionUtil.jvmField import de.bixilon.kutil.time.TimeUtil.millis @@ -242,12 +242,12 @@ abstract class Entity( override fun init() { - DEFAULT_AABB.forceSet(this, createDefaultAABB()) - PHYSICS.forceSet(this, createPhysics()) + DEFAULT_AABB.set(this, createDefaultAABB()) + PHYSICS.set(this, createPhysics()) forceTeleport(initialPosition) forceRotate(initialRotation) if (!RunConfiguration.DISABLE_RENDERING) { - RENDER_INFO[this] = EntityRenderInfo(this) + RENDER_INFO.set(this, EntityRenderInfo(this)) } } @@ -262,9 +262,9 @@ abstract class Entity( companion object { - private val RENDER_INFO = Entity::renderInfo.jvmField - private val DEFAULT_AABB = Entity::defaultAABB.jvmField - private val PHYSICS = Entity::class.java.getFieldOrNull("physics")!! + private val RENDER_INFO = Entity::renderInfo.jvmField.field + private val DEFAULT_AABB = Entity::defaultAABB.jvmField.field + private val PHYSICS = Entity::class.java.getFieldOrNull("physics")!!.field val FLAGS_DATA = EntityDataField("ENTITY_FLAGS") val AIR_SUPPLY_DATA = EntityDataField("ENTITY_AIR_SUPPLY") diff --git a/src/main/java/de/bixilon/minosoft/example/ExampleMod.kt b/src/main/java/de/bixilon/minosoft/example/ExampleMod.kt index ebc3e1da21..103493a277 100644 --- a/src/main/java/de/bixilon/minosoft/example/ExampleMod.kt +++ b/src/main/java/de/bixilon/minosoft/example/ExampleMod.kt @@ -1,6 +1,6 @@ /* * Minosoft - * Copyright (C) 2020-2023 Moritz Zwerger + * Copyright (C) 2020-2024 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.example import de.bixilon.kutil.observer.DataObserver.Companion.observe -import de.bixilon.minosoft.assets.util.InputStreamUtil.readAsString +import de.bixilon.kutil.stream.InputStreamUtil.readAsString import de.bixilon.minosoft.modding.event.events.chat.ChatMessageEvent import de.bixilon.minosoft.modding.event.events.connection.play.PlayConnectionCreateEvent import de.bixilon.minosoft.modding.event.listener.CallbackEventListener.Companion.listen diff --git a/src/main/java/de/bixilon/minosoft/gui/rendering/font/types/unicode/unihex/UnihexFontType.kt b/src/main/java/de/bixilon/minosoft/gui/rendering/font/types/unicode/unihex/UnihexFontType.kt index 88e39c8fb2..c321fe4bfa 100644 --- a/src/main/java/de/bixilon/minosoft/gui/rendering/font/types/unicode/unihex/UnihexFontType.kt +++ b/src/main/java/de/bixilon/minosoft/gui/rendering/font/types/unicode/unihex/UnihexFontType.kt @@ -1,6 +1,6 @@ /* * Minosoft - * Copyright (C) 2020-2023 Moritz Zwerger + * Copyright (C) 2020-2024 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,7 @@ package de.bixilon.minosoft.gui.rendering.font.types.unicode.unihex +import de.bixilon.kutil.hex.HexUtil.fromHex import de.bixilon.kutil.json.JsonObject import de.bixilon.minosoft.data.registries.identified.Namespaces.minecraft import de.bixilon.minosoft.data.registries.identified.ResourceLocation @@ -79,15 +80,6 @@ class UnihexFontType( return UnihexFontType(rasterized) } - fun Int.fromHex(): Int { - return this - when (this) { - in '0'.code..'9'.code -> '0'.code - in 'a'.code..'f'.code -> 'a'.code - 0x0A - in 'A'.code..'F'.code -> 'A'.code - 0x0A - else -> throw IllegalArgumentException("Invalid hex char: ${toChar()}!") - } - } - private fun InputStream.readHexInt(): Int { var value = 0 while (true) { @@ -95,6 +87,7 @@ class UnihexFontType( if (byte < 0 || byte == '\n'.code) return -1 if (byte == ':'.code) break // separator val hex = byte.fromHex() + if (hex < 0) throw IllegalArgumentException("Invalid hex char: ${byte.toChar()}!") value = (value shl 4) or hex } @@ -110,6 +103,8 @@ class UnihexFontType( if (byte < 0) break if (byte == '\n'.code) break // separator val hex = byte.fromHex() + if (hex < 0) throw IllegalArgumentException("Invalid hex char: ${byte.toChar()}!") + if (index % 2 == 0) { // most significant bits diff --git a/src/main/java/de/bixilon/minosoft/gui/rendering/sound/sounds/SoundData.kt b/src/main/java/de/bixilon/minosoft/gui/rendering/sound/sounds/SoundData.kt index c0117aa5cb..6f7436e917 100644 --- a/src/main/java/de/bixilon/minosoft/gui/rendering/sound/sounds/SoundData.kt +++ b/src/main/java/de/bixilon/minosoft/gui/rendering/sound/sounds/SoundData.kt @@ -13,8 +13,8 @@ package de.bixilon.minosoft.gui.rendering.sound.sounds +import de.bixilon.kutil.stream.InputStreamUtil.readAll import de.bixilon.minosoft.assets.AssetsManager -import de.bixilon.minosoft.assets.util.InputStreamUtil.readAll import org.lwjgl.BufferUtils import org.lwjgl.openal.AL10.AL_FORMAT_MONO16 import org.lwjgl.openal.AL10.AL_FORMAT_STEREO16 diff --git a/src/main/java/de/bixilon/minosoft/gui/rendering/system/base/shader/code/glsl/GLSLShaderCode.kt b/src/main/java/de/bixilon/minosoft/gui/rendering/system/base/shader/code/glsl/GLSLShaderCode.kt index 6e407854fc..712152c841 100644 --- a/src/main/java/de/bixilon/minosoft/gui/rendering/system/base/shader/code/glsl/GLSLShaderCode.kt +++ b/src/main/java/de/bixilon/minosoft/gui/rendering/system/base/shader/code/glsl/GLSLShaderCode.kt @@ -1,6 +1,6 @@ /* * Minosoft - * Copyright (C) 2020-2023 Moritz Zwerger + * Copyright (C) 2020-2024 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.shader.code.glsl -import de.bixilon.minosoft.assets.util.InputStreamUtil.readAsString +import de.bixilon.kutil.stream.InputStreamUtil.readAsString import de.bixilon.minosoft.commands.util.StringReader import de.bixilon.minosoft.data.registries.identified.ResourceLocation import de.bixilon.minosoft.gui.rendering.RenderContext diff --git a/src/main/java/de/bixilon/minosoft/gui/rendering/system/opengl/OpenGLNativeShader.kt b/src/main/java/de/bixilon/minosoft/gui/rendering/system/opengl/OpenGLNativeShader.kt index 865138fd70..3c454d5575 100644 --- a/src/main/java/de/bixilon/minosoft/gui/rendering/system/opengl/OpenGLNativeShader.kt +++ b/src/main/java/de/bixilon/minosoft/gui/rendering/system/opengl/OpenGLNativeShader.kt @@ -1,6 +1,6 @@ /* * Minosoft - * Copyright (C) 2020-2023 Moritz Zwerger + * Copyright (C) 2020-2024 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.vec3.Vec3 import de.bixilon.kotlinglm.vec4.Vec4 import de.bixilon.kutil.cast.CastUtil.unsafeCast import de.bixilon.kutil.exception.ExceptionUtil.catchAll -import de.bixilon.minosoft.assets.util.InputStreamUtil.readAsString +import de.bixilon.kutil.stream.InputStreamUtil.readAsString import de.bixilon.minosoft.data.registries.identified.ResourceLocation import de.bixilon.minosoft.data.text.formatting.color.RGBColor import de.bixilon.minosoft.gui.rendering.RenderContext diff --git a/src/main/java/de/bixilon/minosoft/gui/rendering/util/vec/vec3/Vec3iUtil.kt b/src/main/java/de/bixilon/minosoft/gui/rendering/util/vec/vec3/Vec3iUtil.kt index 43a313096a..d8d8fa5461 100644 --- a/src/main/java/de/bixilon/minosoft/gui/rendering/util/vec/vec3/Vec3iUtil.kt +++ b/src/main/java/de/bixilon/minosoft/gui/rendering/util/vec/vec3/Vec3iUtil.kt @@ -1,6 +1,6 @@ /* * Minosoft - * Copyright (C) 2020-2023 Moritz Zwerger + * Copyright (C) 2020-2024 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. * @@ -18,7 +18,6 @@ import de.bixilon.kotlinglm.vec3.Vec3 import de.bixilon.kotlinglm.vec3.Vec3i import de.bixilon.kutil.primitive.IntUtil.toInt import de.bixilon.minosoft.data.Axes -import de.bixilon.minosoft.gui.rendering.util.VecUtil.inSectionHeight import de.bixilon.minosoft.gui.rendering.util.VecUtil.sectionHeight object Vec3iUtil { @@ -44,9 +43,6 @@ object Vec3iUtil { val Vec3i.inChunkPosition: Vec3i get() = Vec3i(x and 0x0F, y, this.z and 0x0F) - @Deprecated("chunk data types") - val Vec3i.inChunkSectionPosition: Vec3i - get() = Vec3i(x and 0x0F, y.inSectionHeight, z and 0x0F) fun Vec3i.toVec3(): Vec3 { val array = array diff --git a/src/main/java/de/bixilon/minosoft/modding/loader/LoaderUtil.kt b/src/main/java/de/bixilon/minosoft/modding/loader/LoaderUtil.kt index 1eabf97c5d..588cf8803e 100644 --- a/src/main/java/de/bixilon/minosoft/modding/loader/LoaderUtil.kt +++ b/src/main/java/de/bixilon/minosoft/modding/loader/LoaderUtil.kt @@ -15,8 +15,8 @@ package de.bixilon.minosoft.modding.loader import de.bixilon.kutil.cast.CastUtil.unsafeCast import de.bixilon.kutil.reflection.ReflectionUtil.getFieldOrNull +import de.bixilon.kutil.stream.InputStreamUtil.readAll import de.bixilon.minosoft.assets.util.FileAssetsUtil.normalizePath -import de.bixilon.minosoft.assets.util.InputStreamUtil.readAll import org.xeustechnologies.jcl.JarClassLoader import org.xeustechnologies.jcl.JarResources import org.xeustechnologies.jcl.JclJarEntry diff --git a/src/main/java/de/bixilon/minosoft/modding/loader/mod/source/DirectorySource.kt b/src/main/java/de/bixilon/minosoft/modding/loader/mod/source/DirectorySource.kt index 6065fbbe0e..87e230ce4b 100644 --- a/src/main/java/de/bixilon/minosoft/modding/loader/mod/source/DirectorySource.kt +++ b/src/main/java/de/bixilon/minosoft/modding/loader/mod/source/DirectorySource.kt @@ -13,8 +13,8 @@ package de.bixilon.minosoft.modding.loader.mod.source +import de.bixilon.kutil.stream.InputStreamUtil.readAll import de.bixilon.minosoft.assets.directory.DirectoryAssetsManager -import de.bixilon.minosoft.assets.util.InputStreamUtil.readAll import de.bixilon.minosoft.assets.util.InputStreamUtil.readJson import de.bixilon.minosoft.data.text.BaseComponent import de.bixilon.minosoft.data.text.TextComponent diff --git a/src/main/java/de/bixilon/minosoft/updater/MinosoftUpdater.kt b/src/main/java/de/bixilon/minosoft/updater/MinosoftUpdater.kt index 09713bd0fc..702a8de092 100644 --- a/src/main/java/de/bixilon/minosoft/updater/MinosoftUpdater.kt +++ b/src/main/java/de/bixilon/minosoft/updater/MinosoftUpdater.kt @@ -21,6 +21,7 @@ import de.bixilon.kutil.hash.HashUtil import de.bixilon.kutil.observer.DataObserver.Companion.observed import de.bixilon.kutil.os.PlatformInfo import de.bixilon.kutil.shutdown.ShutdownManager +import de.bixilon.kutil.stream.InputStreamUtil.copy import de.bixilon.kutil.string.StringUtil.formatPlaceholder import de.bixilon.kutil.url.URLUtil.toURL import de.bixilon.minosoft.assets.util.FileUtil @@ -28,7 +29,6 @@ import de.bixilon.minosoft.config.profile.profiles.other.OtherProfileManager import de.bixilon.minosoft.properties.MinosoftProperties import de.bixilon.minosoft.terminal.CommandLineArguments import de.bixilon.minosoft.terminal.RunConfiguration -import de.bixilon.minosoft.util.KUtil.copy import de.bixilon.minosoft.util.http.HTTP2.get import de.bixilon.minosoft.util.http.HTTPResponse import de.bixilon.minosoft.util.http.exceptions.HTTPException diff --git a/src/main/java/de/bixilon/minosoft/util/KUtil.kt b/src/main/java/de/bixilon/minosoft/util/KUtil.kt index 228d6804bd..aa819a4388 100644 --- a/src/main/java/de/bixilon/minosoft/util/KUtil.kt +++ b/src/main/java/de/bixilon/minosoft/util/KUtil.kt @@ -21,7 +21,6 @@ import de.bixilon.kotlinglm.vec2.Vec2t import de.bixilon.kotlinglm.vec3.Vec3d import de.bixilon.kotlinglm.vec3.Vec3t import de.bixilon.kotlinglm.vec4.Vec4t -import de.bixilon.kutil.buffer.BufferDefinition import de.bixilon.kutil.cast.CastUtil.unsafeCast import de.bixilon.kutil.collections.CollectionUtil.synchronizedListOf import de.bixilon.kutil.collections.CollectionUtil.synchronizedMapOf @@ -30,7 +29,6 @@ import de.bixilon.kutil.collections.CollectionUtil.toSynchronizedSet import de.bixilon.kutil.concurrent.pool.DefaultThreadPool import de.bixilon.kutil.concurrent.pool.runnable.ForcePooledRunnable import de.bixilon.kutil.concurrent.schedule.TaskScheduler -import de.bixilon.kutil.exception.ExceptionUtil import de.bixilon.kutil.primitive.BooleanUtil.decide import de.bixilon.kutil.primitive.DoubleUtil import de.bixilon.kutil.primitive.DoubleUtil.matches @@ -71,11 +69,7 @@ import io.netty.channel.SimpleChannelInboundHandler import javafx.application.Platform import org.kamranzafar.jtar.TarHeader import java.io.FileOutputStream -import java.io.InputStream -import java.io.OutputStream -import java.security.MessageDigest import java.security.SecureRandom -import java.security.Signature import java.util.* import javax.net.ssl.SSLContext @@ -361,29 +355,4 @@ object KUtil { stream.close() println("Packet dumped to $path") } - - - @Deprecated("kutil 1.26") - fun InputStream.copy(vararg output: OutputStream, digest: MessageDigest? = null, signature: Signature? = null, closeIn: Boolean = true, closeOut: Boolean = true) { - val buffer = ByteArray(BufferDefinition.DEFAULT_BUFFER_SIZE) - - while (true) { - val length = read(buffer, 0, buffer.size) - if (length < 0) { - break - } - for (stream in output) { - stream.write(buffer, 0, length) - } - digest?.update(buffer, 0, length) - signature?.update(buffer, 0, length) - } - - if (closeIn) ExceptionUtil.ignoreAll { close() } - if (closeOut) { - for (stream in output) { - ExceptionUtil.ignoreAll { stream.close() } - } - } - } } diff --git a/src/main/java/de/bixilon/minosoft/util/signature/SignatureSigner.kt b/src/main/java/de/bixilon/minosoft/util/signature/SignatureSigner.kt index db2e133d69..5c803cd6d0 100644 --- a/src/main/java/de/bixilon/minosoft/util/signature/SignatureSigner.kt +++ b/src/main/java/de/bixilon/minosoft/util/signature/SignatureSigner.kt @@ -13,8 +13,8 @@ package de.bixilon.minosoft.util.signature +import de.bixilon.kutil.stream.InputStreamUtil.readAll import de.bixilon.minosoft.assets.IntegratedAssets -import de.bixilon.minosoft.assets.util.InputStreamUtil.readAll import de.bixilon.minosoft.data.registries.identified.ResourceLocation import java.security.KeyFactory import java.security.PublicKey diff --git a/src/main/java/de/bixilon/minosoft/util/system/DesktopAPI.kt b/src/main/java/de/bixilon/minosoft/util/system/DesktopAPI.kt index 957b98b443..a2820cbdcb 100644 --- a/src/main/java/de/bixilon/minosoft/util/system/DesktopAPI.kt +++ b/src/main/java/de/bixilon/minosoft/util/system/DesktopAPI.kt @@ -13,8 +13,8 @@ package de.bixilon.minosoft.util.system +import de.bixilon.kutil.stream.InputStreamUtil.readAll import de.bixilon.minosoft.assets.IntegratedAssets -import de.bixilon.minosoft.assets.util.InputStreamUtil.readAll import java.awt.Taskbar import java.awt.Toolkit import java.io.File