Translate ItemStackRequest

This commit is contained in:
AkmalFairuz
2025-01-01 14:22:41 +07:00
parent e2c9fe43cc
commit d469d7573d
4 changed files with 177 additions and 76 deletions

View File

@@ -0,0 +1,26 @@
package legacypacket
import (
"github.com/akmalfairuz/legacy-version/legacyver/proto"
"github.com/sandertv/gophertunnel/minecraft/protocol"
"github.com/sandertv/gophertunnel/minecraft/protocol/packet"
)
// ItemStackRequest is sent by the client to change item stacks in an inventory. It is essentially a
// replacement of the InventoryTransaction packet added in 1.16 for inventory specific actions, such as moving
// items around or crafting. The InventoryTransaction packet is still used for actions such as placing blocks
// and interacting with entities.
type ItemStackRequest struct {
// Requests holds a list of item stack requests. These requests are all separate, but the client buffers
// the requests, so you might find multiple unrelated requests in this packet.
Requests []proto.ItemStackRequest
}
// ID ...
func (*ItemStackRequest) ID() uint32 {
return packet.IDItemStackRequest
}
func (pk *ItemStackRequest) Marshal(io protocol.IO) {
protocol.Slice(io, &pk.Requests)
}