Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let chunk = 16, breakpoints = { x: [], y: [], z: [] }
- let Position = {
- min: {
- x: Math.min(position1.x , position2.x),
- y: Math.min(position1.y , position2.y),
- z: Math.min(position1.z , position2.z)
- },
- max: {
- x: Math.max(position1.x , position2.x),
- y: Math.max(position1.y , position2.y),
- z: Math.max(position1.z , position2.z)
- },
- get size() {
- return (this.max.x - this.min.x) * (this.max.y - this.min.y) * (this.max.z - this.min.z)
- }
- }
- // Chunk selection bassed on region size
- if(Position.size <= 34000) {chunk = 24}
- else if(Position.size <= 68000) {chunk = 22}
- else if(Position.size <= 128000) {chunk = 20}
- else if(Position.size <= 256000) {chunk = 18}
- tellraw(callerName, "ยง7> Chunk size used: "+chunk);
- // Creating Breakpoints / Spliting Cordintes
- ["x", "y", "z"].forEach(Axis => {
- for(let xyz = Position.min[Axis] ;; xyz += chunk) {
- if(xyz < Position.max[Axis]) {
- breakpoints[Axis].push( xyz)
- }else{
- breakpoints[Axis].push( Position.max[Axis]);
- break
- }
- }
- })
- // [0 5 10 15 20]
- // Making Positions From Breakpoint
- let sets = [];
- breakpoints.x.forEach( (X, Xindex) => {
- breakpoints.y.forEach( (Y, Yindex) => {
- breakpoints.z.forEach( (Z, Zindex) => {
- let [x1, y1, z1] = [X, Y, Z]
- let [x2, y2, z2] = [breakpoints.x[Xindex + 1] , breakpoints.y[Yindex + 1] , breakpoints.z[Zindex + 1]];
- if(x2 == undefined) {x2 = x1}
- if(y2 == undefined) {y2 = y1}
- if(z2 == undefined) {z2 = z1}
- if(breakpoints.x.length > 1 && x1 == x2 ||
- breakpoints.y.length > 1 && y1 == y2 ||
- breakpoints.z.length > 1 && z1 == z2
- ) {return}
- if(Xindex) {x1++} // as first
- if(Yindex) {y1++} // value in array
- if(Zindex) {z1++} // is zero
- sets.push({
- position1: {x: x1, y: y1, z: z1},
- position2: {x: x2, y: y2, z: z2}
- })
- })
- })
- })
Add Comment
Please, Sign In to add comment