Documentation ¶
Index ¶
- Constants
- func Attributes(src *bytes.Buffer, attributes *[]Attribute) error
- func BlockPosition(src *bytes.Buffer, x *BlockPos) error
- func EntityLinkAction(src *bytes.Buffer, x *EntityLink) error
- func EntityLinks(src *bytes.Buffer, x *[]EntityLink) error
- func EntityMetadata(src *bytes.Buffer, x *map[uint32]interface{}) error
- func Float32(src *bytes.Buffer, x *float32) error
- func GameRules(src *bytes.Buffer, x *map[string]interface{}) error
- func InitialAttributes(src *bytes.Buffer, attributes *[]Attribute) error
- func InvAction(src *bytes.Buffer, action *InventoryAction) error
- func Item(src *bytes.Buffer, x *ItemStack) error
- func MapDeco(buf *bytes.Buffer, x *MapDecoration) error
- func MapTrackedObj(buf *bytes.Buffer, x *MapTrackedObject) error
- func Rotation(src *bytes.Buffer, x *mgl32.Vec3) error
- func String(src *bytes.Buffer, x *string) error
- func UBlockPosition(src *bytes.Buffer, x *BlockPos) error
- func UUID(src *bytes.Buffer, id *uuid.UUID) error
- func VarRGBA(buf *bytes.Buffer, x *color.RGBA) error
- func Varint32(src *bytes.Buffer, x *int32) error
- func Varint64(src *bytes.Buffer, x *int64) error
- func Varuint32(src *bytes.Buffer, x *uint32) error
- func Varuint64(src *bytes.Buffer, x *uint64) error
- func Vec2(src *bytes.Buffer, x *mgl32.Vec2) error
- func Vec3(src *bytes.Buffer, x *mgl32.Vec3) error
- func WriteAttributes(dst *bytes.Buffer, x []Attribute) error
- func WriteBlockPosition(dst *bytes.Buffer, x BlockPos) error
- func WriteEntityLinkAction(dst *bytes.Buffer, x EntityLink) error
- func WriteEntityLinks(dst *bytes.Buffer, x []EntityLink) error
- func WriteEntityMetadata(dst *bytes.Buffer, x map[uint32]interface{}) error
- func WriteFloat32(dst *bytes.Buffer, x float32) error
- func WriteGameRules(dst *bytes.Buffer, x map[string]interface{}) error
- func WriteInitialAttributes(dst *bytes.Buffer, x []Attribute) error
- func WriteInvAction(dst *bytes.Buffer, action InventoryAction) error
- func WriteItem(dst *bytes.Buffer, x ItemStack) error
- func WriteMapDeco(buf *bytes.Buffer, x MapDecoration) error
- func WriteMapTrackedObj(buf *bytes.Buffer, x MapTrackedObject) error
- func WriteRotation(src *bytes.Buffer, x mgl32.Vec3) error
- func WriteString(dst *bytes.Buffer, x string) error
- func WriteUBlockPosition(dst *bytes.Buffer, x BlockPos) error
- func WriteUUID(dst *bytes.Buffer, id uuid.UUID) error
- func WriteVarRGBA(buf *bytes.Buffer, x color.RGBA) error
- func WriteVarint32(dst *bytes.Buffer, x int32) error
- func WriteVarint64(dst *bytes.Buffer, x int64) error
- func WriteVaruint32(dst *bytes.Buffer, x uint32) error
- func WriteVaruint64(dst *bytes.Buffer, x uint64) error
- func WriteVec2(dst *bytes.Buffer, x mgl32.Vec2) error
- func WriteVec3(dst *bytes.Buffer, x mgl32.Vec3) error
- type Attribute
- type BlockPos
- type EntityLink
- type FurnaceDataRecipe
- type FurnaceRecipe
- type InventoryAction
- type InventoryTransactionData
- type ItemStack
- type ItemType
- type LimitHitError
- type MapDecoration
- type MapTrackedObject
- type MismatchTransactionData
- type MultiRecipe
- type NegativeCountError
- type NormalTransactionData
- type Recipe
- type ReleaseItemTransactionData
- type ShapedChemistryRecipe
- type ShapedRecipe
- type ShapelessChemistryRecipe
- type ShapelessRecipe
- type ShulkerBoxRecipe
- type UseItemOnEntityTransactionData
- type UseItemTransactionData
Constants ¶
const ( // EntityLinkRemove is set to remove the link between two entities. EntityLinkRemove = iota // EntityLinkRider is set for entities that have control over the entity they're riding, such as in a // minecart. EntityLinkRider // EntityLinkPassenger is set for entities being a passenger of a vehicle they enter, such as the back // sit of a boat. EntityLinkPassenger )
const ( EntityDataByte = iota EntityDataInt16 EntityDataInt32 EntityDataFloat32 EntityDataString EntityDataItem EntityDataBlockPos EntityDataInt64 EntityDataVec3 )
const ( // CurrentProtocol is the current protocol version for the version below. CurrentProtocol = 354 // CurrentVersion is the current version of Minecraft as supported by the `packet` package. CurrentVersion = "1.11.1" )
const ( InventoryActionSourceContainer = 0 InventoryActionSourceWorld = 2 InventoryActionSourceCreative = 3 InventoryActionSourceCraftingGrid = 100 InventoryActionSourceTODO = 99999 )
const ( UseItemActionClickBlock = iota UseItemActionClickAir UseItemActionBreakBlock )
const ( UseItemOnEntityActionInteract = iota UseItemOnEntityActionAttack )
const ( ReleaseItemActionRelease = iota ReleaseItemActionConsume )
const ( MapObjectTypeEntity = iota MapObjectTypeBlock )
const ( RecipeShapeless = iota RecipeShaped RecipeFurnace RecipeFurnaceData RecipeMulti RecipeShulkerBox RecipeShapelessChemistry RecipeShapedChemistry )
Variables ¶
This section is empty.
Functions ¶
func Attributes ¶ added in v0.3.0
Attributes reads an Attribute slice from bytes.Buffer src and stores it in the pointer passed.
func BlockPosition ¶ added in v0.1.0
BlockPosition reads a BlockPos from Buffer src and stores it to the BlockPos pointer passed.
func EntityLinkAction ¶ added in v0.3.0
func EntityLinkAction(src *bytes.Buffer, x *EntityLink) error
EntityLinkAction reads a single entity link (action) from buffer src.
func EntityLinks ¶ added in v0.3.0
func EntityLinks(src *bytes.Buffer, x *[]EntityLink) error
EntityLinks reads a list of entity links from buffer src that are currently active.
func EntityMetadata ¶ added in v0.3.0
EntityMetadata reads an entity metadata list from buffer src into map x. The types in the map will be one of byte, int16, int32, float32, string, ItemStack, BlockPos, int64 or mgl32.Vec3.
func Float32 ¶ added in v0.1.0
Float32 reads a float32 from Buffer src, setting the result to the pointer to a float32 passed.
func GameRules ¶ added in v0.1.0
GameRules reads a map of game rules from Buffer src. It sets one of the types 'bool', 'float32' or 'uint32' to the map x, with the key being the name of the game rule.
func InitialAttributes ¶ added in v0.3.0
InitialAttributes reads an Attribute slice from bytes.Buffer src and stores it in the pointer passed. InitialAttributes is used when reading the attributes of a new entity. (AddEntity packet)
func InvAction ¶ added in v0.4.0
func InvAction(src *bytes.Buffer, action *InventoryAction) error
InvAction reads an inventory action from buffer src.
func Item ¶ added in v0.3.0
Item reads an item stack from buffer src and stores it into item stack x.
func MapDeco ¶ added in v0.7.0
func MapDeco(buf *bytes.Buffer, x *MapDecoration) error
MapDeco reads a MapDecoration from buf into x.
func MapTrackedObj ¶ added in v0.7.0
func MapTrackedObj(buf *bytes.Buffer, x *MapTrackedObject) error
MapTrackedObj reads a MapTrackedObject from buf into x.
func Rotation ¶ added in v0.3.0
Rotation reads a rotation object from buffer src and stores it in Vec3 x. The rotation object exists out of 3 bytes.
func String ¶ added in v0.1.0
String reads a string from Buffer src, setting the result to the pointer to a string passed. The string read is prefixed by a varuint32.
func UBlockPosition ¶ added in v0.1.0
UBlockPosition reads an unsigned BlockPos from Buffer src and stores it to the BlockPos pointer passed. The difference between this and BlockPosition is that the Y coordinate is read as a varuint32.
func Varint32 ¶
Varint32 reads up to 5 bytes from the source buffer passed and sets the integer produced to a pointer.
func Varint64 ¶
Varint64 reads up to 10 bytes from the source buffer passed and sets the integer produced to a pointer.
func Varuint32 ¶
Varuint32 reads up to 5 bytes from the source buffer passed and sets the integer produced to a pointer.
func Varuint64 ¶
Varuint64 reads up to 10 bytes from the source buffer passed and sets the integer produced to a pointer.
func Vec2 ¶ added in v0.7.0
Vec2 reads an mgl32.Vec2 (float32 vector) from Buffer src, setting the result to the pointer to an mgl32.Vec2 passed.
func Vec3 ¶ added in v0.1.0
Vec3 reads an mgl32.Vec3 (float32 vector) from Buffer src, setting the result to the pointer to an mgl32.Vec3 passed.
func WriteAttributes ¶ added in v0.3.0
WriteAttributes writes a slice of Attributes x to buffer dst.
func WriteBlockPosition ¶ added in v0.1.0
WriteBlockPosition writes a BlockPos x to Buffer dst, composed of 3 varint32s.
func WriteEntityLinkAction ¶ added in v0.3.0
func WriteEntityLinkAction(dst *bytes.Buffer, x EntityLink) error
WriteEntityLinkAction writes a single entity link x to buffer dst.
func WriteEntityLinks ¶ added in v0.3.0
func WriteEntityLinks(dst *bytes.Buffer, x []EntityLink) error
WriteEntityLinks writes a list of entity links currently active to buffer dst.
func WriteEntityMetadata ¶ added in v0.3.0
WriteEntityMetadata writes an entity metadata list x to buffer dst. The types held by the map must be one of byte, int16, int32, float32, string, ItemStack, BlockPos, int64 or mgl32.Vec3. The function will panic if a different type is encountered.
func WriteFloat32 ¶ added in v0.1.0
WriteFloat32 writes a float32 to Buffer dst, by first converting it to a uint32.
func WriteGameRules ¶ added in v0.1.0
WriteGameRules writes a map of game rules x, indexed by their names to Buffer dst. The types of the map values must be either 'bool', 'float32' or 'uint32'. If one of the values has a different type, the function will panic.
func WriteInitialAttributes ¶ added in v0.3.0
WriteInitialAttributes writes a slice of Attributes x to buffer dst. WriteInitialAttributes is used when writing the attributes of a new entity. (AddEntity packet)
func WriteInvAction ¶ added in v0.4.0
func WriteInvAction(dst *bytes.Buffer, action InventoryAction) error
WriteInvAction writes an inventory action to buffer dst.
func WriteMapDeco ¶ added in v0.7.0
func WriteMapDeco(buf *bytes.Buffer, x MapDecoration) error
WriteMapDeco writes a MapDecoration x to buf.
func WriteMapTrackedObj ¶ added in v0.7.0
func WriteMapTrackedObj(buf *bytes.Buffer, x MapTrackedObject) error
WriteMapTrackedObj writes a MapTrackedObject xx to buf.
func WriteRotation ¶ added in v0.3.0
WriteRotation writes a rotation Vec3 to buffer src as 3 bytes.
func WriteString ¶ added in v0.1.0
WriteString writes a string x to Buffer dst. The string is a slice of bytes prefixed by a varuint32 specifying its length.
func WriteUBlockPosition ¶ added in v0.1.0
WriteUBlockPosition writes an unsigned BlockPos x to Buffer dst, composed of a varint32, varuint32 and a varint32.
func WriteVarRGBA ¶ added in v0.7.0
WriteVarRGBA writes an RGBA value to buf by packing it into a varuint32.
func WriteVarint32 ¶
WriteVarint32 writes an int32 to the destination buffer passed with a size of 1-5 bytes.
func WriteVarint64 ¶
WriteVarint64 writes an int64 to the destination buffer passed with a size of 1-10 bytes.
func WriteVaruint32 ¶
WriteVaruint32 writes a uint32 to the destination buffer passed with a size of 1-5 bytes.
func WriteVaruint64 ¶
WriteVaruint64 writes a uint64 to the destination buffer passed with a size of 1-10 bytes.
Types ¶
type Attribute ¶
type Attribute struct { // Name is the name of the attribute, for example 'minecraft:health'. These names must be identical to // the ones defined client-side. Name string // Value is the current value of the attribute. This value will be applied to the entity when sent in a // packet. Value float32 // Max and Min specify the boundaries within the value of the attribute must be. The definition of these // fields differ per attribute. The maximum health of an entity may be changed, whereas the maximum // movement speed for example may not be. Max, Min float32 // Default is the default value of the attribute. It's not clear why this field must be sent to the // client, but it is required regardless. Default float32 }
Attribute is an entity attribute, that holds specific data such as the health of the entity. Each attribute holds a default value, maximum and minimum value, name and its current value.
type BlockPos ¶
type BlockPos [3]int32
BlockPos is the position of a block. It is composed of three integers, and is typically written as either 3 varint32s or a varint32, varuint32 and varint32.
func (BlockPos) X ¶
X returns the X coordinate of the block position. It is equivalent to BlockPos[0].
type EntityLink ¶
type EntityLink struct { // RiddenEntityUniqueID is the entity unique ID of the entity that is being ridden. For a player sitting // in a boat, this is the unique ID of the boat. RiddenEntityUniqueID int64 // RiderEntityUniqueID is the entity unique ID of the entity that is riding. For a player sitting in a // boat, this is the unique ID of the player. RiderEntityUniqueID int64 // Type is one of the types above. It specifies the way the entity is linked to another entity. Type byte // Immediate is set to immediately dismount an entity from another. This should be set when the mount of // an entity is killed. Immediate bool }
EntityLink is a link between two entities, typically being one entity riding another.
type FurnaceDataRecipe ¶
type FurnaceDataRecipe FurnaceRecipe
FurnaceDataRecipe is a recipe specifically used for furnace-type crafting stations. It is equal to FurnaceRecipe, except it has an input item with a specific metadata value, instead of any metadata value.
func (*FurnaceDataRecipe) Marshal ¶
func (recipe *FurnaceDataRecipe) Marshal(buf *bytes.Buffer)
Marshal ...
type FurnaceRecipe ¶
type FurnaceRecipe struct { // InputType is the item type of the input item. The metadata value of the item is not used in the // FurnaceRecipe. Use FurnaceDataRecipe to allow an item with only one metadata value. InputType ItemType // Output is the item that is created as a result of smelting/cooking an item in the furnace. Output ItemStack // Block is the block name that is required to create the output of the recipe. The block is not prefixed // with 'minecraft:', so it will look like 'furnace' as an example. Block string }
FurnaceRecipe is a recipe that is specifically used for all kinds of furnaces. These recipes don't just apply to furnaces, but also blast furnaces and smokers.
type InventoryAction ¶
type InventoryAction struct { // SourceType is the source type of the inventory action. It is one of the constants above. SourceType uint32 // WindowID is the ID of the window that the client has opened. The window ID is not set if the SourceType // is InventoryActionSourceWorld. WindowID int32 // SourceFlags is a combination of flags that is only set if the SourceType is InventoryActionSourceWorld. SourceFlags uint32 // InventorySlot is the slot in which the action took place. Each action only describes the change of item // in a single slot. InventorySlot uint32 // OldItem is the item that was present in the slot before the inventory action. It should be checked by // the server to ensure the inventories were not out of sync. OldItem ItemStack // NewItem is the new item that was put in the InventorySlot that the OldItem was in. It must be checked // in combination with other inventory actions to ensure that the transaction is balanced. NewItem ItemStack }
InventoryAction represents a single action that took place during an inventory transaction. On itself, this inventory action is always unbalanced: It must be combined with other actions in an inventory transaction to form a balanced transaction.
type InventoryTransactionData ¶
type InventoryTransactionData interface { // Marshal encodes the inventory transaction data to its binary representation into buf. Marshal(buf *bytes.Buffer) // Unmarshal decodes a serialised inventory transaction data object in buf into the // InventoryTransactionData instance. Unmarshal(buf *bytes.Buffer) error }
InventoryTransactionData represents an object that holds data specific to an inventory transaction type. The data it holds depends on the type.
type ItemStack ¶
type ItemStack struct { ItemType // Count is the count of items that the item stack holds. Count int16 // NBTData is a map that is serialised to its NBT representation when sent in a packet. NBTData map[string]interface{} // CanBePlacedOn is a list of block identifiers like 'minecraft:stone' which the item, if it is an item // that can be placed, can be placed on top of. CanBePlacedOn []string // CanBreak is a list of block identifiers like 'minecraft:dirt' that the item is able to break. CanBreak []string }
ItemStack represents an item instance/stack over network. It has a network ID and a metadata value that define its type.
type ItemType ¶
type ItemType struct { // NetworkID is the numerical network ID of the item. This is sometimes a positive ID, and sometimes a // negative ID, depending on what item it concerns. NetworkID int32 // MetadataValue is the metadata value of the item. For some items, this is the damage value, whereas for // other items it is simply an identifier of a variant of the item. MetadataValue int16 }
ItemType represents a consistent combination of network ID and metadata value of an item. It cannot usually be changed unless a new item is obtained.
type LimitHitError ¶ added in v0.7.0
LimitHitError is returned by a reading operation if it hits the limit of the maximum amount of elements in an array.
type MapDecoration ¶
type MapDecoration struct { // Type is the type of the map decoration. The type specifies the shape (and sometimes the colour) that // the map decoration gets. Type byte // Rotation is the rotation of the map decoration. It is byte due to the 16 fixed directions that the // map decoration may face. Rotation byte // X is the offset on the X axis in pixels of the decoration. X byte // Y is the offset on the Y axis in pixels of the decoration. Y byte // Label is the name of the map decoration. This name may be of any value. Label string // Colour is the colour of the map decoration. Some map decoration types have a specific colour set // automatically, whereas others may be changed. Colour color.RGBA }
MapDecoration is a fixed decoration on a map: Its position or other properties do not change automatically client-side.
type MapTrackedObject ¶
type MapTrackedObject struct { // Type is the type of the tracked object. It is either MapObjectTypeEntity or MapObjectTypeBlock. Type int32 // EntityUniqueID is the unique ID of the entity, if the tracked object was an entity. It needs not to be // filled out if Type is not MapObjectTypeEntity. EntityUniqueID int64 // BlockPosition is the position of the block, if the tracked object was a block. It needs not to be // filled out if Type is not MapObjectTypeBlock. BlockPosition BlockPos }
MapTrackedObject is an object on a map that is 'tracked' by the client, such as an entity or a block. This object may move, which is handled client-side.
type MismatchTransactionData ¶
type MismatchTransactionData struct{}
MismatchTransactionData represents a mismatched inventory transaction's data object.
func (*MismatchTransactionData) Marshal ¶
func (*MismatchTransactionData) Marshal(buf *bytes.Buffer)
Marshal ...
type MultiRecipe ¶
type MultiRecipe struct { // UUID is a UUID identifying the recipe. This can actually be set to an empty UUID if the CraftingEvent // packet is not used. UUID uuid.UUID }
MultiRecipe serves as an 'enable' switch for multi-shape recipes.
type NegativeCountError ¶ added in v0.7.0
type NegativeCountError struct {
Type string
}
NegativeCountError is returned when a count prefix of an array-type structure is a negative number. Most types only have unsigned count prefixes, but some do not and may return this error.
func (NegativeCountError) Error ¶ added in v0.7.0
func (err NegativeCountError) Error() string
Error ...
type NormalTransactionData ¶
type NormalTransactionData struct{}
NormalTransactionData represents an inventory transaction data object for normal transactions, such as crafting. It has no content.
func (*NormalTransactionData) Marshal ¶
func (*NormalTransactionData) Marshal(buf *bytes.Buffer)
Marshal ...
type Recipe ¶
type Recipe interface { // Marshal encodes the recipe data to its binary representation into buf. Marshal(buf *bytes.Buffer) // Unmarshal decodes a serialised recipe in buf into the recipe instance. Unmarshal(buf *bytes.Buffer) error }
Recipe represents a recipe that may be sent in a CraftingData packet to let the client know what recipes are available server-side.
type ReleaseItemTransactionData ¶
type ReleaseItemTransactionData struct { // ActionType is the type of the ReleaseItem inventory transaction. It is one of the action types found // in the constants above, and specifies the way the item was released. ActionType uint32 // HotBarSlot is the hot bar slot that the player was holding while releasing the item. It should be used // to ensure that the hot bar slot and held item are correctly synchronised with the server. HotBarSlot int32 // HeldItem is the item that was released. The server should check if this item is actually present in the // HotBarSlot. HeldItem ItemStack // HeadPosition is the position of the player's head at the time of releasing the item. This is used // mainly for purposes such as spawning eating particles at that position. HeadPosition mgl32.Vec3 }
ReleaseItemTransactionData represents an inventory transaction data object sent when the client releases the item it was using, for example when stopping while eating or stopping the charging of a bow.
func (*ReleaseItemTransactionData) Marshal ¶
func (data *ReleaseItemTransactionData) Marshal(buf *bytes.Buffer)
Marshal ...
type ShapedChemistryRecipe ¶
type ShapedChemistryRecipe ShapedRecipe
ShapedChemistryRecipe is a recipe specifically made for chemistry related features, which exist only in the Education Edition. It functions the same as a normal ShapedRecipe.
func (*ShapedChemistryRecipe) Marshal ¶
func (recipe *ShapedChemistryRecipe) Marshal(buf *bytes.Buffer)
Marshal ...
type ShapedRecipe ¶
type ShapedRecipe struct { // Width is the width of the recipe's shape. Width int32 // Height is the height of the recipe's shape. Height int32 // Input is a list of items that serve as the input of the shapeless recipe. These items are the items // required to craft the output. The amount of input items must be exactly equal to Width * Height. Input []ItemStack // Output is a list of items that are created as a result of crafting the recipe. Output []ItemStack // UUID is a UUID identifying the recipe. This can actually be set to an empty UUID if the CraftingEvent // packet is not used. UUID uuid.UUID // Block is the block name that is required to craft the output of the recipe. The block is not prefixed // with 'minecraft:', so it will look like 'crafting_table' as an example. Block string }
ShapedRecipe is a recipe that has a specific shape that must be used to craft the output of the recipe. Trying to craft the item in any other shape will not work. The ShapedRecipe is of the same structure as the ShapedChemistryRecipe.
type ShapelessChemistryRecipe ¶
type ShapelessChemistryRecipe ShapelessRecipe
ShapelessChemistryRecipe is a recipe specifically made for chemistry related features, which exist only in the Education Edition. They function the same as shapeless recipes do.
func (*ShapelessChemistryRecipe) Marshal ¶
func (recipe *ShapelessChemistryRecipe) Marshal(buf *bytes.Buffer)
Marshal ...
type ShapelessRecipe ¶
type ShapelessRecipe struct { // Input is a list of items that serve as the input of the shapeless recipe. These items are the items // required to craft the output. Input []ItemStack // Output is a list of items that are created as a result of crafting the recipe. Output []ItemStack // UUID is a UUID identifying the recipe. This can actually be set to an empty UUID if the CraftingEvent // packet is not used. UUID uuid.UUID // Block is the block name that is required to craft the output of the recipe. The block is not prefixed // with 'minecraft:', so it will look like 'crafting_table' as an example. Block string }
ShapelessRecipe is a recipe that has no particular shape. Its functionality is shared with the RecipeShulkerBox and RecipeShapelessChemistry types.
func (*ShapelessRecipe) Marshal ¶
func (recipe *ShapelessRecipe) Marshal(buf *bytes.Buffer)
Marshal ...
type ShulkerBoxRecipe ¶
type ShulkerBoxRecipe ShapelessRecipe
ShulkerBoxRecipe is a shapeless recipe made specifically for shulker box crafting, so that they don't lose their user data when dyeing a shulker box.
func (*ShulkerBoxRecipe) Marshal ¶
func (recipe *ShulkerBoxRecipe) Marshal(buf *bytes.Buffer)
Marshal ...
type UseItemOnEntityTransactionData ¶
type UseItemOnEntityTransactionData struct { // TargetEntityRuntimeID is the entity runtime ID of the target that was clicked. It is the runtime ID // that was assigned to it in the AddEntity packet. TargetEntityRuntimeID uint64 // ActionType is the type of the UseItemOnEntity inventory transaction. It is one of the action types // found in the constants above, and specifies the way the player interacted with the entity. ActionType uint32 // HotBarSlot is the hot bar slot that the player was holding while clicking the entity. It should be used // to ensure that the hot bar slot and held item are correctly synchronised with the server. HotBarSlot int32 // HeldItem is the item that was held to interact with the entity. The server should check if this item // is actually present in the HotBarSlot. HeldItem ItemStack // Position is the position of the player at the time of clicking the entity. Position mgl32.Vec3 // ClickedPosition is the position that was clicked relative to the entity's base coordinate. It can be // used to find out exactly where a player clicked the entity. ClickedPosition mgl32.Vec3 }
UseItemOnEntityTransactionData represents an inventory transaction data object sent when the client uses an item on an entity.
func (*UseItemOnEntityTransactionData) Marshal ¶
func (data *UseItemOnEntityTransactionData) Marshal(buf *bytes.Buffer)
Marshal ...
type UseItemTransactionData ¶
type UseItemTransactionData struct { // ActionType is the type of the UseItem inventory transaction. It is one of the action types found above, // and specifies the way the player interacted with the block. ActionType uint32 // BlockPosition is the position of the block that was interacted with. This is only really a correct // block position if ActionType is not UseItemActionClickAir. BlockPosition BlockPos // BlockFace is the face of the block that was interacted with. When clicking the block, it is the face // clicked. When breaking the block, it is the face that was last being hit until the block broke. BlockFace int32 // HotBarSlot is the hot bar slot that the player was holding while clicking the block. It should be used // to ensure that the hot bar slot and held item are correctly synchronised with the server. HotBarSlot int32 // HeldItem is the item that was held to interact with the block. The server should check if this item // is actually present in the HotBarSlot. HeldItem ItemStack // Position is the position of the player at the time of interaction. For clicking a block, this is the // position at that time, whereas for breaking the block it is the position at the time of breaking. Position mgl32.Vec3 // ClickedPosition is the position that was clicked relative to the block's base coordinate. It can be // used to find out exactly where a player clicked the block. ClickedPosition mgl32.Vec3 // BlockRuntimeID is the runtime ID of the block that was clicked. It may be used by the server to verify // that the player's world client-side is synchronised with the server's. BlockRuntimeID uint32 }
UseItemTransactionData represents an inventory transaction data object sent when the client uses an item on a block.
func (*UseItemTransactionData) Marshal ¶
func (data *UseItemTransactionData) Marshal(buf *bytes.Buffer)
Marshal ...