mca: Fix calculation of needed sector count
With a data length of 4092, 2 sectors were required instead of 1
This commit is contained in:
@ -4,6 +4,7 @@ import (
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"io"
|
||||
"math"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
@ -152,7 +153,7 @@ func (r *Region) ReadSector(x, z int) (data []byte, err error) {
|
||||
|
||||
// WriteSector write Chunk data into region file
|
||||
func (r *Region) WriteSector(x, z int, data []byte) error {
|
||||
need := int32(len(data)+4)/4096 + 1
|
||||
need := int32(math.Ceil(float64(len(data)+4) / 4096))
|
||||
n, now := sectorLoc(r.offsets[z][x])
|
||||
|
||||
// maximum chunk size is 1MB
|
||||
|
Reference in New Issue
Block a user