Documentation ¶
Index ¶
- func DowngradeItemStackActions(actions []protocol.StackRequestAction) []protocol.StackRequestAction
- func LookupStackRequestAction(id uint8, x *protocol.StackRequestAction) bool
- func LookupStackRequestActionType(x protocol.StackRequestAction, id *uint8) bool
- func StackReqSlotInfo(r protocol.IO, x *StackRequestSlotInfo)
- func UpgradeContainer(c FullContainerName) protocol.FullContainerName
- func UpgradeItemStackActions(actions []protocol.StackRequestAction) []protocol.StackRequestAction
- func UpgradeStackRequestSlotInfo(s StackRequestSlotInfo) protocol.StackRequestSlotInfo
- type Attribute
- type AutoCraftRecipeStackRequestAction
- type CameraPreset
- type ConsumeStackRequestAction
- type CraftCreativeStackRequestAction
- type CraftGrindstoneRecipeStackRequestAction
- type CraftRecipeOptionalStackRequestAction
- type CraftRecipeStackRequestAction
- type DestroyStackRequestAction
- type DropStackRequestAction
- type EntityLink
- type FullContainerName
- type ItemStackRequest
- type ItemStackResponse
- type LabTableCombineStackRequestAction
- type PlaceInContainerStackRequestAction
- type PlaceStackRequestAction
- type StackRequestSlotInfo
- type StackResponseContainerInfo
- type SwapStackRequestAction
- type TakeOutContainerStackRequestAction
- type TakeStackRequestAction
- type TexturePackInfo
- type UseItemTransactionData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DowngradeItemStackActions ¶
func DowngradeItemStackActions(actions []protocol.StackRequestAction) []protocol.StackRequestAction
func LookupStackRequestAction ¶
func LookupStackRequestAction(id uint8, x *protocol.StackRequestAction) bool
LookupStackRequestAction looks up the StackRequestAction matching an ID.
func LookupStackRequestActionType ¶
func LookupStackRequestActionType(x protocol.StackRequestAction, id *uint8) bool
LookupStackRequestActionType looks up the ID of a StackRequestAction.
func StackReqSlotInfo ¶
func StackReqSlotInfo(r protocol.IO, x *StackRequestSlotInfo)
StackReqSlotInfo reads/writes a StackRequestSlotInfo x using IO r.
func UpgradeContainer ¶
func UpgradeContainer(c FullContainerName) protocol.FullContainerName
func UpgradeItemStackActions ¶
func UpgradeItemStackActions(actions []protocol.StackRequestAction) []protocol.StackRequestAction
func UpgradeStackRequestSlotInfo ¶
func UpgradeStackRequestSlotInfo(s StackRequestSlotInfo) protocol.StackRequestSlotInfo
Types ¶
type Attribute ¶
type Attribute struct { protocol.AttributeValue // 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.
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 // 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 CameraPreset ¶
type CameraPreset struct {
protocol.CameraPreset
}
func (*CameraPreset) Marshal ¶
func (x *CameraPreset) Marshal(r protocol.IO)
Marshal encodes/decodes a CameraPreset.
type ConsumeStackRequestAction ¶
type ConsumeStackRequestAction struct {
DestroyStackRequestAction
}
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 }
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 // 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 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 }
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 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 }
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 }
func (*DropStackRequestAction) Marshal ¶
func (a *DropStackRequestAction) Marshal(r protocol.IO)
Marshal ...
type EntityLink ¶
type EntityLink struct {
protocol.EntityLink
}
EntityLink is a link between two entities, typically being one entity riding another.
func (*EntityLink) Marshal ¶
func (x *EntityLink) Marshal(r protocol.IO)
Marshal encodes/decodes a single entity link.
type FullContainerName ¶
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 uint32 }
FullContainerName contains information required to identify a container in a StackRequestSlotInfo.
func DowngradeContainer ¶
func DowngradeContainer(c protocol.FullContainerName) FullContainerName
func (*FullContainerName) Marshal ¶
func (x *FullContainerName) Marshal(r protocol.IO)
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) Marshal ¶
func (x *ItemStackResponse) Marshal(r protocol.IO)
Marshal encodes/decodes an 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 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
}
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.
func DowngradeStackRequestSlotInfo ¶
func DowngradeStackRequestSlotInfo(s protocol.StackRequestSlotInfo) StackRequestSlotInfo
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 []protocol.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 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
}
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
}
type TexturePackInfo ¶
type TexturePackInfo struct {
protocol.TexturePackInfo
}
func (*TexturePackInfo) Marshal ¶
func (x *TexturePackInfo) Marshal(r protocol.IO)
Marshal encodes/decodes a TexturePackInfo.
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 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 }
func (*UseItemTransactionData) Marshal ¶
func (data *UseItemTransactionData) Marshal(r protocol.IO)