Documentation ¶
Index ¶
- Constants
- func EmptySlice[T any](io protocol.IO, slice *[]T)
- func FetchProtoID(io protocol.IO) int32
- func IsProtoGT(io protocol.IO, proto int32) bool
- func IsProtoGTE(io protocol.IO, proto int32) bool
- func IsProtoLT(io protocol.IO, proto int32) bool
- func IsProtoLTE(io protocol.IO, proto int32) bool
- func IsReader(r protocol.IO) bool
- func IsWriter(w protocol.IO) bool
- func PlayerInventoryAction(io protocol.IO, x *protocol.UseItemTransactionData)
- func StackReqSlotInfo(r protocol.IO, x *StackRequestSlotInfo)
- func TransactionDataType(io protocol.IO, x *InventoryTransactionData)
- type Attribute
- type AutoCraftRecipeStackRequestAction
- type BeaconPaymentStackRequestAction
- type BehaviourPackInfo
- type CameraPreset
- type ConsumeStackRequestAction
- type CraftCreativeStackRequestAction
- type CraftGrindstoneRecipeStackRequestAction
- type CraftLoomRecipeStackRequestAction
- type CraftNonImplementedStackRequestAction
- type CraftRecipeOptionalStackRequestAction
- type CraftRecipeStackRequestAction
- type CraftResultsDeprecatedStackRequestAction
- type CreateStackRequestAction
- type DestroyStackRequestAction
- type DropStackRequestAction
- type EntityLink
- type FullContainerName
- type IO
- type InventoryTransactionData
- type ItemStackRequest
- type ItemStackResponse
- type LabTableCombineStackRequestAction
- type MineBlockStackRequestAction
- type PlaceInContainerStackRequestAction
- type PlaceStackRequestAction
- type Reader
- type StackRequestAction
- type StackRequestSlotInfo
- type StackResponseContainerInfo
- type StackResponseSlotInfo
- type SwapStackRequestAction
- type TakeOutContainerStackRequestAction
- type TakeStackRequestAction
- type TexturePackInfo
- type UseItemTransactionData
- type Writer
Constants ¶
const ( ID766 = 766 // v1.21.50 ID748 = 748 // v1.21.40 ID729 = 729 // v1.21.30 ID712 = 712 // v1.21.20 ID686 = 686 // v1.21.2 ID685 = 685 // v1.21.0 )
const ( FilterCauseServerChatPublic = iota FilterCauseServerChatWhisper FilterCauseSignText FilterCauseAnvilText FilterCauseBookAndQuillText FilterCauseCommandBlockText FilterCauseBlockActorDataText FilterCauseJoinEventText FilterCauseLeaveEventText FilterCauseSlashCommandChat FilterCauseCartographyText FilterCauseKickCommand FilterCauseTitleCommand FilterCauseSummonCommand )
const ( ItemStackResponseStatusOK = iota ItemStackResponseStatusError ItemStackResponseStatusInvalidRequestActionType ItemStackResponseStatusActionRequestNotAllowed ItemStackResponseStatusScreenHandlerEndRequestFailed ItemStackResponseStatusItemRequestActionHandlerCommitFailed ItemStackResponseStatusInvalidRequestCraftActionType ItemStackResponseStatusInvalidCraftRequest ItemStackResponseStatusInvalidCraftRequestScreen ItemStackResponseStatusInvalidCraftResult ItemStackResponseStatusInvalidCraftResultIndex ItemStackResponseStatusInvalidCraftResultItem ItemStackResponseStatusInvalidItemNetId ItemStackResponseStatusMissingCreatedOutputContainer ItemStackResponseStatusFailedToSetCreatedItemOutputSlot ItemStackResponseStatusRequestAlreadyInProgress ItemStackResponseStatusFailedToInitSparseContainer ItemStackResponseStatusResultTransferFailed ItemStackResponseStatusExpectedItemSlotNotFullyConsumed ItemStackResponseStatusExpectedAnywhereItemNotFullyConsumed ItemStackResponseStatusItemAlreadyConsumedFromSlot ItemStackResponseStatusConsumedTooMuchFromSlot ItemStackResponseStatusMismatchSlotExpectedConsumedItem ItemStackResponseStatusMismatchSlotExpectedConsumedItemNetIdVariant ItemStackResponseStatusFailedToMatchExpectedSlotConsumedItem ItemStackResponseStatusFailedToMatchExpectedAllowedAnywhereConsumedItem ItemStackResponseStatusConsumedItemOutOfAllowedSlotRange ItemStackResponseStatusConsumedItemNotAllowed ItemStackResponseStatusPlayerNotInCreativeMode ItemStackResponseStatusInvalidExperimentalRecipeRequest ItemStackResponseStatusFailedToCraftCreative ItemStackResponseStatusFailedToGetLevelRecipe ItemStackResponseStatusFailedToFindRecipeByNetId ItemStackResponseStatusMismatchedCraftingSize ItemStackResponseStatusMissingInputSparseContainer ItemStackResponseStatusMismatchedRecipeForInputGridItems ItemStackResponseStatusEmptyCraftResults ItemStackResponseStatusFailedToEnchant ItemStackResponseStatusMissingInputItem ItemStackResponseStatusInsufficientPlayerLevelToEnchant ItemStackResponseStatusMissingMaterialItem ItemStackResponseStatusMissingActor ItemStackResponseStatusUnknownPrimaryEffect ItemStackResponseStatusPrimaryEffectOutOfRange ItemStackResponseStatusSecondaryEffectOutOfRange ItemStackResponseStatusDstContainerEqualToCreatedOutputContainer ItemStackResponseStatusDstContainerAndSlotEqualToSrcContainerAndSlot ItemStackResponseStatusFailedToValidateSrcSlot ItemStackResponseStatusFailedToValidateDstSlot ItemStackResponseStatusInvalidAdjustedAmount ItemStackResponseStatusInvalidItemSetType ItemStackResponseStatusInvalidTransferAmount ItemStackResponseStatusCannotSwapItem ItemStackResponseStatusCannotPlaceItem ItemStackResponseStatusUnhandledItemSetType ItemStackResponseStatusInvalidRemovedAmount ItemStackResponseStatusInvalidRegion ItemStackResponseStatusCannotDropItem ItemStackResponseStatusCannotDestroyItem ItemStackResponseStatusInvalidSourceContainer ItemStackResponseStatusItemNotConsumed ItemStackResponseStatusInvalidNumCrafts ItemStackResponseStatusInvalidCraftResultStackSize ItemStackResponseStatusCannotRemoveItem ItemStackResponseStatusCannotConsumeItem ItemStackResponseStatusScreenStackError )
const ( StackRequestActionTake = iota StackRequestActionPlace StackRequestActionSwap StackRequestActionDrop StackRequestActionDestroy StackRequestActionConsume StackRequestActionCreate StackRequestActionPlaceInContainer StackRequestActionTakeOutContainer StackRequestActionLabTableCombine StackRequestActionBeaconPayment StackRequestActionMineBlock StackRequestActionCraftRecipe StackRequestActionCraftRecipeAuto StackRequestActionCraftCreative StackRequestActionCraftRecipeOptional StackRequestActionCraftGrindstone StackRequestActionCraftLoom StackRequestActionCraftNonImplementedDeprecated StackRequestActionCraftResultsDeprecated )
Variables ¶
This section is empty.
Functions ¶
func EmptySlice ¶ added in v0.0.3
func FetchProtoID ¶
func PlayerInventoryAction ¶ added in v0.0.4
func PlayerInventoryAction(io protocol.IO, x *protocol.UseItemTransactionData)
func StackReqSlotInfo ¶
func StackReqSlotInfo(r protocol.IO, x *StackRequestSlotInfo)
StackReqSlotInfo reads/writes a StackRequestSlotInfo x using IO r.
func TransactionDataType ¶ added in v0.0.4
func TransactionDataType(io protocol.IO, x *InventoryTransactionData)
Types ¶
type Attribute ¶ added in v0.0.3
type Attribute struct { protocol.AttributeValue // DefaultMin is the default minimum value of the attribute. It's not clear why this field must be sent to // the client, but it is required regardless. DefaultMin float32 // DefaultMax is the default maximum value of the attribute. It's not clear why this field must be sent to // the client, but it is required regardless. DefaultMax 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 // Modifiers is a slice of AttributeModifiers that are applied to the attribute. Modifiers []protocol.AttributeModifier }
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.
func (*Attribute) FromLatest ¶ added in v0.0.3
type AutoCraftRecipeStackRequestAction ¶
type AutoCraftRecipeStackRequestAction struct { // RecipeNetworkID is the network ID of the recipe that is about to be crafted. This network ID matches // one of the recipes sent in the CraftingData packet, where each of the recipes have a RecipeNetworkID as // of 1.16. RecipeNetworkID uint32 // NumberOfCrafts is how many times the recipe was crafted. This field is just a duplicate of TimesCrafted. NumberOfCrafts byte // TimesCrafted is how many times the recipe was crafted. TimesCrafted byte // Ingredients is a slice of ItemDescriptorCount that contains the ingredients that were used to craft the recipe. // It is not exactly clear what this is used for, but it is sent by the vanilla client. Ingredients []protocol.ItemDescriptorCount }
AutoCraftRecipeStackRequestAction is sent by the client similarly to the CraftRecipeStackRequestAction. The only difference is that the recipe is automatically created and crafted by shift clicking the recipe book.
func (*AutoCraftRecipeStackRequestAction) Marshal ¶
func (a *AutoCraftRecipeStackRequestAction) Marshal(r protocol.IO)
Marshal ...
type BeaconPaymentStackRequestAction ¶
type BeaconPaymentStackRequestAction struct {
// PrimaryEffect and SecondaryEffect are the effects that were selected from the beacon.
PrimaryEffect, SecondaryEffect int32
}
BeaconPaymentStackRequestAction is sent by the client when it submits an item to enable effects from a beacon. These items will have been moved into the beacon item slot in advance.
func (*BeaconPaymentStackRequestAction) Marshal ¶
func (a *BeaconPaymentStackRequestAction) Marshal(r protocol.IO)
Marshal ...
type BehaviourPackInfo ¶ added in v0.0.3
type BehaviourPackInfo struct { // UUID is the UUID of the behaviour pack. Each behaviour pack downloaded must have a different UUID in // order for the client to be able to handle them properly. UUID string // Version is the version of the behaviour pack. The client will cache behaviour packs sent by the server as // long as they carry the same version. Sending a behaviour pack with a different version than previously // will force the client to re-download it. Version string // Size is the total size in bytes that the behaviour pack occupies. This is the size of the compressed // archive (zip) of the behaviour pack. Size uint64 // ContentKey is the key used to decrypt the behaviour pack if it is encrypted. This is generally the case // for marketplace behaviour packs. ContentKey string // SubPackName ... SubPackName string // ContentIdentity ... ContentIdentity string // HasScripts specifies if the behaviour packs has any scripts in it. A client will only download the // behaviour pack if it supports scripts, which, up to 1.11, only includes Windows 10. HasScripts bool // AddonPack specifies if the texture pack is from an addon. AddonPack bool }
BehaviourPackInfo represents a behaviour pack's info sent over network. It holds information about the behaviour pack such as its name, description and version.
func (*BehaviourPackInfo) Marshal ¶ added in v0.0.3
func (x *BehaviourPackInfo) Marshal(r protocol.IO)
Marshal encodes/decodes a BehaviourPackInfo.
type CameraPreset ¶
type CameraPreset struct { // Name is the name of the preset. Each preset must have their own unique name. Name string // Parent is the name of the preset that this preset extends upon. This can be left empty. Parent string // PosX is the default X position of the camera. PosX protocol.Optional[float32] // PosY is the default Y position of the camera. PosY protocol.Optional[float32] // PosZ is the default Z position of the camera. PosZ protocol.Optional[float32] // RotX is the default pitch of the camera. RotX protocol.Optional[float32] // RotY is the default yaw of the camera. RotY protocol.Optional[float32] // RotationSpeed is the speed at which the camera should rotate. RotationSpeed protocol.Optional[float32] // SnapToTarget determines whether the camera should snap to the target entity or not. SnapToTarget protocol.Optional[bool] // HorizontalRotationLimit is the horizontal rotation limit of the camera. HorizontalRotationLimit protocol.Optional[mgl32.Vec2] // VerticalRotationLimit is the vertical rotation limit of the camera. VerticalRotationLimit protocol.Optional[mgl32.Vec2] // ContinueTargeting determines whether the camera should continue targeting when using aim assist. ContinueTargeting protocol.Optional[bool] // TrackingRadius is the radius around the camera that the aim assist should track targets. TrackingRadius protocol.Optional[float32] // ViewOffset is only used in a follow_orbit camera and controls an offset based on a pivot point to the // player, causing it to be shifted in a certain direction. ViewOffset protocol.Optional[mgl32.Vec2] // EntityOffset controls the offset from the entity that the camera should be rendered at. EntityOffset protocol.Optional[mgl32.Vec3] // Radius is only used in a follow_orbit camera and controls how far away from the player the camera should // be rendered. Radius protocol.Optional[float32] // AudioListener defines where the audio should be played from when using this preset. This is one of the // constants above. AudioListener protocol.Optional[byte] // PlayerEffects is currently unknown. PlayerEffects protocol.Optional[bool] // AlignTargetAndCameraForward determines whether the camera should align the target and the camera forward // or not. AlignTargetAndCameraForward protocol.Optional[bool] // AimAssist defines the aim assist to use when using this preset. AimAssist protocol.Optional[protocol.CameraPresetAimAssist] }
CameraPreset represents a basic preset that can be extended upon by more complex instructions.
func (*CameraPreset) FromLatest ¶
func (x *CameraPreset) FromLatest(cp protocol.CameraPreset) CameraPreset
func (*CameraPreset) Marshal ¶
func (x *CameraPreset) Marshal(r protocol.IO)
Marshal encodes/decodes a CameraPreset.
func (*CameraPreset) ToLatest ¶
func (x *CameraPreset) ToLatest() protocol.CameraPreset
type ConsumeStackRequestAction ¶
type ConsumeStackRequestAction struct {
DestroyStackRequestAction
}
ConsumeStackRequestAction is sent by the client when it uses an item to craft another item. The original item is 'consumed'.
type CraftCreativeStackRequestAction ¶
type CraftCreativeStackRequestAction struct { // CreativeItemNetworkID is the network ID of the creative item that is being created. This is one of the // creative item network IDs sent in the CreativeContent packet. CreativeItemNetworkID uint32 // NumberOfCrafts is how many times the recipe was crafted. This field appears to be boilerplate and // has no effect. NumberOfCrafts byte }
CraftCreativeStackRequestAction is sent by the client when it takes an item out fo the creative inventory. The item is thus not really crafted, but instantly created.
func (*CraftCreativeStackRequestAction) Marshal ¶
func (a *CraftCreativeStackRequestAction) Marshal(r protocol.IO)
Marshal ...
type CraftGrindstoneRecipeStackRequestAction ¶
type CraftGrindstoneRecipeStackRequestAction struct { // RecipeNetworkID is the network ID of the recipe that is about to be crafted. This network ID matches // one of the recipes sent in the CraftingData packet, where each of the recipes have a RecipeNetworkID as // of 1.16. RecipeNetworkID uint32 // NumberOfCrafts is how many times the recipe was crafted. This field appears to be boilerplate and // has no effect. NumberOfCrafts byte // Cost is the cost of the recipe that was crafted. Cost int32 }
CraftGrindstoneRecipeStackRequestAction is sent when a grindstone recipe is crafted. It contains the RecipeNetworkID to identify the recipe crafted, and the cost for crafting the recipe.
func (*CraftGrindstoneRecipeStackRequestAction) Marshal ¶
func (c *CraftGrindstoneRecipeStackRequestAction) Marshal(r protocol.IO)
Marshal ...
type CraftLoomRecipeStackRequestAction ¶
type CraftLoomRecipeStackRequestAction struct { // Pattern is the pattern identifier for the loom recipe. Pattern string // TimesCrafted is how many times the recipe was crafted. TimesCrafted byte }
CraftLoomRecipeStackRequestAction is sent when a loom recipe is crafted. It simply contains the pattern identifier to figure out what pattern is meant to be applied to the item.
func (*CraftLoomRecipeStackRequestAction) Marshal ¶
func (c *CraftLoomRecipeStackRequestAction) Marshal(r protocol.IO)
Marshal ...
type CraftNonImplementedStackRequestAction ¶
type CraftNonImplementedStackRequestAction struct{}
CraftNonImplementedStackRequestAction is an action sent for inventory actions that aren't yet implemented in the new system. These include, for example, anvils.
func (*CraftNonImplementedStackRequestAction) Marshal ¶
func (*CraftNonImplementedStackRequestAction) Marshal(protocol.IO)
Marshal ...
type CraftRecipeOptionalStackRequestAction ¶
type CraftRecipeOptionalStackRequestAction struct { // RecipeNetworkID is the network ID of the multi-recipe that is about to be crafted. This network ID matches // one of the multi-recipes sent in the CraftingData packet, where each of the recipes have a RecipeNetworkID as // of 1.16. RecipeNetworkID uint32 // FilterStringIndex is the index of a filter string sent in a ItemStackRequest. FilterStringIndex int32 }
CraftRecipeOptionalStackRequestAction is sent when using an anvil. When this action is sent, the FilterStrings field in the respective stack request is non-empty and contains the name of the item created using the anvil or cartography table.
func (*CraftRecipeOptionalStackRequestAction) Marshal ¶
func (c *CraftRecipeOptionalStackRequestAction) Marshal(r protocol.IO)
Marshal ...
type CraftRecipeStackRequestAction ¶
type CraftRecipeStackRequestAction struct { // RecipeNetworkID is the network ID of the recipe that is about to be crafted. This network ID matches // one of the recipes sent in the CraftingData packet, where each of the recipes have a RecipeNetworkID as // of 1.16. RecipeNetworkID uint32 // NumberOfCrafts is how many times the recipe was crafted. This field appears to be boilerplate and // has no effect. NumberOfCrafts byte }
CraftRecipeStackRequestAction is sent by the client the moment it begins crafting an item. This is the first action sent, before the Consume and Create item stack request actions. This action is also sent when an item is enchanted. Enchanting should be treated mostly the same way as crafting, where the old item is consumed.
func (*CraftRecipeStackRequestAction) Marshal ¶
func (a *CraftRecipeStackRequestAction) Marshal(r protocol.IO)
Marshal ...
type CraftResultsDeprecatedStackRequestAction ¶
type CraftResultsDeprecatedStackRequestAction struct { ResultItems []protocol.ItemStack TimesCrafted byte }
CraftResultsDeprecatedStackRequestAction is an additional, deprecated packet sent by the client after crafting. It holds the final results and the amount of times the recipe was crafted. It shouldn't be used. This action is also sent when an item is enchanted. Enchanting should be treated mostly the same way as crafting, where the old item is consumed.
func (*CraftResultsDeprecatedStackRequestAction) Marshal ¶
func (a *CraftResultsDeprecatedStackRequestAction) Marshal(r protocol.IO)
Marshal ...
type CreateStackRequestAction ¶
type CreateStackRequestAction struct { // ResultsSlot is the slot in the inventory in which the results of the crafting ingredients are to be // placed. ResultsSlot byte }
CreateStackRequestAction is sent by the client when an item is created through being used as part of a recipe. For example, when milk is used to craft a cake, the buckets are leftover. The buckets are moved to the slot sent by the client here. Note that before this is sent, an action for consuming all items in the crafting table/grid is sent. Items that are not fully consumed when used for a recipe should not be destroyed there, but instead, should be turned into their respective resulting items.
func (*CreateStackRequestAction) Marshal ¶
func (a *CreateStackRequestAction) Marshal(r protocol.IO)
Marshal ...
type DestroyStackRequestAction ¶
type DestroyStackRequestAction struct { // Count is the count of the item in the source slot that was destroyed. Count byte // Source is the source slot from which items came that were destroyed by moving them into the creative // inventory. Source StackRequestSlotInfo }
DestroyStackRequestAction is sent by the client when it destroys an item in creative mode by moving it back into the creative inventory.
func (*DestroyStackRequestAction) Marshal ¶
func (a *DestroyStackRequestAction) Marshal(r protocol.IO)
Marshal ...
type DropStackRequestAction ¶
type DropStackRequestAction struct { // Count is the count of the item in the source slot that was taken towards the destination slot. Count byte // Source is the source slot from which items were dropped to the ground. Source StackRequestSlotInfo // Randomly seems to be set to false in most cases. I'm not entirely sure what this does, but this is what // vanilla calls this field. Randomly bool }
DropStackRequestAction is sent by the client when it drops an item out of the inventory when it has its inventory opened. This action is not sent when a player drops an item out of the hotbar using the Q button (or the equivalent on mobile). The InventoryTransaction packet is still used for that action, regardless of whether the item stack network IDs are used or not.
func (*DropStackRequestAction) Marshal ¶
func (a *DropStackRequestAction) Marshal(r protocol.IO)
Marshal ...
type EntityLink ¶ added in v0.0.4
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 // RiderInitiated specifies if the link was created by the rider, for example the player starting to ride // a horse by itself. This is generally true in vanilla environment for players. RiderInitiated bool // VehicleAngularVelocity is the angular velocity of the vehicle that the rider is riding. VehicleAngularVelocity float32 }
EntityLink is a link between two entities, typically being one entity riding another.
func (*EntityLink) FromLatest ¶ added in v0.0.4
func (x *EntityLink) FromLatest(link protocol.EntityLink) EntityLink
func (*EntityLink) Marshal ¶ added in v0.0.4
func (x *EntityLink) Marshal(r protocol.IO)
Marshal encodes/decodes a single entity link.
func (*EntityLink) ToLatest ¶ added in v0.0.4
func (x *EntityLink) ToLatest() protocol.EntityLink
type FullContainerName ¶ added in v0.0.3
type FullContainerName struct { // ContainerID is the ID of the container that the slot was in. ContainerID byte // DynamicContainerID is the ID of the container if it is dynamic. If the container is not dynamic, this // field should be left empty. A non-optional value of 0 is assumed to be non-empty. DynamicContainerID protocol.Optional[uint32] }
FullContainerName contains information required to identify a container in a StackRequestSlotInfo.
func (*FullContainerName) FromLatest ¶ added in v0.0.3
func (x *FullContainerName) FromLatest(v protocol.FullContainerName) FullContainerName
func (*FullContainerName) Marshal ¶ added in v0.0.3
func (x *FullContainerName) Marshal(r protocol.IO)
func (*FullContainerName) ToLatest ¶ added in v0.0.3
func (x *FullContainerName) ToLatest() protocol.FullContainerName
type InventoryTransactionData ¶ added in v0.0.4
type InventoryTransactionData interface { // Marshal encodes/decodes a serialised inventory transaction data object. Marshal(r protocol.IO) }
InventoryTransactionData represents an object that holds data specific to an inventory transaction type. The data it holds depends on the type.
type ItemStackRequest ¶
type ItemStackRequest struct { // RequestID is a unique ID for the request. This ID is used by the server to send a response for this // specific request in the ItemStackResponse packet. RequestID int32 // Actions is a list of actions performed by the client. The actual type of the actions depends on which // ID was present, and is one of the concrete types below. Actions []protocol.StackRequestAction // FilterStrings is a list of filter strings involved in the request. This is typically filled with one string // when an anvil or cartography is used. FilterStrings []string // FilterCause represents the cause of any potential filtering. This is one of the constants above. FilterCause int32 }
ItemStackRequest represents a single request present in an ItemStackRequest packet sent by the client to change an item in an inventory. Item stack requests are either approved or rejected by the server using the ItemStackResponse packet.
func (*ItemStackRequest) Marshal ¶
func (x *ItemStackRequest) Marshal(r protocol.IO)
Marshal encodes/decodes an ItemStackRequest.
type ItemStackResponse ¶
type ItemStackResponse struct { // Status specifies if the request with the RequestID below was successful. If this is the case, the // ContainerInfo below will have information on what slots ended up changing. If not, the container info // will be empty. // A non-0 status means an error occurred and will result in the action being reverted. Status uint8 // RequestID is the unique ID of the request that this response is in reaction to. If rejected, the client // will undo the actions from the request with this ID. RequestID int32 // ContainerInfo holds information on the containers that had their contents changed as a result of the // request. ContainerInfo []StackResponseContainerInfo }
ItemStackResponse is a response to an individual ItemStackRequest.
func (*ItemStackResponse) FromLatest ¶ added in v0.0.3
func (x *ItemStackResponse) FromLatest(y protocol.ItemStackResponse) ItemStackResponse
func (*ItemStackResponse) Marshal ¶
func (x *ItemStackResponse) Marshal(r protocol.IO)
Marshal encodes/decodes an ItemStackResponse.
func (*ItemStackResponse) ToLatest ¶
func (x *ItemStackResponse) ToLatest() protocol.ItemStackResponse
type LabTableCombineStackRequestAction ¶
type LabTableCombineStackRequestAction struct{}
LabTableCombineStackRequestAction is sent by the client when it uses a lab table to combine item stacks.
func (*LabTableCombineStackRequestAction) Marshal ¶
func (a *LabTableCombineStackRequestAction) Marshal(protocol.IO)
Marshal ...
type MineBlockStackRequestAction ¶
type MineBlockStackRequestAction struct { // HotbarSlot is the slot held by the player while mining a block. HotbarSlot int32 // PredictedDurability is the durability of the item that the client assumes to be present at the time. PredictedDurability int32 // StackNetworkID is the unique stack ID that the client assumes to be present at the time. The server // must check if these IDs match. If they do not match, servers should reject the stack request that the // action holding this info was in. StackNetworkID int32 }
MineBlockStackRequestAction is sent by the client when it breaks a block.
func (*MineBlockStackRequestAction) Marshal ¶
func (a *MineBlockStackRequestAction) Marshal(r protocol.IO)
Marshal ...
type PlaceInContainerStackRequestAction ¶
type PlaceInContainerStackRequestAction struct {
// contains filtered or unexported fields
}
PlaceInContainerStackRequestAction currently has no known purpose.
type PlaceStackRequestAction ¶
type PlaceStackRequestAction struct {
// contains filtered or unexported fields
}
PlaceStackRequestAction is sent by the client to the server to place x amount of items from one slot into another slot, such as when shift clicking an item in the inventory to move it around or when moving an item in the cursor into a slot.
type StackRequestAction ¶
StackRequestAction represents a single action related to the inventory present in an ItemStackRequest. The action is one of the concrete types below, each of which are indicative of a different action by the client, such as moving an item around the inventory or placing a block. It is an alias of Marshaler.
type StackRequestSlotInfo ¶
type StackRequestSlotInfo struct { // Container is the FullContainerName that describes the container that the slot is in. Container FullContainerName // Slot is the index of the slot within the container with the ContainerID above. Slot byte // StackNetworkID is the unique stack ID that the client assumes to be present in this slot. The server // must check if these IDs match. If they do not match, servers should reject the stack request that the // action holding this info was in. StackNetworkID int32 }
StackRequestSlotInfo holds information on a specific slot client-side.
type StackResponseContainerInfo ¶
type StackResponseContainerInfo struct { // Container is the FullContainerName that describes the container that the slots that follow are in. For // the main inventory, the ContainerID seems to be 0x1b. Fur the cursor, this value seems to be 0x3a. For // the crafting grid, this value seems to be 0x0d. Container FullContainerName // SlotInfo holds information on what item stack should be present in specific slots in the container. SlotInfo []StackResponseSlotInfo }
StackResponseContainerInfo holds information on what slots in a container have what item stack in them.
func (*StackResponseContainerInfo) Marshal ¶
func (x *StackResponseContainerInfo) Marshal(r protocol.IO)
Marshal encodes/decodes a StackResponseContainerInfo.
type StackResponseSlotInfo ¶
type StackResponseSlotInfo struct {
// Slot and HotbarSlot seem to be the same value every time: The slot that was actually changed. I'm not
// sure if these slots ever differ.
Slot, HotbarSlot byte
// Count is the total count of the item stack. This count will be shown client-side after the response is
// sent to the client.
Count byte
// StackNetworkID is the network ID of the new stack at a specific slot.
StackNetworkID int32
// CustomName is the custom name of the item stack. It is used in relation to text filtering.
CustomName string
// FilteredCustomName is a filtered version of CustomName with all the profanity removed. The client will
// use this over CustomName if this field is not empty and they have the "Filter Profanity" setting enabled.
FilteredCustomName string
// DurabilityCorrection is the current durability of the item stack. This durability will be shown
// client-side after the response is sent to the client.
DurabilityCorrection int32
}
StackResponseSlotInfo holds information on what item stack should be present in a specific slot.
func (*StackResponseSlotInfo) Marshal ¶
func (x *StackResponseSlotInfo) Marshal(r protocol.IO)
Marshal encodes/decodes a StackResponseSlotInfo.
type SwapStackRequestAction ¶
type SwapStackRequestAction struct {
// Source and Destination point to the source slot from which Count of the item stack were taken and the
// destination slot to which this item was moved.
Source, Destination StackRequestSlotInfo
}
SwapStackRequestAction is sent by the client to swap the item in its cursor with an item present in another container. The two item stacks swap places.
func (*SwapStackRequestAction) Marshal ¶
func (a *SwapStackRequestAction) Marshal(r protocol.IO)
Marshal ...
type TakeOutContainerStackRequestAction ¶
type TakeOutContainerStackRequestAction struct {
// contains filtered or unexported fields
}
TakeOutContainerStackRequestAction currently has no known purpose.
type TakeStackRequestAction ¶
type TakeStackRequestAction struct {
// contains filtered or unexported fields
}
TakeStackRequestAction is sent by the client to the server to take x amount of items from one slot in a container to the cursor.
type TexturePackInfo ¶
type TexturePackInfo struct { // UUID is the UUID of the texture pack. Each texture pack downloaded must have a different UUID in // order for the client to be able to handle them properly. UUID uuid.UUID // Version is the version of the texture pack. The client will cache texture packs sent by the server as // long as they carry the same version. Sending a texture pack with a different version than previously // will force the client to re-download it. Version string // Size is the total size in bytes that the texture pack occupies. This is the size of the compressed // archive (zip) of the texture pack. Size uint64 // ContentKey is the key used to decrypt the behaviour pack if it is encrypted. This is generally the case // for marketplace texture packs. ContentKey string // SubPackName ... SubPackName string // ContentIdentity is another UUID for the resource pack, and is generally set for marketplace texture // packs. It is also required for client-side validations when the resource pack is encrypted. ContentIdentity string // HasScripts specifies if the texture packs has any scripts in it. A client will only download the // behaviour pack if it supports scripts, which, up to 1.11, only includes Windows 10. HasScripts bool // AddonPack specifies if the texture pack is from an addon. AddonPack bool // RTXEnabled specifies if the texture pack uses the raytracing technology introduced in 1.16.200. RTXEnabled bool // DownloadURL is a URL that the client can use to download the pack instead of the server sending it in // chunks, which it will continue to do if this field is left empty. DownloadURL string }
TexturePackInfo represents a texture pack's info sent over network. It holds information about the texture pack such as its name, description and version.
func (*TexturePackInfo) FromLatest ¶ added in v0.0.3
func (x *TexturePackInfo) FromLatest(y protocol.TexturePackInfo) TexturePackInfo
func (*TexturePackInfo) Marshal ¶
func (x *TexturePackInfo) Marshal(r protocol.IO)
Marshal encodes/decodes a TexturePackInfo.
func (*TexturePackInfo) ToLatest ¶
func (x *TexturePackInfo) ToLatest() protocol.TexturePackInfo
type UseItemTransactionData ¶ added in v0.0.4
type UseItemTransactionData struct { // LegacyRequestID is an ID that is only non-zero at times when sent by the client. The server should // always send 0 for this. When this field is not 0, the LegacySetItemSlots slice below will have values // in it. // LegacyRequestID ties in with the ItemStackResponse packet. If this field is non-0, the server should // respond with an ItemStackResponse packet. Some inventory actions such as dropping an item out of the // hotbar are still one using this packet, and the ItemStackResponse packet needs to tie in with it. LegacyRequestID int32 // LegacySetItemSlots are only present if the LegacyRequestID is non-zero. These item slots inform the // server of the slots that were changed during the inventory transaction, and the server should send // back an ItemStackResponse packet with these slots present in it. (Or false with no slots, if rejected.) LegacySetItemSlots []protocol.LegacySetItemSlot // Actions is a list of actions that took place, that form the inventory transaction together. Each of // these actions hold one slot in which one item was changed to another. In general, the combination of // all of these actions results in a balanced inventory transaction. This should be checked to ensure that // no items are cheated into the inventory. Actions []protocol.InventoryAction // 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 // TriggerType is the type of the trigger that caused the inventory transaction. It is one of the trigger // types found in the constants above. If TriggerType is TriggerTypePlayerInput, the transaction is from // the initial input of the player. If it is TriggerTypeSimulationTick, the transaction is from a simulation // tick when the player is holding down the input. TriggerType 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 protocol.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 protocol.ItemInstance // 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 // ClientPrediction is the client's prediction on the output of the transaction. It is one of the client // prediction found in the constants above. ClientPrediction uint32 }
UseItemTransactionData represents an inventory transaction data object sent when the client uses an item on a block.
func (*UseItemTransactionData) FromLatest ¶ added in v0.0.4
func (x *UseItemTransactionData) FromLatest(l *protocol.UseItemTransactionData) *UseItemTransactionData
func (*UseItemTransactionData) Marshal ¶ added in v0.0.4
func (x *UseItemTransactionData) Marshal(r protocol.IO)
Marshal ...
func (*UseItemTransactionData) ToLatest ¶ added in v0.0.4
func (x *UseItemTransactionData) ToLatest() *protocol.UseItemTransactionData