From 29a23af3be9a61dd745893fee9860936ea36a70f Mon Sep 17 00:00:00 2001 From: opekope2 Date: Mon, 18 Nov 2024 12:39:54 +0100 Subject: [PATCH] Fix avm_staff:cake crash on servers --- .../main/kotlin/opekope2/avm_staff/api/entity/CakeEntity.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/StaffMod/src/main/kotlin/opekope2/avm_staff/api/entity/CakeEntity.kt b/StaffMod/src/main/kotlin/opekope2/avm_staff/api/entity/CakeEntity.kt index 20ecdc5a3..f22dcacf6 100644 --- a/StaffMod/src/main/kotlin/opekope2/avm_staff/api/entity/CakeEntity.kt +++ b/StaffMod/src/main/kotlin/opekope2/avm_staff/api/entity/CakeEntity.kt @@ -103,6 +103,7 @@ class CakeEntity(entityType: EntityType, world: World) : Entity(enti val particlePerSide = particlePerSide - 1 val width = type.dimensions.width val height = type.dimensions.height + val particleManager = MinecraftClient.getInstance().particleManager for (i in 0..particlePerSide) { for (j in 0..particlePerSide) { @@ -206,11 +207,9 @@ class CakeEntity(entityType: EntityType, world: World) : Entity(enti private val BLOCK_POS = DataTracker.registerData( CakeEntity::class.java, TrackedDataHandlerRegistry.BLOCK_POS ) - private val particleManager by lazy { MinecraftClient.getInstance().particleManager } - private val graphicsModeOption by lazy { MinecraftClient.getInstance().options.graphicsMode } private val particlePerSide: Int @Environment(EnvType.CLIENT) - get() = when (graphicsModeOption.value!!) { + get() = when (MinecraftClient.getInstance().options.graphicsMode.value!!) { GraphicsMode.FAST -> 4 GraphicsMode.FANCY -> 5 GraphicsMode.FABULOUS -> 6