PlayerAvatar

The player avatar class represents an avatar for the purposes of player information packet. Every player will have a respective avatar that contains basic information about that player, such as their coordinates and how far to render other players.

Properties

Link copied to clipboard
var currentCoord: CoordGrid

The current known coordinate of the given player. The coordinate property will need to be updated for all players prior to computing player info packet for any of them.

Link copied to clipboard

Extended info repository, commonly referred to as "masks", will track everything relevant inside itself. Setting properties such as a spotanim would be done through this. The extendedInfo is also responsible for caching the non-temporary blocks, such as appearance and move speed.

Functions

Link copied to clipboard
fun forceResizeRange(range: Int)

Forces the resize range to range while disabling the auto resizing feature.

Link copied to clipboard

Gets the preferred resize range. This value represents the ideal number that player info will strive towards. If the value is Int.MAX_VALUE, resizing is disabled and getResizeRange is what is used as a constant.

Link copied to clipboard

Gets the current resize range. This variable might change over time.

Link copied to clipboard
open override fun postUpdate()

Updates the previous cycle's coordinate to be the current cycle's coordinate. This is called at the end of the cycle, to prepare for the next cycle.

Link copied to clipboard
fun setHidden(hidden: Boolean)
Link copied to clipboard

Sets the preferred resize range, effectively how far to render players from. The preferred bit here means that it can resize down if there are too many players around.

Link copied to clipboard
fun updateCoord(level: Int, x: Int, z: Int)

Updates the current known coordinate of the given PlayerAvatar. This function must be called on each avatar before player info is computed.