Skip to content

Commit

Permalink
fix min/max chunk calc
Browse files Browse the repository at this point in the history
  • Loading branch information
BuckarooBanzay committed Nov 18, 2023
1 parent e65b8e3 commit dbe3d38
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
13 changes: 13 additions & 0 deletions process_export_protected.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,19 @@ func ProcessExportProtected(areas []*areasparser.Area) error {
chunk1_x, chunk1_y, chunk1_z := GetChunkPosFromNode(p1.X, p1.Y, p1.Z)
chunk2_x, chunk2_y, chunk2_z := GetChunkPosFromNode(p2.X, p2.Y, p2.Z)

logrus.WithFields(logrus.Fields{
"chunk1_x": chunk1_x,
"chunk1_y": chunk1_y,
"chunk1_z": chunk1_z,
"chunk2_x": chunk2_x,
"chunk2_y": chunk2_y,
"chunk2_z": chunk2_z,
"p1": p1,
"p2": p2,
"area.Pos1": area.Pos1,
"area.Pos2": area.Pos2,
}).Info("exported area info")

for x := chunk1_x; x <= chunk2_x; x++ {
for y := chunk1_y; y <= chunk2_y; y++ {
for z := chunk1_z; z <= chunk2_z; z++ {
Expand Down
12 changes: 9 additions & 3 deletions util.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,26 @@ func SortPos(p1, p2 *areasparser.GenericPos) (*areasparser.GenericPos, *areaspar

if p1.X > p2.X {
hi.X = p1.X
} else {
lo.X = p2.X
} else {
hi.X = p2.X
lo.X = p1.X
}

if p1.Y > p2.Y {
hi.Y = p1.Y
} else {
lo.Y = p2.Y
} else {
hi.Y = p2.Y
lo.Y = p1.Y
}

if p1.Z > p2.Z {
hi.Z = p1.Z
} else {
lo.Z = p2.Z
} else {
hi.Z = p2.Z
lo.Z = p1.Z
}

return lo, hi
Expand Down

0 comments on commit dbe3d38

Please sign in to comment.