MCPcopy Create free account
hub / github.com/ZeppelinMC/Zeppelin / EncodeResize

Method EncodeResize

server/container/container.go:15–29  ·  view source on GitHub ↗

NetworkConvert encodes the container with the specified size and changes the slot from data slots to network slots. This should be used for inventories

(size int)

Source from the content-addressed store, hash-verified

13
14// NetworkConvert encodes the container with the specified size and changes the slot from data slots to network slots. This should be used for inventories
15func (c Container) EncodeResize(size int) []slot.Slot {
16 s := make([]slot.Slot, size)
17 for _, item := range c {
18 id, ok := registry.Item.Lookup(item.Id)
19 if !ok {
20 continue
21 }
22 s[item.Slot.Network()] = slot.Slot{
23 ItemCount: item.Count,
24 ItemId: id,
25 }
26 }
27
28 return s
29}
30
31func (c Container) Encode() []slot.Slot {
32 s := make([]slot.Slot, len(c))

Callers

nothing calls this directly

Calls 2

LookupMethod · 0.80
NetworkMethod · 0.80

Tested by

no test coverage detected