Skip to content

What about this? #26

@axionbuster

Description

@axionbuster

buf := buffers.Buffers.Get().(*bytes.Buffer)
for x := chunkX - viewDistance; x < chunkX+viewDistance; x++ {
for z := chunkZ - viewDistance; z < chunkZ+viewDistance; z++ {
buf.Reset()
c, err := session.Dimension().GetChunkBuf(x, z, buf)
if err != nil {
continue
}
buf.Reset()
if err := session.WritePacket(c.EncodeBuf(session.registryIndexes["minecraft:worldgen/biome"], buf)); err != nil {
return err
}
chunks++
}
}
buffers.Buffers.Put(buf)

I'm not a Go programmer so excuse me, but if what I think is correct, then a failure in WritePacket can lead to a resource leak.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions