mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-12 17:07:55 -04:00
minor performance and memory improvements
This commit is contained in:
parent
815889cdef
commit
a18d02e605
@ -28,7 +28,7 @@ import java.util.concurrent.locks.ReentrantLock
|
||||
|
||||
object AccountProfileManager : ProfileManager<AccountProfile> {
|
||||
override val namespace = "minosoft:account".toResourceLocation()
|
||||
override val latestVersion = 1
|
||||
override val latestVersion get() = 1
|
||||
override val saveLock = ReentrantLock()
|
||||
override val profileClass = AccountProfile::class.java
|
||||
override val jacksonProfileType: JavaType = Jackson.MAPPER.typeFactory.constructType(profileClass)
|
||||
|
@ -29,7 +29,7 @@ import java.util.concurrent.locks.ReentrantLock
|
||||
|
||||
object AudioProfileManager : ProfileManager<AudioProfile> {
|
||||
override val namespace = "minosoft:audio".toResourceLocation()
|
||||
override val latestVersion = 1
|
||||
override val latestVersion get() = 1
|
||||
override val saveLock = ReentrantLock()
|
||||
override val profileClass = AudioProfile::class.java
|
||||
override val jacksonProfileType: JavaType = Jackson.MAPPER.typeFactory.constructType(profileClass)
|
||||
|
@ -28,7 +28,7 @@ import java.util.concurrent.locks.ReentrantLock
|
||||
|
||||
object BlockProfileManager : ProfileManager<BlockProfile> {
|
||||
override val namespace = "minosoft:block".toResourceLocation()
|
||||
override val latestVersion = 1
|
||||
override val latestVersion get() = 1
|
||||
override val saveLock = ReentrantLock()
|
||||
override val profileClass = BlockProfile::class.java
|
||||
override val jacksonProfileType: JavaType = Jackson.MAPPER.typeFactory.constructType(profileClass)
|
||||
|
@ -28,7 +28,7 @@ import java.util.concurrent.locks.ReentrantLock
|
||||
|
||||
object ConnectionProfileManager : ProfileManager<ConnectionProfile> {
|
||||
override val namespace = "minosoft:connection".toResourceLocation()
|
||||
override val latestVersion = 1
|
||||
override val latestVersion get() = 1
|
||||
override val saveLock = ReentrantLock()
|
||||
override val profileClass = ConnectionProfile::class.java
|
||||
override val jacksonProfileType: JavaType = Jackson.MAPPER.typeFactory.constructType(profileClass)
|
||||
|
@ -28,7 +28,7 @@ import java.util.concurrent.locks.ReentrantLock
|
||||
|
||||
object ControlsProfileManager : ProfileManager<ControlsProfile> {
|
||||
override val namespace = "minosoft:controls".toResourceLocation()
|
||||
override val latestVersion = 1
|
||||
override val latestVersion get() = 1
|
||||
override val saveLock = ReentrantLock()
|
||||
override val profileClass = ControlsProfile::class.java
|
||||
override val jacksonProfileType: JavaType = Jackson.MAPPER.typeFactory.constructType(profileClass)
|
||||
|
@ -28,7 +28,7 @@ import java.util.concurrent.locks.ReentrantLock
|
||||
|
||||
object EntityProfileManager : ProfileManager<EntityProfile> {
|
||||
override val namespace = "minosoft:entity".toResourceLocation()
|
||||
override val latestVersion = 1
|
||||
override val latestVersion get() = 1
|
||||
override val saveLock = ReentrantLock()
|
||||
override val profileClass = EntityProfile::class.java
|
||||
override val jacksonProfileType: JavaType = Jackson.MAPPER.typeFactory.constructType(profileClass)
|
||||
|
@ -37,7 +37,7 @@ import java.util.concurrent.locks.ReentrantLock
|
||||
|
||||
object ErosProfileManager : ProfileManager<ErosProfile> {
|
||||
override val namespace = "minosoft:eros".toResourceLocation()
|
||||
override val latestVersion = 1
|
||||
override val latestVersion get() = 1
|
||||
override val saveLock = ReentrantLock()
|
||||
override val profileClass = ErosProfile::class.java
|
||||
override val jacksonProfileType: JavaType = Jackson.MAPPER.typeFactory.constructType(profileClass)
|
||||
|
@ -28,7 +28,7 @@ import java.util.concurrent.locks.ReentrantLock
|
||||
|
||||
object GUIProfileManager : ProfileManager<GUIProfile> {
|
||||
override val namespace = "minosoft:gui".toResourceLocation()
|
||||
override val latestVersion = 1
|
||||
override val latestVersion get() = 1
|
||||
override val saveLock = ReentrantLock()
|
||||
override val profileClass = GUIProfile::class.java
|
||||
override val jacksonProfileType: JavaType = Jackson.MAPPER.typeFactory.constructType(profileClass)
|
||||
|
@ -28,7 +28,7 @@ import java.util.concurrent.locks.ReentrantLock
|
||||
|
||||
object OtherProfileManager : ProfileManager<OtherProfile> {
|
||||
override val namespace = "minosoft:other".toResourceLocation()
|
||||
override val latestVersion = 2
|
||||
override val latestVersion get() = 2
|
||||
override val saveLock = ReentrantLock()
|
||||
override val profileClass = OtherProfile::class.java
|
||||
override val jacksonProfileType: JavaType = Jackson.MAPPER.typeFactory.constructType(profileClass)
|
||||
|
@ -28,7 +28,7 @@ import java.util.concurrent.locks.ReentrantLock
|
||||
|
||||
object ParticleProfileManager : ProfileManager<ParticleProfile> {
|
||||
override val namespace = "minosoft:particle".toResourceLocation()
|
||||
override val latestVersion = 1
|
||||
override val latestVersion get() = 1
|
||||
override val saveLock = ReentrantLock()
|
||||
override val profileClass = ParticleProfile::class.java
|
||||
override val jacksonProfileType: JavaType = Jackson.MAPPER.typeFactory.constructType(profileClass)
|
||||
|
@ -28,7 +28,7 @@ import java.util.concurrent.locks.ReentrantLock
|
||||
|
||||
object RenderingProfileManager : ProfileManager<RenderingProfile> {
|
||||
override val namespace = "minosoft:rendering".toResourceLocation()
|
||||
override val latestVersion = 1
|
||||
override val latestVersion get() = 1
|
||||
override val saveLock = ReentrantLock()
|
||||
override val profileClass = RenderingProfile::class.java
|
||||
override val jacksonProfileType: JavaType = Jackson.MAPPER.typeFactory.constructType(profileClass)
|
||||
|
@ -28,7 +28,7 @@ import java.util.concurrent.locks.ReentrantLock
|
||||
|
||||
object ResourcesProfileManager : ProfileManager<ResourcesProfile> {
|
||||
override val namespace = "minosoft:resources".toResourceLocation()
|
||||
override val latestVersion = 1
|
||||
override val latestVersion get() = 1
|
||||
override val saveLock = ReentrantLock()
|
||||
override val profileClass = ResourcesProfile::class.java
|
||||
override val jacksonProfileType: JavaType = Jackson.MAPPER.typeFactory.constructType(profileClass)
|
||||
|
@ -16,7 +16,7 @@ package de.bixilon.minosoft.data.world.container.palette.palettes
|
||||
import de.bixilon.minosoft.data.registries.registries.registry.AbstractRegistry
|
||||
|
||||
object BiomePaletteFactory : PaletteFactory {
|
||||
override val edgeBits = 2
|
||||
override val edgeBits get() = 2
|
||||
|
||||
override fun <T : Any?> createPalette(registry: AbstractRegistry<T?>, bits: Int): Palette<T> {
|
||||
return when (bits) {
|
||||
|
@ -16,7 +16,7 @@ package de.bixilon.minosoft.data.world.container.palette.palettes
|
||||
import de.bixilon.minosoft.data.registries.registries.registry.AbstractRegistry
|
||||
|
||||
object BlockStatePaletteFactory : PaletteFactory {
|
||||
override val edgeBits = 4
|
||||
override val edgeBits get() = 4
|
||||
|
||||
override fun <T : Any?> createPalette(registry: AbstractRegistry<T?>, bits: Int): Palette<T> {
|
||||
return when (bits) {
|
||||
|
@ -38,7 +38,7 @@ class PowderSnowOverlay(renderWindow: RenderWindow, z: Float) : SimpleOverlay(re
|
||||
private val OVERLAY_TEXTURE = "misc/powder_snow_outline".toResourceLocation().texture()
|
||||
|
||||
override fun build(renderWindow: RenderWindow, z: Float): PowderSnowOverlay? {
|
||||
if (renderWindow.connection.assetsManager.getOrNull(OVERLAY_TEXTURE) == null) { // ToDo: Don't get twice
|
||||
if (!renderWindow.connection.assetsManager.contains(OVERLAY_TEXTURE)) {
|
||||
// overlay not yet available (< 1.17)
|
||||
return null
|
||||
}
|
||||
|
@ -221,17 +221,15 @@ object ChunkUtil {
|
||||
|
||||
|
||||
private fun readLegacyBiomeArray(buffer: PlayInByteBuffer): XZBiomeArray {
|
||||
val biomes: MutableList<Biome?> = mutableListOf()
|
||||
for (i in 0 until ProtocolDefinition.SECTION_WIDTH_X * ProtocolDefinition.SECTION_WIDTH_Z) {
|
||||
biomes.add(
|
||||
i, buffer.connection.registries.biomeRegistry[if (buffer.versionId < V_1_13_2) { // ToDo: Was V_15W35A, but this can't be correct
|
||||
buffer.readUnsignedByte()
|
||||
} else {
|
||||
buffer.readInt()
|
||||
}]
|
||||
)
|
||||
val biomes: Array<Biome?> = arrayOfNulls(ProtocolDefinition.SECTION_WIDTH_X * ProtocolDefinition.SECTION_WIDTH_Z)
|
||||
for (i in biomes.indices) {
|
||||
biomes[i] = buffer.connection.registries.biomeRegistry[if (buffer.versionId < V_1_13_2) { // ToDo: Was V_15W35A, but this can't be correct
|
||||
buffer.readUnsignedByte()
|
||||
} else {
|
||||
buffer.readInt()
|
||||
}]
|
||||
}
|
||||
return XZBiomeArray(biomes.toTypedArray())
|
||||
return XZBiomeArray(biomes)
|
||||
}
|
||||
|
||||
val Array<Chunk?>.fullyLoaded: Boolean
|
||||
|
Loading…
x
Reference in New Issue
Block a user