UpdateInvFull

class UpdateInvFull : OutgoingGameMessage

Update inv full is used to perform a full synchronization of an inventory's contents to the client. The client will wipe any existing cache of this inventory prior to performing an update. While not very well known, it is possible to send less objs than the inventory's respective capacity in the cache. As an example, if the inventory's capacity in the cache is 500, but the inv only has a single object at the first slot, a simple compression method is to send the capacity as 1 to the client, and only inform of the single object that does exist - all others would be presumed non-existent. There is no need to transmit all 500 slots when the remaining 499 are not filled, saving considerable amount of space in the process.

Constructors

Link copied to clipboard
constructor(interfaceId: Int, componentId: Int, inventoryId: Int, capacity: Int, provider: UpdateInvFull.ObjectProvider)
constructor(combinedId: Int, inventoryId: Int, capacity: Int, provider: UpdateInvFull.ObjectProvider)
constructor(inventoryId: Int, capacity: Int, provider: UpdateInvFull.ObjectProvider)

Types

Link copied to clipboard
fun interface ObjectProvider

An object provider interface is used to acquire the objs that exist in different inventories. These objs are bit-packed into a long, which gets further placed into a long array. This is all in order to avoid garbage creation with inventories, as this can be a considerable hot-spot for that.

Properties

Link copied to clipboard

the capacity of the inventory being transmitted in this update.

Link copied to clipboard
open override val category: ServerProtCategory
Link copied to clipboard

the combined id of the interface and the component id. For IF3-type interfaces, only negative values are allowed. If one wishes to make the inventory a "mirror", e.g. for trading, how both the player's own and the partner's inventory share the id, a value of < -70000 is expected, this tells the client that the respective inventory is a "mirrored" one. For normal IF3 interfaces, a value of -1 is perfectly acceptable.

Link copied to clipboard

the component on which the inventory lies

Link copied to clipboard

the IF1 interface on which the inventory lies. For IF3 interfaces, no interfaceId should be provided.

Link copied to clipboard

the id of the inventory to update

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun estimateSize(): Int
Link copied to clipboard
fun getObject(slot: Int): Long

Gets the bitpacked obj in the slot provided.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
Link copied to clipboard
open override fun toString(): String