From 6b52f4eafed47c653e47958b7db6ef1a20b2e60d Mon Sep 17 00:00:00 2001 From: Boy Date: Fri, 11 Oct 2024 13:48:04 +0200 Subject: [PATCH] feat: add translation to FurntiureProperties --- .../blocky/components/core/BlockyFurniture.kt | 1 + .../systems/AttemptSpawnFurnitureSystem.kt | 25 +++++++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/main/kotlin/com/mineinabyss/blocky/components/core/BlockyFurniture.kt b/src/main/kotlin/com/mineinabyss/blocky/components/core/BlockyFurniture.kt index 00887e37..dfecfad0 100644 --- a/src/main/kotlin/com/mineinabyss/blocky/components/core/BlockyFurniture.kt +++ b/src/main/kotlin/com/mineinabyss/blocky/components/core/BlockyFurniture.kt @@ -85,6 +85,7 @@ data class BlockyFurniture( val itemStack: SerializableItemStack? = null, val displayTransform: ItemDisplayTransform = ItemDisplayTransform.NONE, val scale: @Serializable(Vector3fSerializer::class) Vector3f = Vector3f(1f, 1f, 1f), + val translation: @Serializable(Vector3fSerializer::class) Vector3f = Vector3f(), val displayWidth: Float = 0f, val displayHeight: Float = 0f, val trackingRotation: Billboard = Billboard.FIXED, diff --git a/src/main/kotlin/com/mineinabyss/blocky/systems/AttemptSpawnFurnitureSystem.kt b/src/main/kotlin/com/mineinabyss/blocky/systems/AttemptSpawnFurnitureSystem.kt index 6194e789..99e7dca6 100644 --- a/src/main/kotlin/com/mineinabyss/blocky/systems/AttemptSpawnFurnitureSystem.kt +++ b/src/main/kotlin/com/mineinabyss/blocky/systems/AttemptSpawnFurnitureSystem.kt @@ -16,18 +16,21 @@ fun GearyModule.createFurnitureSpawner() = observeWithData() val color by get().orNull() }) { event.location.spawn { - val props = it.furniture.properties + val properties = it.furniture.properties - isPersistent = props.persistent - itemDisplayTransform = props.displayTransform - displayWidth = props.displayWidth - displayHeight = props.displayHeight - brightness = props.brightness - billboard = props.trackingRotation - props.viewRange?.let { viewRange = it } - props.shadowRadius?.let { shadowRadius = it } - props.shadowStrength?.let { shadowStrength = it } - transformation = transformation.apply { scale.set(props.scale) } + isPersistent = properties.persistent + itemDisplayTransform = properties.displayTransform + displayWidth = properties.displayWidth + displayHeight = properties.displayHeight + brightness = properties.brightness + billboard = properties.trackingRotation + properties.viewRange?.let { viewRange = it } + properties.shadowRadius?.let { shadowRadius = it } + properties.shadowStrength?.let { shadowStrength = it } + transformation = transformation.apply { + scale.set(properties.scale) + translation.set(properties.translation) + } it.color?.let { entity.setPersisting(it) } entity.set(this)