static texture array: don't lock when already loaded

its faster
This commit is contained in:
Moritz Zwerger 2023-12-18 18:06:59 +01:00
parent 6032ed0bdc
commit e95eed923c
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -43,9 +43,14 @@ abstract class StaticTextureArray(
operator fun get(resourceLocation: ResourceLocation): Texture? {
lock.acquire()
val state = state
if (state != TextureArrayStates.UPLOADED) {
lock.acquire()
}
val texture = this.named[resourceLocation]
lock.release()
if (state != TextureArrayStates.UPLOADED) {
lock.release()
}
return texture
}