Skip to content

Commit

Permalink
feat: add translation to FurntiureProperties
Browse files Browse the repository at this point in the history
  • Loading branch information
Boy0000 committed Oct 11, 2024
1 parent e06d00d commit 6b52f4e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,21 @@ fun GearyModule.createFurnitureSpawner() = observeWithData<AttemptSpawn>()
val color by get<BlockyFurniture.Color>().orNull()
}) {
event.location.spawn<ItemDisplay> {
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<BukkitEntity>(this)
Expand Down

0 comments on commit 6b52f4e

Please sign in to comment.