Skip to content

net.kernelpanicsoft.archie.gui.blockentity

Types

BlockEntityStateContainer

class BlockEntityStateContainer(val blockEntity: BlockEntity)

Wraps a block entity and tracks which properties have changed since the last sync.

BlockEntityStateManager

Server-side manager for tracking and syncing block entity state to clients.

BlockEntityStatePacket

@Serializable



data class BlockEntityStatePacket(
    val pos: SBlockPos, 
    val updates: Map<String, BlockEntityStatePacket.SerializedValue> = emptyMap(), 
    val timestamp: Long = 0
)

A network packet that carries block entity state changes from server to client.

BlockEntityStatePacketRegistry

Registers block entity state packets with ArchieNetworkChannel.

BlockEntityUpdatePacket

@Serializable



data class BlockEntityUpdatePacket(val pos: SBlockPos, val updates: Map<String, BlockEntityStatePacket.SerializedValue>)

A network packet that carries block entity state updates from client to server.

ComposeBlockEntityState

class ComposeBlockEntityState(val pos: BlockPos)

Client-side state holder for a block entity's synchronized properties.

Properties

LocalBlockEntityState

val LocalBlockEntityState: ProvidableCompositionLocal<ComposeBlockEntityState?>

Provides the current block entity state to composables in the composition tree.

Functions

getOrCreateBlockEntityState

Gets or creates a Compose state for a block entity by position.

getStateContainer

Convenience extension to get or create a state container for a block entity.

observeProperty

@Composable



inline fun <T> observeProperty(propertyName: String, initialValue: T? = null): MutableState<T?>

Observes a property on the block entity in the current composition context.

removeBlockEntityState

fun removeBlockEntityState(pos: BlockPos)

Removes a block entity state from the client registry.

toSerializedValue

fun <T> T?.toSerializedValue(serializer: KSerializer<T>): BlockEntityStatePacket.SerializedValue

Extension function to convert common Kotlin types to BlockEntityStatePacket.SerializedValue.