mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-23 07:10:41 +00:00
75 lines
88 KiB
JavaScript
75 lines
88 KiB
JavaScript
import{p as jt,e as Zt,c as Re,i as ft,t as Ce,r as ls,a as mt,b as us,s as qt,f as Ze,d as hs,n as cs,g as fs,h as ms,j as ds,k as ps,l as gs,m as Tt,o as vs,q as ws}from"./index.d528c217.js";var F,Ee;(Ee=F||(F={})).UP="up",Ee.DOWN="down",Ee.NORTH="north",Ee.EAST="east",Ee.SOUTH="south",Ee.WEST="west";const bs={[F.UP]:[0,1,0],[F.DOWN]:[0,-1,0],[F.NORTH]:[0,0,-1],[F.EAST]:[1,0,0],[F.SOUTH]:[0,0,1],[F.WEST]:[-1,0,0]};var J,me;(function(s){s.ALL=[s.UP,s.DOWN,s.NORTH,s.EAST,s.SOUTH,s.WEST],s.normal=function(e){return bs[e]}})(F||(F={})),(me=J||(J={})).create=function(s,e,t){return[s,e,t]},me.ZERO=me.create(0,0,0),me.offset=function(s,e,t,i){return[s[0]+e,s[1]+t,s[2]+i]},me.towards=function(s,e){return me.offset(s,...F.normal(e))},me.equals=function(s,e){return s===e||s[0]===e[0]&&s[1]===e[1]&&s[2]===e[2]},me.magnitude=function(s){return s[0]*s[0]+s[1]*s[1]+s[2]*s[2]};const Ve={end:0,byte:1,short:2,int:3,long:4,float:5,double:6,byteArray:7,string:8,list:9,compound:10,intArray:11,longArray:12},Ct=["end","byte","short","int","long","float","double","byteArray","string","list","compound","intArray","longArray"];class Ss{constructor(e,t=!1){this.byte=this.readNum.bind(this,"getInt8",1),this.short=this.readNum.bind(this,"getInt16",2),this.int=this.readNum.bind(this,"getInt32",4),this.float=this.readNum.bind(this,"getFloat32",4),this.double=this.readNum.bind(this,"getFloat64",8),this.offset=0,this.littleEndian=t,this.arrayView=e,this.dataView=new DataView(e.buffer,e.byteOffset)}end(){return null}readNum(e,t){const i=this.dataView[e](this.offset,this.littleEndian);return this.offset+=t,i}long(){return[this.int(),this.int()]}byteArray(){const e=this.int(),t=[];for(let i=0;i<e;i++)t.push(this.byte());return t}intArray(){const e=this.int(),t=[];for(let i=0;i<e;i++)t.push(this.int());return t}longArray(){const e=this.int(),t=[];for(let i=0;i<e;i++)t.push(this.long());return t}string(){const e=this.short(),t=this.arrayView.slice(this.offset,this.offset+e);return this.offset+=e,function(i){var r,n=[];for(r=0;r<i.length;r++)(128&i[r])==0?n.push(127&i[r]):r+1<i.length&&(224&i[r])==192&&(192&i[r+1])==128?n.push((31&i[r])<<6|63&i[r+1]):r+2<i.length&&(240&i[r])==224&&(192&i[r+1])==128&&(192&i[r+2])==128?n.push((15&i[r])<<12|(63&i[r+1])<<6|63&i[r+2]):r+3<i.length&&(248&i[r])==240&&(192&i[r+1])==128&&(192&i[r+2])==128&&(192&i[r+3])==128&&n.push((7&i[r])<<18|(63&i[r+1])<<12|(63&i[r+2])<<6|63&i[r+3]);return String.fromCharCode.apply(null,n)}(t)}list(){const e=Ct[this.byte()],t=this.int(),i=[];for(let r=0;r<t;r++)i.push(this[e]());return{type:e,value:i}}compound(){const e={};for(;;){const t=Ct[this.byte()];if(t==="end")break;const i=this.string(),r=this[t]();e[i]={type:t,value:r}}return e}}class xs{constructor(e=!1){this.byte=this.writeNum.bind(this,"setInt8",1),this.short=this.writeNum.bind(this,"setInt16",2),this.int=this.writeNum.bind(this,"setInt32",4),this.float=this.writeNum.bind(this,"setFloat32",4),this.double=this.writeNum.bind(this,"setFloat64",8),this.offset=0,this.littleEndian=e,this.buffer=new ArrayBuffer(1024),this.arrayView=new Uint8Array(this.buffer),this.dataView=new DataView(this.buffer)}accommodate(e){const t=this.offset+e;if(this.buffer.byteLength>=t)return;let i=this.buffer.byteLength;for(;i<t;)i*=2;const r=new ArrayBuffer(i),n=new Uint8Array(r);n.set(this.arrayView),this.offset>this.buffer.byteLength&&n.fill(0,this.buffer.byteLength,this.offset),this.buffer=r,this.dataView=new DataView(r),this.arrayView=n}getData(){return this.accommodate(0),this.arrayView.slice(0,this.offset)}end(e){}writeNum(e,t,i){this.accommodate(t),this.dataView[e](this.offset,i,this.littleEndian),this.offset+=t}long(e){this.int(e[0]),this.int(e[1])}byteArray(e){this.int(e.length),this.accommodate(e.length),this.arrayView.set(e,this.offset),this.offset+=e.length}intArray(e){this.int(e.length);for(let t=0;t<e.length;t++)this.int(e[t])}longArray(e){this.int(e.length);for(let t=0;t<e.length;t++)this.long(e[t])}string(e){const t=function(i){var r,n,a=[];for(r=0;r<i.length;r++)(n=i.charCodeAt(r))<128?a.push(n):n<2048?(a.push(192|n>>6),a.push(128|63&n)):n<65536?(a.push(224|n>>12),a.push(128|n>>6&63),a.push(128|63&n)):(a.push(240|n>>18&7),a.push(128|n>>12&63),a.push(128|n>>6&63),a.push(128|63&n));return a}(e);this.short(t.length),this.accommodate(t.length),this.arrayView.set(t,this.offset),this.offset+=t.length}list(e){this.byte(Ve[e.type]),this.int(e.value.length),e.value;for(let t=0;t<e.value.length;t++)this[e.type](e.value[t])}compound(e){for(const t in e)this.byte(Ve[e[t].type]),this.string(t),this[e[t].type](e[t].value);this.byte(Ve.end)}}function Et(s,e){const t=new Ss(s,e);if(t.byte()!==Ve.compound)throw new Error("Top tag should be a compound");return{name:t.string(),value:t.compound()}}function Wt(s,e){return Et(jt.inflate(s),e)}function Ws(s,e){return(t=new Uint8Array(s.slice(0,2))).length===2&&t[0]===31&&t[1]===139?{compressed:!0,result:Wt(s,e)}:{compressed:!1,result:Et(s,e)};var t}function Js(s){const e=[];for(let t=0;t<32;t+=1)for(let i=0;i<32;i+=1){const r=4*((31&t)+32*(31&i));if(s[r+3]===0)continue;const n=(s[r]<<16)+(s[r+1]<<8)+s[r+2],a=(s[r+4096]<<24)+(s[r+4097]<<16)+(s[r+4098]<<8)+s[r+4099],o=4096*n,u=(s[o]<<24)+(s[o+1]<<16)+(s[o+2]<<8)+s[o+3],f=s[o+4],c=s.slice(o+5,o+4+u);e.push({x:t,z:i,timestamp:a,compression:f,data:c})}return e}function $s(s,e,t){const i=Jt(s,e,t);switch(i.compression){case 1:case 2:i.nbt=Wt(i.data);break;case 3:i.nbt=Et(i.data);break;default:throw new Error(`Invalid compression mode ${i.compression}`)}return i}function It(s,e){const t=new xs(e);return t.byte(Ve.compound),t.string(s.name),t.compound(s.value),t.getData()}function dt(s,e,t){const i=It(s,e);return jt[t?"deflate":"gzip"](i)}function Ks(s,e,t){return e?dt(s,t):It(s,t)}function Qs(s){let e=0;for(const n of s)e+=Math.ceil(n.data.length/4096);const t=new Uint8Array(8192+4096*e),i=new DataView(t.buffer);let r=2;for(const n of s){const a=4*((31&n.x)+32*(31&n.z)),o=Math.ceil(n.data.length/4096);i.setInt8(a,r>>16),i.setInt16(a+1,65535&r),i.setInt8(a+3,o),i.setInt32(a+4096,n.timestamp);const u=4096*r;i.setInt32(u,n.data.length+1),i.setInt8(u+4,n.compression),t.set(n.data,u+5),r+=o}return t}function ei(s,e,t,i){const r=Jt(s,e,t);switch(r.compression){case 1:r.data=dt(i);break;case 2:r.data=dt(i,!1,!0);break;case 3:r.data=It(i);break;default:throw new Error(`Invalid compression mode ${r.compression}`)}return r}function Jt(s,e,t){const i=s.find(r=>r.x===e&&r.z===t);if(i===void 0)throw new Error(`Cannot find chunk [${e}, ${t}]`);return i}function Be(s,e,t){if(!s[e])throw new Error(`Missing ${e} tag`);if(s[e].type!==t)throw new Error(`Expected ${e} to be of type ${t}, but found ${s[e].type}`);return s[e].value}function He(s,e,t,i){const r=Be(s,e,"list");if(r.type!==t)throw new Error(`Expected ${e} to be a list of ${t}s, but found ${r.type}s`);if(i&&r.value.length!==i)throw new Error(`Expected ${e} to be a list of length ${i}, but found length ${r.value.length}`);return r.value}function $t(s,e){try{return s()}catch{return e}}var v;function qe(s){let e=null;return()=>(e==null&&(e=s()),e)}function nt(s,e,t){const i=s.get(e);if(i)return i;const r=t(e);return s.set(e,r),r}(function(s){function e(t){return typeof t=="object"&&t!==null?t:void 0}s.readNumber=function(t){return typeof t=="number"?t:void 0},s.readInt=function(t){return typeof t=="number"?Math.floor(t):void 0},s.readString=function(t){return typeof t=="string"?t:void 0},s.readBoolean=function(t){return typeof t=="boolean"?t:void 0},s.readObject=e,s.readArray=function(t,i){if(Array.isArray(t))return t.map(r=>i(r))},s.readMap=function(t,i){var r;const n=(r=e(t))!=null?r:{};return Object.fromEntries(Object.entries(n).map(([a,o])=>[a,i(o)]))},s.compose=function(t,i,r){const n=i(t);return n?r(n):void 0},s.readEnum=function(t,i){return typeof t!="string"?i[0]:i.includes(t)?t:i[0]}})(v||(v={}));const We=class{constructor(s,e){if(this.namespace=s,this.path=e,!s.match(/^[a-z0-9._-]+$/))throw new Error(`Non [a-z0-9._-] character in namespace of ${s}:${e}`);if(!e.match(/^[a-z0-9/._-]+$/))throw new Error(`Non [a-z0-9/._-] character in path of ${s}:${e}`)}equals(s){return this===s||this.namespace===s.namespace&&this.path===s.path}toString(){return`${this.namespace}:${this.path}`}static create(s){return new We(this.DEFAULT_NAMESPACE,s)}static parse(s){const e=s.indexOf(this.SEPARATOR);if(e>=0){const t=e>=1?s.substring(0,e):this.DEFAULT_NAMESPACE,i=s.substring(e+1);return new We(t,i)}return new We(this.DEFAULT_NAMESPACE,s)}};let D=We;D.DEFAULT_NAMESPACE="minecraft",D.SEPARATOR=":";var As=Object.defineProperty,ys=Object.defineProperties,_s=Object.getOwnPropertyDescriptors,Mt=Object.getOwnPropertySymbols,Es=Object.prototype.hasOwnProperty,Is=Object.prototype.propertyIsEnumerable,kt=(s,e,t)=>e in s?As(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;const oe=class{constructor(s,e={}){this.properties=e,this.name=typeof s=="string"?D.parse(s):s}getName(){return this.name}getProperties(){return this.properties}getProperty(s){return this.properties[s]}isFluid(){return this.is(oe.WATER)||this.is(oe.LAVA)}equals(s){return!!this.name.equals(s.name)&&Object.keys(this.properties).every(e=>s.properties[e]===this.properties[e])}is(s){return this.name.equals(s.name)}toString(){return Object.keys(this.properties).length===0?this.name.toString():`${this.name.toString()}[${Object.entries(this.properties).map(([s,e])=>s+"="+e).join(",")}]`}static fromNbt(s){const e=D.parse(Be(s.value,"Name","string")),t=$t(()=>Be(s.value,"Properties","compound"),{}),i=Object.keys(t).reduce((r,n)=>{return a=((u,f)=>{for(var c in f||(f={}))Es.call(f,c)&&kt(u,c,f[c]);if(Mt)for(var c of Mt(f))Is.call(f,c)&&kt(u,c,f[c]);return u})({},r),o={[n]:Be(t,n,"string")},ys(a,_s(o));var a,o},{});return new oe(e,i)}static fromJson(s){var e,t;const i=(e=v.readObject(s))!=null?e:{},r=D.parse((t=v.readString(i.Name))!=null?t:oe.STONE.name.toString()),n=v.readMap(i.Properties,a=>{var o;return(o=v.readString(a))!=null?o:""});return new oe(r,n)}};let P=oe;P.AIR=new oe(D.create("air")),P.STONE=new oe(D.create("stone")),P.WATER=new oe(D.create("water"),{level:"0"}),P.LAVA=new oe(D.create("lava"),{level:"0"});const Ue=class{constructor(s){this.minY=s,this.storage=Array(Ue.SIZE).fill(0),this.palette=[P.AIR]}get minBlockY(){return this.minY<<4}index(s,e,t){return(s<<8)+(e<<4)+t}getBlockState(s,e,t){var i;const r=this.storage[this.index(s,e,t)];return(i=this.palette[r])!=null?i:P.AIR}setBlockState(s,e,t,i){let r=this.palette.findIndex(n=>n.equals(i));r===-1&&(r=this.palette.length,this.palette.push(i)),this.storage[this.index(s,e,t)]=r}};let pt=Ue;pt.WIDTH=16,pt.SIZE=Ue.WIDTH*Ue.WIDTH*Ue.WIDTH;class ti{constructor(e,t,i){this.minY=e,this.height=t,this.pos=i,this.sections=Array(this.sectionsCount).fill(null)}get maxY(){return this.minY+this.height}get minSection(){return this.minY>>4}get maxSection(){return 1+(this.maxY-1>>4)}get sectionsCount(){return this.maxSection-this.minSection}getSectionIndex(e){return(e>>4)-this.minSection}getBlockState(e){var t;const[i,r,n]=e,a=this.sections[this.getSectionIndex(r)];return(t=a==null?void 0:a.getBlockState(15&i,15&r,15&n))!=null?t:P.AIR}setBlockState(e,t){const[i,r,n]=e,a=this.getSectionIndex(r);let o=this.sections[a];if(o===null){if(t.equals(P.AIR))return;o=this.getOrCreateSection(a)}o.setBlockState(15&i,15&r,15&n,t)}getOrCreateSection(e){return this.sections[e]==null&&(this.sections[e]=new pt(this.minSection+e)),this.sections[e]}}var $,Me;(function(s){function e(t,i){return BigInt(4294967295&t)|BigInt(4294967295&i)<<BigInt(32)}s.create=function(t,i){return[t,i]},s.fromBlockPos=function(t){return[t[0]>>4,t[2]>>4]},s.fromLong=function(t){return[4294967295&Number(t),Number(t>>BigInt(32))]},s.toLong=function(t){return e(t[0],t[1])},s.asLong=e,s.minBlockX=function(t){return t[0]<<4},s.minBlockZ=function(t){return t[1]<<4},s.maxBlockX=function(t){return 15+(t[0]<<4)},s.maxBlockZ=function(t){return 15+(t[1]<<4)}})($||($={})),function(s){function e(i){return{value:()=>i,key:()=>{}}}function t(i,r){return{value:()=>i.getOrThrow(r),key:()=>r}}s.parser=function(i,r){return n=>typeof n=="string"?t(i,D.parse(n)):e(r(n))},s.direct=e,s.reference=t}(Me||(Me={}));const Nt=class{constructor(s,e){this.key=s,this.parser=e,this.storage=new Map,this.builtin=new Map}register(s,e,t){return this.storage.set(s.toString(),e),t&&this.builtin.set(s.toString(),e),Me.reference(this,s)}keys(){return[...this.storage.keys()].map(s=>D.parse(s))}get(s){return this.storage.get(s.toString())}getOrThrow(s){const e=this.storage.get(s.toString());if(e===void 0)throw new Error(`Missing key in ${this.key.toString()}: ${s.toString()}`);return e}parse(s){if(!this.parser)throw new Error(`No parser exists for ${this.key.toString()}`);return this.parser(s)}clear(){this.storage.clear();for(const[s,e]of this.builtin.entries())this.storage.set(s,e);return this}assign(s){if(!this.key.equals(s.key))throw new Error(`Cannot assign registry of type ${s.key.toString()} to registry of type ${this.key.toString()}`);for(const e of s.keys())this.storage.set(e.toString(),s.getOrThrow(e));return this}cloneEmpty(){return new Nt(this.key,this.parser)}};let gt=Nt;gt.REGISTRY=new Nt(D.create("root"));class Kt{constructor(e,t=[],i=[]){this.size=e,this.palette=t,this.blocks=i,this.blocksMap=[],i.forEach(r=>{if(!this.isInside(r.pos))throw new Error(`Found block at ${r.pos} which is outside the structure bounds ${this.size}`);this.blocksMap[r.pos[0]*e[1]*e[2]+r.pos[1]*e[2]+r.pos[2]]=r})}getSize(){return this.size}addBlock(e,t,i,r){if(!this.isInside(e))throw new Error(`Cannot add block at ${e} outside the structure bounds ${this.size}`);const n=new P(t,i);let a=this.palette.findIndex(o=>o.equals(n));return a===-1&&(a=this.palette.length,this.palette.push(n)),this.blocks.push({pos:e,state:a,nbt:r}),this.blocksMap[e[0]*this.size[1]*this.size[2]+e[1]*this.size[2]+e[2]]={pos:e,state:a,nbt:r},this}getBlocks(){return this.blocks.map(e=>({pos:e.pos,state:this.palette[e.state],nbt:e.nbt}))}getBlock(e){if(!this.isInside(e))return null;const t=this.blocksMap[e[0]*this.size[1]*this.size[2]+e[1]*this.size[2]+e[2]];return t?{pos:t.pos,state:this.palette[t.state],nbt:t.nbt}:null}isInside(e){return e[0]>=0&&e[0]<this.size[0]&&e[1]>=0&&e[1]<this.size[1]&&e[2]>=0&&e[2]<this.size[2]}static fromNbt(e){const t=He(e.value,"size","int",3),i=He(e.value,"palette","compound").map(n=>P.fromNbt({name:"",value:n})),r=He(e.value,"blocks","compound").map(n=>({pos:He(n,"pos","int",3),state:Be(n,"state","int"),nbt:$t(()=>Be(n,"nbt","compound"),void 0)}));return new Kt(t,i,r)}}function de(s){return s*s}function ve(s,e,t){return Math.max(e,Math.min(t,s))}function we(s,e,t){return e+s*(t-e)}function vt(s,e,t,i,r,n){return we(e,we(s,t,i),we(s,r,n))}function Ns(s,e,t,i,r,n,a,o,u,f,c){return we(t,vt(s,e,i,r,n,a),vt(s,e,o,u,f,c))}function Je(s,e,t){return s===0?e():s===1?t():e()+s*(t()-e())}function Ot(s,e,t,i,r,n){return Je(e,()=>Je(s,t,i),()=>Je(s,r,n))}function Rs(s,e,t,i,r,n,a,o,u,f,c){return Je(t,()=>Ot(s,e,i,r,n,a),()=>Ot(s,e,o,u,f,c))}function Rt(s,e,t){return t<0?s:t>1?e:we(t,s,e)}function Qt(s,e,t){return(s-e)/(t-e)}function lt(s){return s*s*s*(s*(6*s-15)+10)}function Qe(s,e,t,i,r){return we(Qt(s,e,t),i,r)}function es(s,e,t,i,r){return Rt(i,r,Qt(s,e,t))}function Bs(s,e,t){let i=e-s;for(;i>0;){const r=Math.floor(i/2),n=s+r;t(n)?i=r:(s=n+1,i-=r+1)}return s}function ts(s,e,t){let i=BigInt(3129871*s)^BigInt(t)*BigInt(116129781)^BigInt(e);return i=i*i*BigInt(42317861)+i*BigInt(11),i>>BigInt(16)}function wt(s,e,t,i,r,n,a,o){return BigInt(s)<<BigInt(56)|BigInt(e)<<BigInt(48)|BigInt(t)<<BigInt(40)|BigInt(i)<<BigInt(32)|BigInt(r)<<BigInt(24)|BigInt(n)<<BigInt(16)|BigInt(a)<<BigInt(8)|BigInt(o)}var Te;(function(s){s.fromJson=function i(r,n){var a,o,u,f;if(typeof r=="number")return new e(r);const c=(a=v.readObject(r))!=null?a:{},h=new t(n(c.coordinate)),m=(o=v.readArray(c.points,d=>{var g;return(g=v.readObject(d))!=null?g:{}}))!=null?o:[];if(m.length===0)return new e(0);for(const d of m){const g=(u=v.readNumber(d.location))!=null?u:0,w=i(d.value,n),S=(f=v.readNumber(d.derivative))!=null?f:0;h.addPoint(g,w,S)}return h};class e{constructor(r){this.value=r}compute(){return this.value}min(){return this.value}max(){return this.value}mapAll(){return this}}s.Constant=e;class t{constructor(r,n=[],a=[],o=[]){this.coordinate=r,this.locations=n,this.values=a,this.derivatives=o}compute(r){const n=this.coordinate.compute(r),a=Bs(0,this.locations.length,I=>n<this.locations[I])-1,o=this.locations.length-1;if(a<0)return this.values[0].compute(r)+this.derivatives[0]*(n-this.locations[0]);if(a===o)return this.values[o].compute(r)+this.derivatives[o]*(n-this.locations[o]);const u=this.locations[a],f=this.locations[a+1],c=this.derivatives[a],h=this.derivatives[a+1],m=(n-u)/(f-u),d=this.values[a].compute(r),g=this.values[a+1].compute(r),w=c*(f-u)-(g-d),S=-h*(f-u)+(g-d);return we(m,d,g)+m*(1-m)*we(m,w,S)}min(){return Math.min(...this.values.map(r=>r.min()))}max(){return Math.max(...this.values.map(r=>r.max()))}mapAll(r){return new t(r(this.coordinate),this.locations,this.values.map(n=>n.mapAll(r)),this.derivatives)}addPoint(r,n,a=0){return this.locations.push(r),this.values.push(typeof n=="number"?new s.Constant(n):n),this.derivatives.push(a),this}}s.MultiPoint=t})(Te||(Te={}));const ae=class{constructor(s){this.seed=BigInt(0),this.setSeed(s)}fork(){return new ae(this.nextLong())}forkPositional(){return new Ts(this.nextLong())}setSeed(s){this.seed=s^ae.MULTIPLIER&ae.MODULUS_MASK}advance(){this.seed=this.seed*ae.MULTIPLIER+ae.INCREMENT&ae.MODULUS_MASK}consume(s){for(let e=0;e<s;e+=1)this.advance()}next(s){this.advance();const e=Number(this.seed>>BigInt(ae.MODULUS_BITS-s));return e>2147483647?e-4294967296:e}nextInt(s){if(s===void 0)return this.next(32);if((s&s-1)==0)return Number(BigInt(s)*BigInt(this.next(31))>>BigInt(31));let e,t;for(;(e=this.next(31))-(t=e%s)+(s-1)<0;);return t}nextLong(){return(BigInt(this.next(32))<<BigInt(32))+BigInt(this.next(32))}nextFloat(){return this.next(24)*ae.FLOAT_MULTIPLIER}nextDouble(){const s=this.next(30);return this.advance(),s*ae.DOUBLE_MULTIPLIER}};let he=ae;he.MODULUS_BITS=48,he.MODULUS_MASK=BigInt("281474976710655"),he.MULTIPLIER=BigInt("25214903917"),he.INCREMENT=BigInt("11"),he.FLOAT_MULTIPLIER=1/Math.pow(2,24),he.DOUBLE_MULTIPLIER=1/Math.pow(2,30);class Ts{constructor(e){this.seed=e}at(e,t,i){const r=ts(e,t,i);return new he(r^this.seed)}fromHashOf(e){const t=Zt(e,{asBytes:!0}),i=wt(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7]);return new he(i^this.seed)}seedKey(){return[this.seed,BigInt(0)]}}const N=class{constructor(s){this.seed=[BigInt(0),BigInt(0)],this.seed=s}static create(s){return new N(N.upgradeSeedTo128bit(s))}static mixStafford13(s){return((s=((s=(s^s>>N.BIGINT_30)*N.STAFFORD_1&N.MAX_ULONG)^s>>N.BIGINT_27)*N.STAFFORD_2&N.MAX_ULONG)^s>>N.BIGINT_31)&N.MAX_ULONG}static upgradeSeedTo128bit(s){s<0&&(s+=N.POW2_60);const e=s^N.SILVER_RATIO_64,t=e+N.GOLDEN_RATIO_64&N.MAX_ULONG;return[N.mixStafford13(e),N.mixStafford13(t)]}static rotateLeft(s,e){return s<<e&N.MAX_ULONG|s>>N.BIGINT_64-e}setSeed(s){this.seed=N.upgradeSeedTo128bit(s)}fork(){return new N([this.next(),this.next()])}forkPositional(){return new Cs(this.next(),this.next())}next(){const s=this.seed[0];let e=this.seed[1];const t=N.rotateLeft(s+e&N.MAX_ULONG,N.BIGINT_17)+s&N.MAX_ULONG;return e^=s,this.seed=[N.rotateLeft(s,N.BIGINT_49)^e^e<<N.BIGINT_21&N.MAX_ULONG,N.rotateLeft(e,N.BIGINT_28)],t}nextLong(){let s=this.next();return s>N.POW2_63&&(s-=N.POW2_60),s}consume(s){let e=this.seed[0],t=this.seed[1];for(let i=0;i<s;i+=1)t^=e,e=N.rotateLeft(e,N.BIGINT_49)^t^t<<N.BIGINT_21,t=N.rotateLeft(t,N.BIGINT_28);this.seed=[e,t]}nextBits(s){return this.next()>>BigInt(64-s)}nextInt(s){let e=this.next()&N.MAX_UINT;if(s){const t=BigInt(s);let i=e*t,r=i&N.MAX_UINT;if(r<t){const a=((~t&N.MAX_UINT)+N.BIGINT_1)%t;for(;r<a;)e=this.next()&N.MAX_UINT,i=e*t,r=i&N.MAX_UINT}const n=i>>N.BIGINT_32;return Number(n)}{let t=Number(e);return t>=2147483648&&(t-=4294967296),t}}nextFloat(){return Number(this.nextBits(24))*N.FLOAT_MULTIPLIER}nextDouble(){return Number(this.nextBits(53))*N.DOUBLE_MULTIPLIER}parityConfigString(){return"seedLo: "+this.seed[0]+", seedHi: "+this.seed[1]}};let L=N;L.SILVER_RATIO_64=BigInt("7640891576956012809"),L.GOLDEN_RATIO_64=BigInt("-7046029254386353131"),L.FLOAT_MULTIPLIER=1/Math.pow(2,24),L.DOUBLE_MULTIPLIER=11102230246251565e-32,L.BIGINT_1=BigInt(1),L.BIGINT_17=BigInt(17),L.BIGINT_21=BigInt(21),L.BIGINT_27=BigInt(27),L.BIGINT_28=BigInt(28),L.BIGINT_30=BigInt(30),L.BIGINT_31=BigInt(31),L.BIGINT_32=BigInt(32),L.BIGINT_49=BigInt(49),L.BIGINT_64=BigInt(64),L.STAFFORD_1=BigInt("-4658895280553007687"),L.STAFFORD_2=BigInt("-7723592293110705685"),L.MAX_ULONG=BigInt("0xFFFFFFFFFFFFFFFF"),L.POW2_60=BigInt("0x10000000000000000"),L.POW2_63=BigInt("0x8000000000000000"),L.MAX_UINT=BigInt(4294967295);class Cs{constructor(e,t){this.seedLo=e,this.seedHi=t}at(e,t,i){const r=ts(e,t,i)^this.seedLo;return new L([r,this.seedHi])}fromHashOf(e){const t=Zt(e,{asBytes:!0}),i=wt(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7]),r=wt(t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15]);return new L([i^this.seedLo,r^this.seedHi])}seedKey(){return[this.seedLo,this.seedHi]}}const ue=class{constructor(s){this.xo=256*s.nextDouble(),this.yo=256*s.nextDouble(),this.zo=256*s.nextDouble(),this.p=Array(256);for(let e=0;e<256;e+=1)this.p[e]=e;for(let e=0;e<256;e+=1){const t=s.nextInt(256-e),i=this.p[e];this.p[e]=this.p[e+t],this.p[e+t]=i}}sample2D(s,e){let t,i,r;const n=(s+e)*ue.F2,a=Math.floor(s+n),o=s-(a-(t=(a+(i=Math.floor(e+n)))*ue.G2));let u,f;o>(r=e-(i-t))?(u=1,f=0):(u=0,f=1);const c=o-u+ue.G2,h=r-f+ue.G2,m=o-1+2*ue.G2,d=r-1+2*ue.G2,g=255&a,w=255&i,S=this.P(g+this.P(w))%12,I=this.P(g+u+this.P(w+f))%12,B=this.P(g+1+this.P(w+1))%12;return 70*(this.getCornerNoise3D(S,o,r,0,.5)+this.getCornerNoise3D(I,c,h,0,.5)+this.getCornerNoise3D(B,m,d,0,.5))}sample(s,e,t){const i=.3333333333333333*(s+e+t),r=Math.floor(s+i),n=Math.floor(e+i),a=Math.floor(t+i),o=.16666666666666666*(r+n+a),u=s-(r-o),f=e-(n-o),c=t-(a-o);let h,m,d,g,w,S;u>=f?f>=c?(h=1,m=0,d=0,g=1,w=1,S=0):u>=c?(h=1,m=0,d=0,g=1,w=0,S=1):(h=0,m=0,d=1,g=1,w=0,S=1):f<c?(h=0,m=0,d=1,g=0,w=1,S=1):u<c?(h=0,m=1,d=0,g=0,w=1,S=1):(h=0,m=1,d=0,g=1,w=1,S=0);const I=u-h+.16666666666666666,B=f-m+.16666666666666666,R=c-d+.16666666666666666,_=u-g+.3333333333333333,x=f-w+.3333333333333333,T=c-S+.3333333333333333,M=u-.5,k=f-.5,K=c-.5,Y=255&r,H=255&n,Q=255&a,ee=this.P(Y+this.P(H+this.P(Q)))%12,j=this.P(Y+h+this.P(H+m+this.P(Q+d)))%12,ne=this.P(Y+g+this.P(H+w+this.P(Q+S)))%12,V=this.P(Y+1+this.P(H+1+this.P(Q+1)))%12;return 32*(this.getCornerNoise3D(ee,u,f,c,.6)+this.getCornerNoise3D(j,I,B,R,.6)+this.getCornerNoise3D(ne,_,x,T,.6)+this.getCornerNoise3D(V,M,k,K,.6))}P(s){return this.p[255&s]}getCornerNoise3D(s,e,t,i,r){let n,a=r-e*e-t*t-i*i;return a<0?n=0:(a*=a,n=a*a*ue.gradDot(s,e,t,i)),n}static gradDot(s,e,t,i){const r=ue.GRADIENT[15&s];return r[0]*e+r[1]*t+r[2]*i}};let te=ue;te.GRADIENT=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1],[1,1,0],[0,-1,1],[-1,1,0],[0,-1,-1]],te.F2=.5*(Math.sqrt(3)-1),te.G2=(3-Math.sqrt(3))/6;class Pt{constructor(e){this.xo=256*e.nextDouble(),this.yo=256*e.nextDouble(),this.zo=256*e.nextDouble(),this.p=Array(256);for(let t=0;t<256;t+=1)this.p[t]=t>127?t-256:t;for(let t=0;t<256;t+=1){const i=e.nextInt(256-t),r=this.p[t];this.p[t]=this.p[t+i],this.p[t+i]=r}}sample(e,t,i,r=0,n=0){const a=e+this.xo,o=t+this.yo,u=i+this.zo,f=Math.floor(a),c=Math.floor(o),h=Math.floor(u),m=a-f,d=o-c,g=u-h;let w=0;if(r!==0){const S=n>=0&&n<d?n:d;w=Math.floor(S/r+1e-7)*r}return this.sampleAndLerp(f,c,h,m,d-w,g,d)}sampleAndLerp(e,t,i,r,n,a,o){const u=this.P(e),f=this.P(e+1),c=this.P(u+t),h=this.P(u+t+1),m=this.P(f+t),d=this.P(f+t+1),g=te.gradDot(this.P(c+i),r,n,a),w=te.gradDot(this.P(m+i),r-1,n,a),S=te.gradDot(this.P(h+i),r,n-1,a),I=te.gradDot(this.P(d+i),r-1,n-1,a),B=te.gradDot(this.P(c+i+1),r,n,a-1),R=te.gradDot(this.P(m+i+1),r-1,n,a-1),_=te.gradDot(this.P(h+i+1),r,n-1,a-1),x=te.gradDot(this.P(d+i+1),r-1,n-1,a-1);return Ns(lt(r),lt(o),lt(a),g,w,S,I,B,R,_,x)}P(e){return 255&this.p[255&e]}}class X{constructor(e,t,i){if(e instanceof L){const r=e.forkPositional();this.noiseLevels=Array(i.length);for(let n=0;n<i.length;n++)if(i[n]!==0){const a=t+n;this.noiseLevels[n]=new Pt(r.fromHashOf("octave_"+a))}}else{if(1-t<i.length)throw new Error("Positive octaves are not allowed when using LegacyRandom");this.noiseLevels=Array(i.length);for(let r=-t;r>=0;r-=1)r<i.length&&i[r]!==0?this.noiseLevels[r]=new Pt(e):e.consume(262)}this.amplitudes=i,this.lowestFreqInputFactor=Math.pow(2,t),this.lowestFreqValueFactor=Math.pow(2,i.length-1)/(Math.pow(2,i.length)-1),this.maxValue=this.edgeValue(2)}sample(e,t,i,r=0,n=0,a=!1){let o=0,u=this.lowestFreqInputFactor,f=this.lowestFreqValueFactor;for(let c=0;c<this.noiseLevels.length;c+=1){const h=this.noiseLevels[c];h&&(o+=this.amplitudes[c]*f*h.sample(X.wrap(e*u),a?-h.yo:X.wrap(t*u),X.wrap(i*u),r*u,n*u)),u*=2,f/=2}return o}getOctaveNoise(e){return this.noiseLevels[this.noiseLevels.length-1-e]}edgeValue(e){let t=0,i=this.lowestFreqValueFactor;for(let r=0;r<this.noiseLevels.length;r+=1)this.noiseLevels[r]&&(t+=this.amplitudes[r]*e*i),i/=2;return t}static wrap(e){return e-33554432*Math.floor(e/33554432+.5)}}class ss{constructor(e,t,i,r){this.cellWidth=i,this.cellHeight=r,this.minLimitNoise=new X(e,-15,[1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0]),this.maxLimitNoise=new X(e,-15,[1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0]),this.mainNoise=new X(e,-7,[1,1,1,1,1,0,0,0]),this.xzScale=684.412*t.xzScale,this.yScale=684.412*t.yScale,this.xzMainScale=this.xzScale/t.xzFactor,this.yMainScale=this.yScale/t.yFactor,this.maxValue=this.minLimitNoise.edgeValue(this.yScale+2)}sample(e,t,i){let r;e=Math.floor(e/this.cellWidth),t=Math.floor(t/this.cellHeight),i=Math.floor(i/this.cellWidth);let n=0,a=1;for(let f=0;f<8;f+=1){if(r=this.mainNoise.getOctaveNoise(f),r){const c=this.xzMainScale*a,h=this.yMainScale*a,m=X.wrap(e*c),d=X.wrap(t*h),g=X.wrap(i*c);n+=r.sample(m,d,g,h,t*h)/a}a/=2}n=(n/10+1)/2,a=1;let o=0,u=0;for(let f=0;f<16;f+=1){const c=this.xzScale*a,h=this.yScale*a,m=X.wrap(e*c),d=X.wrap(t*h),g=X.wrap(i*c);n<1&&(r=this.minLimitNoise.getOctaveNoise(f))&&(o+=r.sample(m,d,g,h,t*h)/a),n>0&&(r=this.maxLimitNoise.getOctaveNoise(f))&&(u+=r.sample(m,d,g,h,t*h)/a),a/=2}return Rt(o/512,u/512,n)/128}}var bt;(bt||(bt={})).fromJson=function(s){var e,t,i,r,n;const a=(e=v.readObject(s))!=null?e:{};return{xzScale:(t=v.readNumber(a.xz_scale))!=null?t:1,yScale:(i=v.readNumber(a.y_scale))!=null?i:1,xzFactor:(r=v.readNumber(a.xz_factor))!=null?r:80,yFactor:(n=v.readNumber(a.y_factor))!=null?n:80}};const $e=class{constructor(s,{firstOctave:e,amplitudes:t}){this.first=new X(s,e,t),this.second=new X(s,e,t);let i=1/0,r=-1/0;for(let a=0;a<t.length;a+=1)t[a]!==0&&(i=Math.min(i,a),r=Math.max(r,a));const n=.1*(1+1/(r-i+1));this.valueFactor=1/6/n,this.maxValue=(this.first.maxValue+this.second.maxValue)*this.valueFactor}sample(s,e,t){const i=s*$e.INPUT_FACTOR,r=e*$e.INPUT_FACTOR,n=t*$e.INPUT_FACTOR;return(this.first.sample(s,e,t)+this.second.sample(i,r,n))*this.valueFactor}};let is=$e;var et,Lt;is.INPUT_FACTOR=1.0181268882175227,(Lt=et||(et={})).create=function(s,e){return{firstOctave:s,amplitudes:e}},Lt.fromJson=function(s){var e,t,i;const r=(e=v.readObject(s))!=null?e:{};return{firstOctave:(t=v.readInt(r.firstOctave))!=null?t:0,amplitudes:(i=v.readArray(r.amplitudes,n=>{var a;return(a=v.readNumber(n))!=null?a:0}))!=null?i:[]}};class si{constructor(e,t){const i=t[t.length-1],r=-t[0]+i+1,n=new Set(t),a=new te(e);this.noiseLevels=Array(r),i>=0&&i<r&&n.has(0)&&(this.noiseLevels[i]=a);for(let o=i+1;o<r;o+=1)o>=0&&n.has(i-o)?this.noiseLevels[o]=new te(e):e.consume(262);if(i>0)throw new Error("Positive octaves are not allowed");this.highestFreqInputFactor=Math.pow(2,i),this.highestFreqValueFactor=1/(Math.pow(2,r)-1)}sample(e,t,i){let r=0,n=this.highestFreqInputFactor,a=this.highestFreqValueFactor;for(let o=0;o<this.noiseLevels.length;o+=1){const u=this.noiseLevels[o];u&&(r+=a*u.sample2D(e*n+(i?u.xo:0),t*n+(i?u.yo:0))),n/=2,a*=2}return r}}const Oe=s=>[(s>>16&255)/256,(s>>8&255)/256,(255&s)/256],xe=[124/256,189/256,107/256],Ms=Oe(6396257),ks=Oe(8431445),De=Oe(4764952),ut=Oe(4159204),Ft=Oe(8431445),Os=Oe(2129968),Dt=s=>[s/8,1-s/32,64*s],Ps={large_fern:()=>xe,tall_grass:()=>xe,grass_block:()=>xe,fern:()=>xe,grass:()=>xe,potted_fern:()=>xe,spruce_leaves:()=>Ms,birch_leaves:()=>ks,oak_leaves:()=>De,jungle_leaves:()=>De,acacia_leaves:()=>De,dark_oak_leaves:()=>De,vine:()=>De,water:()=>ut,bubble_column:()=>ut,cauldron:()=>ut,redstone_wire:s=>{var e;return(t=>{const i=t/15;return[.6*i+(i>0?.4:.3),ve(i*i*.7-.5,0,1),ve(i*i*.6-.7,0,1)]})(parseInt((e=s.power)!=null?e:"0"))},sugar_cane:()=>xe,attached_melon_stem:()=>Ft,attached_pumpkin_stem:()=>Ft,melon_stem:s=>{var e;return Dt(parseInt((e=s.age)!=null?e:"0"))},pumpkin_stem:s=>{var e;return Dt(parseInt((e=s.age)!=null?e:"0"))},lily_pad:()=>Os};var St;function tt(...s){let e=0;for(const r of s)e+=r.length;const t=new Float32Array(e);let i=0;for(const r of s)t.set(r,i),i+=r.length;return t}function st(s,e){const t=ps();for(let i=0;i<s.length;i+=3)t[0]=s[i],t[1]=s[i+1],t[2]=s[i+2],gs(t,t,e),s[i]=t[0],s[i+1]=t[1],s[i+2]=t[2]}(St||(St={})).rotate=function(s,e,t){let{up:i,down:r,north:n,east:a,south:o,west:u}=s;switch(t){case 90:[n,a,o,u]=[a,o,u,n];break;case 180:[n,a,o,u]=[o,u,n,a];break;case 270:[n,a,o,u]=[u,n,a,o]}switch(e){case 90:[i,n,r,o]=[n,r,o,i];break;case 180:[i,n,r,o]=[r,o,i,n];break;case 270:[i,n,r,o]=[o,i,n,r]}return{up:i,down:r,north:n,east:a,south:o,west:u}};class Bt{constructor(e,t,i){this.id=e,this.variants=t,this.multipart=i,this.variants=t}getModelVariants(e){if(this.variants){const t=Object.keys(this.variants).filter(r=>this.matchesVariant(r,e));if(t.length===0)return[];const i=this.variants[t[0]];return[Array.isArray(i)?i[0]:i]}return this.multipart?this.multipart.filter(t=>!t.when||this.matchesCase(t.when,e)).map(t=>Array.isArray(t.apply)?t.apply[0]:t.apply):[]}getBuffers(e,t,i,r,n,a){var o,u,f,c;const h=this.getModelVariants(t),m=[],d=[],g=[],w=[];for(const B of h){const R=St.rotate(a,(o=B.x)!=null?o:0,(u=B.y)!=null?u:0),_=r.getBlockModel(B.model).getBuffers(e,t,i,n,R);if(B.x||B.y){const x=Re();ft(x),Ce(x,x,[8,8,8]),ls(x,x,-mt((f=B.y)!=null?f:0)),us(x,x,-mt((c=B.x)!=null?c:0)),Ce(x,x,[-8,-8,-8]),st(_.position,x)}m.push(_.position),d.push(..._.texCoord),g.push(..._.tintColor),w.push(..._.index),n+=_.texCoord.length/2}const S=Re();ft(S),qt(S,S,[.0625,.0625,.0625]);const I=tt(...m);return st(I,S),{position:I,texCoord:d,tintColor:g,index:w}}matchesVariant(e,t){return e.split(",").every(i=>{const[r,n]=i.split("=");return t[r]===n})}matchesCase(e,t){if(Array.isArray(e.OR))return e.OR.some(r=>this.matchesCase(r,t));const i=e;return Object.keys(i).every(r=>i[r].split("|").includes(t[r]))}static fromJson(e,t){return new Bt(e,t.variants,t.multipart)}}const Ls={0:[0,3,2,3,2,1,0,1],90:[2,3,2,1,0,1,0,3],180:[2,1,0,1,0,3,2,3],270:[0,1,0,3,2,3,2,1]},Fs={x:[1,0,0],y:[0,1,0],z:[0,0,1]},Ie=1.41421356237,Ds={x:[1,Ie,Ie],y:[Ie,1,Ie],z:[Ie,Ie,1]};class at{constructor(e,t,i,r){this.id=e,this.parent=t,this.textures=i,this.elements=r,this.flattened=!1}getBuffers(e,t,i,r,n){var a;const o=[],u=[],f=[],c=[];for(const h of(a=this.elements)!=null?a:[]){const m=this.getElementBuffers(e,t,h,r,i,n);o.push(m.position),u.push(...m.texCoord),f.push(...m.tintColor),c.push(...m.index),r+=m.texCoord.length/2}return{position:tt(...o),texCoord:u,tintColor:f,index:c}}getElementBuffers(e,t,i,r,n,a){var o,u,f,c,h,m,d,g,w,S,I,B;const R=i.from[0],_=i.from[1],x=i.from[2],T=i.to[0],M=i.to[1],k=i.to[2],K=[],Y=[],H=[],Q=[],ee=(V,z,Ae)=>{var Pe,b,l,p,A,y,O,U,se,be,Z,q,W;const[ce,fe,Ye,Xe]=n.getTextureUV(this.getTexture(V.texture)),ye=(Ye-ce)/16,_e=(Xe-fe)/16,Le=ye/16,Fe=_e/16;z[0]=((b=(Pe=V.uv)==null?void 0:Pe[0])!=null?b:z[0])*ye+Le,z[1]=((p=(l=V.uv)==null?void 0:l[1])!=null?p:z[1])*_e+Fe,z[2]=((y=(A=V.uv)==null?void 0:A[2])!=null?y:z[2])*ye-Le,z[3]=((U=(O=V.uv)==null?void 0:O[3])!=null?U:z[3])*_e-Fe;const ie=Ls[(se=V.rotation)!=null?se:0];Y.push(ce+z[ie[0]],fe+z[ie[1]],ce+z[ie[2]],fe+z[ie[3]],ce+z[ie[4]],fe+z[ie[5]],ce+z[ie[6]],fe+z[ie[7]]);const Se=((be=V.tintindex)!=null?be:-1)>=0&&(W=(q=(Z=Ps)[e.path])==null?void 0:q.call(Z,t))!=null?W:[1,1,1];H.push(...Se,...Se,...Se,...Se),K.push(...Ae),Q.push(r,r+1,r+2,r,r+2,r+3),r+=4};!((u=(o=i.faces)==null?void 0:o.up)!=null&&u.texture)||i.faces.up.cullface&&a[i.faces.up.cullface]||ee(i.faces.up,[R,16-k,T,16-x],[R,M,k,T,M,k,T,M,x,R,M,x]),!((c=(f=i.faces)==null?void 0:f.down)!=null&&c.texture)||i.faces.down.cullface&&a[i.faces.down.cullface]||ee(i.faces.down,[16-k,16-T,16-x,16-R],[R,_,x,T,_,x,T,_,k,R,_,k]),!((m=(h=i.faces)==null?void 0:h.south)!=null&&m.texture)||i.faces.south.cullface&&a[i.faces.south.cullface]||ee(i.faces.south,[R,16-M,T,16-_],[R,_,k,T,_,k,T,M,k,R,M,k]),!((g=(d=i.faces)==null?void 0:d.north)!=null&&g.texture)||i.faces.north.cullface&&a[i.faces.north.cullface]||ee(i.faces.north,[16-T,16-M,16-R,16-_],[T,_,x,R,_,x,R,M,x,T,M,x]),!((S=(w=i.faces)==null?void 0:w.east)!=null&&S.texture)||i.faces.east.cullface&&a[i.faces.east.cullface]||ee(i.faces.east,[16-k,16-M,16-x,16-_],[T,_,k,T,_,x,T,M,x,T,M,k]),!((B=(I=i.faces)==null?void 0:I.west)!=null&&B.texture)||i.faces.west.cullface&&a[i.faces.west.cullface]||ee(i.faces.west,[x,16-M,k,16-_],[R,_,x,R,_,k,R,M,k,R,M,x]);const j=Re();if(ft(j),i.rotation){const V=Ze(...i.rotation.origin);Ce(j,j,V),hs(j,j,mt(i.rotation.angle),Fs[i.rotation.axis]),i.rotation.rescale&&qt(j,j,Ds[i.rotation.axis]),cs(V,V),Ce(j,j,V)}const ne=new Float32Array(K);return st(ne,j),{position:ne,texCoord:Y,tintColor:H,index:Q}}getTexture(e){for(var t,i;e.startsWith("#");)e=(i=(t=this.textures)==null?void 0:t[e.slice(1)])!=null?i:"";return e.startsWith("minecraft:")||(e="minecraft:"+e),e}flatten(e){var t;if(!this.flattened&&this.parent){const i=e.getBlockModel(this.parent);if(!i)return console.warn(`parent ${this.parent} does not exist!`),void(this.flattened=!0);i.flatten(e),this.elements||(this.elements=i.elements),this.textures||(this.textures={}),Object.keys((t=i.textures)!=null?t:{}).forEach(r=>{this.textures[r]||(this.textures[r]=i.textures[r])}),this.flattened=!0}}static fromJson(e,t){let i=t.parent;return i&&!i.startsWith("minecraft:")&&(i="minecraft:"+i),new at(e,i,t.textures,t.elements)}}class ht{constructor(e,t,i){this.gl=e,this.program=this.initShaderProgram(t,i)}getProgram(){return this.program}initShaderProgram(e,t){const i=this.loadShader(this.gl.VERTEX_SHADER,e),r=this.loadShader(this.gl.FRAGMENT_SHADER,t),n=this.gl.createProgram();if(this.gl.attachShader(n,i),this.gl.attachShader(n,r),this.gl.linkProgram(n),!this.gl.getProgramParameter(n,this.gl.LINK_STATUS))throw new Error(`Unable to link shader program: ${this.gl.getProgramInfoLog(n)}`);return n}loadShader(e,t){const i=this.gl.createShader(e);if(this.gl.shaderSource(i,t),this.gl.compileShader(i),!this.gl.getShaderParameter(i,this.gl.COMPILE_STATUS)){const r=new Error(`Compiling ${e===this.gl.VERTEX_SHADER?"vertex":"fragment"} shader: ${this.gl.getShaderInfoLog(i)}`);throw this.gl.deleteShader(i),r}return i}}function rs(s,e,t,i,r){const n=new Bt("",{"":{model:""}},void 0),a={getBlockModel:()=>r};return r.flatten(a),n.getBuffers(s,{},e,a,t,i)}function Vt(s,e,t,i,r,n){const a=r.up?16:[14.2,12.5,10.5,9,7,5.3,3.7,1.9,16,16,16,16,16,16,16,16][t];return rs(D.create(s),i,e,r,new at("","",{still:`minecraft:block/${s}_still`,flow:`minecraft:block/${s}_flow`},[{from:[0,0,0],to:[16,a,16],faces:{up:{texture:"#still",tintindex:n,cullface:F.UP},down:{texture:"#still",tintindex:n,cullface:F.DOWN},north:{texture:"#flow",tintindex:n,cullface:F.NORTH},east:{texture:"#flow",tintindex:n,cullface:F.EAST},south:{texture:"#flow",tintindex:n,cullface:F.SOUTH},west:{texture:"#flow",tintindex:n,cullface:F.WEST}}}]))}const ns={"minecraft:water":(s,e,t,i)=>Vt("water",s,parseInt(e.level),t,i,0),"minecraft:lava":(s,e,t,i)=>Vt("lava",s,parseInt(e.level),t,i),"minecraft:chest":(s,e,t)=>function(i,r,n,a){return rs(D.create("chest"),a,i,{},new at("","",{0:"minecraft:block/chest"},[{from:[1,0,1],to:[15,14,15],faces:{up:{texture:"#0"},down:{texture:"#0"},north:{texture:"#0"},east:{texture:"#0"},south:{texture:"#0"},west:{texture:"#0"}}}]))}(s,e.facing,e.type,t)},Vs=new Set(Object.keys(ns));class ii{constructor(e,t,i,r){var n,a;this.gl=e,this.structure=t,this.resources=i,this.chunks=[],r!=null&&r.facesPerBuffer&&console.warn("webgl render warning: facesPerBuffer option has been removed in favor of chunkSize"),this.chunkSize=(n=r==null?void 0:r.chunkSize)!=null?n:16,this.useInvisibleBlockBuffer=(a=r==null?void 0:r.useInvisibleBlockBuffer)==null||a,this.shaderProgram=new ht(e,`
|
|
attribute vec4 vertPos;
|
|
attribute vec2 texCoord;
|
|
attribute vec3 tintColor;
|
|
attribute vec3 normal;
|
|
|
|
uniform mat4 mView;
|
|
uniform mat4 mProj;
|
|
|
|
varying highp vec2 vTexCoord;
|
|
varying highp vec3 vTintColor;
|
|
varying highp float vLighting;
|
|
|
|
void main(void) {
|
|
gl_Position = mProj * mView * vertPos;
|
|
vTexCoord = texCoord;
|
|
vTintColor = tintColor;
|
|
vLighting = normal.y * 0.2 + abs(normal.z) * 0.1 + 0.8;
|
|
}
|
|
`,`
|
|
precision highp float;
|
|
varying highp vec2 vTexCoord;
|
|
varying highp vec3 vTintColor;
|
|
varying highp float vLighting;
|
|
|
|
uniform sampler2D sampler;
|
|
|
|
void main(void) {
|
|
vec4 texColor = texture2D(sampler, vTexCoord);
|
|
if(texColor.a < 0.01) discard;
|
|
gl_FragColor = vec4(texColor.xyz * vTintColor * vLighting, texColor.a);
|
|
}
|
|
`).getProgram(),this.gridShaderProgram=new ht(e,`
|
|
attribute vec4 vertPos;
|
|
attribute vec3 vertColor;
|
|
|
|
uniform mat4 mView;
|
|
uniform mat4 mProj;
|
|
|
|
varying highp vec3 vColor;
|
|
|
|
void main(void) {
|
|
gl_Position = mProj * mView * vertPos;
|
|
vColor = vertColor;
|
|
}
|
|
`,`
|
|
precision highp float;
|
|
varying highp vec3 vColor;
|
|
|
|
void main(void) {
|
|
gl_FragColor = vec4(vColor, 1.0);
|
|
}
|
|
`).getProgram(),this.colorShaderProgram=new ht(e,`
|
|
attribute vec4 vertPos;
|
|
attribute vec3 blockPos;
|
|
|
|
uniform mat4 mView;
|
|
uniform mat4 mProj;
|
|
|
|
varying highp vec3 vColor;
|
|
|
|
void main(void) {
|
|
gl_Position = mProj * mView * vertPos;
|
|
vColor = blockPos / 256.0;
|
|
}
|
|
`,`
|
|
precision highp float;
|
|
varying highp vec3 vColor;
|
|
|
|
void main(void) {
|
|
gl_FragColor = vec4(vColor, 1.0);
|
|
}
|
|
`).getProgram(),this.updateStructureBuffers(),this.gridBuffers=this.getGridBuffers(),this.outlineBuffers=this.getOutlineBuffers(),this.invisibleBlockBuffers=this.getInvisibleBlockBuffers(),this.atlasTexture=this.getBlockTexture(),this.projMatrix=this.getPerspective(),this.activeShader=this.shaderProgram,this.initialize()}setStructure(e){this.structure=e,this.updateStructureBuffers(),this.gridBuffers=this.getGridBuffers(),this.invisibleBlockBuffers=this.getInvisibleBlockBuffers()}initialize(){this.gl.enable(this.gl.DEPTH_TEST),this.gl.depthFunc(this.gl.LEQUAL),this.gl.enable(this.gl.BLEND),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.enable(this.gl.CULL_FACE),this.gl.cullFace(this.gl.BACK)}getBlockTexture(){const e=this.gl.createTexture();return this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,this.resources.getTextureAtlas()),this.gl.generateMipmap(this.gl.TEXTURE_2D),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.NEAREST),e}getPerspective(){const e=70*Math.PI/180,t=this.gl.canvas.clientWidth/this.gl.canvas.clientHeight,i=Re();return fs(i,e,t,.1,500),i}getChunk(e){const t=2*Math.abs(e[0])+(e[0]<0?1:0),i=2*Math.abs(e[1])+(e[1]<0?1:0),r=2*Math.abs(e[2])+(e[2]<0?1:0);return this.chunks[t]||(this.chunks[t]=[]),this.chunks[t][i]||(this.chunks[t][i]=[]),this.chunks[t][i][r]||(this.chunks[t][i][r]={positions:[],textureCoordinates:[],tintColors:[],blockPositions:[],normals:[],indices:[],indexOffset:0}),this.chunks[t][i][r]}updateStructureBuffers(e){var t;const i=(o,u,f)=>{const c=Re();Ce(c,c,u),st(o.position,c),f.positions.push(o.position),f.textureCoordinates.push(...o.texCoord),f.tintColors.push(...o.tintColor);for(let h=0;h<o.position.length;h+=12){const m=Ze(o.position[h],o.position[h+1],o.position[h+2]),d=Ze(o.position[h+3],o.position[h+4],o.position[h+5]),g=Ze(o.position[h+6],o.position[h+7],o.position[h+8]);Tt(d,d,m),Tt(g,g,m),vs(d,d,g),ws(d,d),f.normals.push(...d,...d,...d,...d)}for(let h=0;h<o.texCoord.length/2;h+=1)f.blockPositions.push(...u);f.indices.push(...o.index),f.indexOffset+=o.texCoord.length/2},r=o=>{o.positions=[],o.textureCoordinates=[],o.tintColors=[],o.blockPositions=[],o.normals=[],o.indices=[],o.indexOffset=0},n=o=>{o.buffer?(this.updateBuffer(o.buffer.position,this.gl.ARRAY_BUFFER,tt(...o.positions)),this.updateBuffer(o.buffer.texCoord,this.gl.ARRAY_BUFFER,new Float32Array(o.textureCoordinates)),this.updateBuffer(o.buffer.tintColor,this.gl.ARRAY_BUFFER,new Float32Array(o.tintColors)),this.updateBuffer(o.buffer.normal,this.gl.ARRAY_BUFFER,new Float32Array(o.normals)),this.updateBuffer(o.buffer.blockPos,this.gl.ARRAY_BUFFER,new Float32Array(o.blockPositions)),this.updateBuffer(o.buffer.index,this.gl.ELEMENT_ARRAY_BUFFER,new Uint16Array(o.indices)),o.buffer.length=o.indices.length):o.buffer={position:this.createBuffer(this.gl.ARRAY_BUFFER,tt(...o.positions)),texCoord:this.createBuffer(this.gl.ARRAY_BUFFER,new Float32Array(o.textureCoordinates)),tintColor:this.createBuffer(this.gl.ARRAY_BUFFER,new Float32Array(o.tintColors)),blockPos:this.createBuffer(this.gl.ARRAY_BUFFER,new Float32Array(o.blockPositions)),normal:this.createBuffer(this.gl.ARRAY_BUFFER,new Float32Array(o.normals)),index:this.createBuffer(this.gl.ELEMENT_ARRAY_BUFFER,new Uint16Array(o.indices)),length:o.indices.length}};let a;e?e.forEach(o=>{const u=this.getChunk(o);r(u)}):this.chunks.forEach(o=>o.forEach(u=>u.forEach(f=>{r(f)})));for(const o of this.structure.getBlocks()){const u=o.state.getName(),f=o.state.getProperties(),c=(t=this.resources.getDefaultBlockProperties(u))!=null?t:{};Object.entries(c).forEach(([d,g])=>{f[d]||(f[d]=g)});const h=[Math.floor(o.pos[0]/this.chunkSize),Math.floor(o.pos[1]/this.chunkSize),Math.floor(o.pos[2]/this.chunkSize)];if(e&&!e.some(d=>ms(d,h)))continue;const m=this.getChunk(h);try{const d=this.resources.getBlockDefinition(u),g={up:this.needsCull(o,F.UP),down:this.needsCull(o,F.DOWN),west:this.needsCull(o,F.WEST),east:this.needsCull(o,F.EAST),north:this.needsCull(o,F.NORTH),south:this.needsCull(o,F.SOUTH)};d&&(a=d.getBuffers(u,f,this.resources,this.resources,m.indexOffset,g),i(a,o.pos,m)),Vs.has(u.toString())&&(a=ns[u.toString()](m.indexOffset,f,this.resources,g),i(a,o.pos,m))}catch(d){console.error(`Error rendering block ${u}`,d)}}e?e.forEach(o=>{const u=this.getChunk(o);n(u)}):this.chunks.forEach(o=>o.forEach(u=>u.forEach(f=>{n(f)})))}needsCull(e,t){var i,r;const n=(i=this.structure.getBlock(J.towards(e.pos,t)))==null?void 0:i.state;return!!n&&((r=this.resources.getBlockFlags(n.getName()))!=null&&r.opaque?!(t===F.UP&&e.state.isFluid()):e.state.isFluid()&&n.isFluid())}getGridBuffers(){const[e,t,i]=this.structure.getSize(),r=[],n=[];r.push(0,0,0,e,0,0),n.push(1,0,0,1,0,0),r.push(0,0,0,0,0,i),n.push(0,0,1,0,0,1),r.push(0,0,0,0,t,0),r.push(e,0,0,e,t,0),r.push(0,0,i,0,t,i),r.push(e,0,i,e,t,i),r.push(0,t,0,0,t,i),r.push(e,t,0,e,t,i),r.push(0,t,0,e,t,0),r.push(0,t,i,e,t,i);for(let a=1;a<=e;a+=1)r.push(a,0,0,a,0,i);for(let a=1;a<=i;a+=1)r.push(0,0,a,e,0,a);for(let a=0;a<8+e+i;a+=1)n.push(.8,.8,.8,.8,.8,.8);return{position:this.createBuffer(this.gl.ARRAY_BUFFER,new Float32Array(r)),color:this.createBuffer(this.gl.ARRAY_BUFFER,new Float32Array(n)),length:r.length/3}}getOutlineBuffers(){const e=[],t=[];return this.addCube(e,t,[1,1,1],[0,0,0],[1,1,1]),{position:this.createBuffer(this.gl.ARRAY_BUFFER,new Float32Array(e)),color:this.createBuffer(this.gl.ARRAY_BUFFER,new Float32Array(t)),length:e.length/3}}getInvisibleBlockBuffers(){if(!this.useInvisibleBlockBuffer)return;const e=this.structure.getSize(),t=[],i=[];for(let r=0;r<e[0];r+=1)for(let n=0;n<e[1];n+=1)for(let a=0;a<e[2];a+=1){const o=this.structure.getBlock([r,n,a]);o!==void 0&&(o===null?this.addCube(t,i,[1,.25,.25],[r+.4375,n+.4375,a+.4375],[r+.5625,n+.5625,a+.5625]):o.state.is(P.AIR)?this.addCube(t,i,[.5,.5,1],[r+.375,n+.375,a+.375],[r+.625,n+.625,a+.625]):o.state.is(new P("cave_air"))&&this.addCube(t,i,[.5,1,.5],[r+.375,n+.375,a+.375],[r+.625,n+.625,a+.625]))}return{position:this.createBuffer(this.gl.ARRAY_BUFFER,new Float32Array(t)),color:this.createBuffer(this.gl.ARRAY_BUFFER,new Float32Array(i)),length:t.length/3}}addCube(e,t,i,r,n){e.push(r[0],r[1],r[2],r[0],r[1],n[2]),e.push(n[0],r[1],r[2],n[0],r[1],n[2]),e.push(r[0],r[1],r[2],n[0],r[1],r[2]),e.push(r[0],r[1],n[2],n[0],r[1],n[2]),e.push(r[0],r[1],r[2],r[0],n[1],r[2]),e.push(n[0],r[1],r[2],n[0],n[1],r[2]),e.push(r[0],r[1],n[2],r[0],n[1],n[2]),e.push(n[0],r[1],n[2],n[0],n[1],n[2]),e.push(r[0],n[1],r[2],r[0],n[1],n[2]),e.push(n[0],n[1],r[2],n[0],n[1],n[2]),e.push(r[0],n[1],r[2],n[0],n[1],r[2]),e.push(r[0],n[1],n[2],n[0],n[1],n[2]);for(let a=0;a<24;a+=1)t.push(...i)}createBuffer(e,t){const i=this.gl.createBuffer();return this.gl.bindBuffer(e,i),this.gl.bufferData(e,t,this.gl.DYNAMIC_DRAW),i}updateBuffer(e,t,i){this.gl.bindBuffer(t,e),this.gl.bufferData(t,i,this.gl.STATIC_DRAW)}drawGrid(e){this.setShader(this.gridShaderProgram),this.setVertexAttr("vertPos",3,this.gridBuffers.position),this.setVertexAttr("vertColor",3,this.gridBuffers.color),this.setUniform("mView",e),this.setUniform("mProj",this.projMatrix),this.gl.drawArrays(this.gl.LINES,0,this.gridBuffers.length)}drawInvisibleBlocks(e){this.useInvisibleBlockBuffer&&(this.setShader(this.gridShaderProgram),this.setVertexAttr("vertPos",3,this.invisibleBlockBuffers.position),this.setVertexAttr("vertColor",3,this.invisibleBlockBuffers.color),this.setUniform("mView",e),this.setUniform("mProj",this.projMatrix),this.gl.drawArrays(this.gl.LINES,0,this.invisibleBlockBuffers.length))}drawStructure(e){this.setShader(this.shaderProgram),this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,this.atlasTexture),this.setUniform("mView",e),this.setUniform("mProj",this.projMatrix),this.chunks.forEach(t=>{t.forEach(i=>{i.forEach(r=>{r.buffer&&(this.setVertexAttr("vertPos",3,r.buffer.position),this.setVertexAttr("texCoord",2,r.buffer.texCoord),this.setVertexAttr("tintColor",3,r.buffer.tintColor),this.setVertexAttr("normal",3,r.buffer.normal),this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,r.buffer.index),this.gl.drawElements(this.gl.TRIANGLES,r.buffer.length,this.gl.UNSIGNED_SHORT,0))})})})}drawColoredStructure(e){this.setShader(this.colorShaderProgram),this.setUniform("mView",e),this.setUniform("mProj",this.projMatrix),this.chunks.forEach(t=>{t.forEach(i=>{i.forEach(r=>{r.buffer&&(this.setVertexAttr("vertPos",3,r.buffer.position),this.setVertexAttr("blockPos",3,r.buffer.blockPos),this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,r.buffer.index),this.gl.drawElements(this.gl.TRIANGLES,r.buffer.length,this.gl.UNSIGNED_SHORT,0))})})})}drawOutline(e,t){this.setShader(this.gridShaderProgram),this.setVertexAttr("vertPos",3,this.outlineBuffers.position),this.setVertexAttr("vertColor",3,this.outlineBuffers.color);const i=Re();ds(i,e),Ce(i,i,t),this.setUniform("mView",i),this.setUniform("mProj",this.projMatrix),this.gl.drawArrays(this.gl.LINES,0,this.outlineBuffers.length)}setViewport(e,t,i,r){this.gl.viewport(e,t,i,r),this.projMatrix=this.getPerspective()}setShader(e){this.gl.useProgram(e),this.activeShader=e}setVertexAttr(e,t,i){const r=this.gl.getAttribLocation(this.activeShader,e);this.gl.bindBuffer(this.gl.ARRAY_BUFFER,i),this.gl.vertexAttribPointer(r,t,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(r)}setUniform(e,t){const i=this.gl.getUniformLocation(this.activeShader,e);this.gl.uniformMatrix4fv(i,!1,t)}}var Ut=(s,e,t)=>new Promise((i,r)=>{var n=u=>{try{o(t.next(u))}catch(f){r(f)}},a=u=>{try{o(t.throw(u))}catch(f){r(f)}},o=u=>u.done?i(u.value):Promise.resolve(u.value).then(n,a);o((t=t.apply(s,e)).next())});class Ke{constructor(e,t){this.img=e,this.idMap=t,this.part=16/e.width}getTextureAtlas(){return this.img}getTextureUV(e){var t;return(t=this.idMap[e])!=null?t:[0,0,this.part,this.part]}static fromBlobs(e){return Ut(this,null,function*(){const t=Math.sqrt(Object.keys(e).length+1),i=Math.pow(2,Math.ceil(Math.log(t)/Math.log(2))),r=16*i,n=1/i,a=document.createElement("canvas");a.width=r,a.height=r;const o=a.getContext("2d");this.drawInvalidTexture(o);const u={};let f=1;return yield Promise.all(Object.keys(e).map(c=>Ut(this,null,function*(){const h=f%i,m=Math.floor(f/i);f+=1,u[c]=[n*h,n*m,n*h+n,n*m+n];const d=yield createImageBitmap(e[c]);o.drawImage(d,0,0,16,16,16*h,16*m,16,16)}))),new Ke(o.getImageData(0,0,r,r),u)})}static empty(){const e=document.createElement("canvas");e.width=16,e.height=16;const t=e.getContext("2d");return Ke.drawInvalidTexture(t),new Ke(t.getImageData(0,0,16,16),{})}static drawInvalidTexture(e){e.fillStyle="black",e.fillRect(0,0,16,16),e.fillStyle="magenta",e.fillRect(0,0,8,8),e.fillRect(8,8,8,8)}}const ge=class{constructor(s,e,t){this.offsetSampler=s,this.factorSampler=e,this.jaggednessSampler=t}static extractor(s){return{compute:e=>e[s]}}static fromJson(s){var e;const t=(e=v.readObject(s))!=null?e:{};return new ge(Te.fromJson(t.offset,this.EXTRACTOR),Te.fromJson(t.factor,this.EXTRACTOR),Te.fromJson(t.jaggedness,this.EXTRACTOR))}offset(s){return this.offsetSampler.compute(s)+ge.GLOBAL_OFFSET}factor(s){return this.factorSampler.compute(s)}jaggedness(s){return this.jaggednessSampler.compute(s)}static point(s,e,t){return{continents:s,erosion:e,weirdness:t,ridges:this.peaksAndValleys(t)}}static peaksAndValleys(s){return 3*-(Math.abs(Math.abs(s)-.6666667)-.33333334)}};let pe=ge;var G,Ne,Gt,ke,xt;pe.GLOBAL_OFFSET=-.50375,pe.EXTRACTOR=s=>{var e;const t=(e=v.readString(s))!=null?e:"continents";return ge.extractor(t)},pe.CONTINENTS=ge.extractor("continents"),pe.EROSION=ge.extractor("erosion"),pe.WEIRDNESS=ge.extractor("weirdness"),pe.RIDGES=ge.extractor("ridges"),function(s){function e(t){return t.ySize<<2}s.fromJson=function(t){var i,r,n,a,o;const u=(i=v.readObject(t))!=null?i:{};return{minY:(r=v.readInt(u.min_y))!=null?r:0,height:(n=v.readInt(u.height))!=null?n:256,xzSize:(a=v.readInt(u.size_horizontal))!=null?a:1,ySize:(o=v.readInt(u.size_vertical))!=null?o:1,sampling:bt.fromJson(u.sampling),topSlide:Ne.fromJson(u.top_slide),bottomSlide:Ne.fromJson(u.bottom_slide),terrainShaper:pe.fromJson(u.terrain_shaper)}},s.cellHeight=e,s.cellWidth=function(t){return t.xzSize<<2},s.cellCountY=function(t){return t.height/e(t)},s.minCellY=function(t){return Math.floor(t.minY/e(t))},s.applySlides=function(t,i,r){const n=Math.floor(r/e(t))-s.minCellY(t);return i=Ne.apply(t.topSlide,i,s.cellCountY(t)-n),i=Ne.apply(t.bottomSlide,i,n)}}(G||(G={})),(Gt=Ne||(Ne={})).fromJson=function(s){var e,t,i,r;const n=(e=v.readObject(s))!=null?e:{};return{target:(t=v.readNumber(n.target))!=null?t:0,size:(i=v.readInt(n.size))!=null?i:0,offset:(r=v.readInt(n.offset))!=null?r:0}},Gt.apply=function(s,e,t){if(s.size<=0)return e;const i=(t-s.offset)/s.size;return Rt(s.target,e,i)},function(s){function e(t){const i=new gt(D.create(t));return gt.REGISTRY.register(i.key,i),i}s.NOISE=e("worldgen/noise"),s.DENSITY_FUNCTION=e("worldgen/density_function")}(ke||(ke={}));class C{minValue(){return-this.maxValue()}mapAll(e){return e.map(this)}}(function(s){s.context=function(b,l,p){return{x:b,y:l,z:p}};class e extends s{constructor(l){super(),this.input=l}compute(l){return this.transform(l,this.input.compute(l))}}const t=Me.parser(ke.NOISE,et.fromJson);s.fromJson=function b(l,p=b){var A,y,O,U,se,be,Z,q,W,ce,fe,Ye,Xe,ye,_e,Le,Fe,ie,Se;if(typeof l=="string")return new n(Me.reference(ke.DENSITY_FUNCTION,D.parse(l)));if(typeof l=="number")return new r(l);const E=(A=v.readObject(l))!=null?A:{},ot=(y=v.readString(E.type))==null?void 0:y.replace(/^minecraft:/,"");switch(ot){case"blend_alpha":return new a(1,0,1);case"blend_offset":case"beardifier":return new a(0,-1/0,1/0);case"old_blended_noise":return new o;case"flat_cache":return new f(p(E.argument));case"interpolated":return new d(p(E.argument));case"cache_2d":return new h(p(E.argument));case"cache_once":return new m(p(E.argument));case"cache_all_in_cell":return new c(p(E.argument));case"noise":return new g((O=v.readNumber(E.xz_scale))!=null?O:1,(U=v.readNumber(E.y_scale))!=null?U:1,t(E.noise));case"end_islands":return new w;case"weird_scaled_sampler":return new B(p(E.input),v.readEnum(E.rarity_value_mapper,S),t(E.noise));case"shifted_noise":return new R(p(E.shift_x),p(E.shift_y),p(E.shift_z),(se=v.readNumber(E.xz_scale))!=null?se:1,(be=v.readNumber(E.y_scale))!=null?be:1,t(E.noise));case"range_choice":return new _(p(E.input),(Z=v.readNumber(E.min_inclusive))!=null?Z:0,(q=v.readNumber(E.max_exclusive))!=null?q:1,p(E.when_in_range),p(E.when_out_of_range));case"shift_a":return new T(t(E.argument));case"shift_b":return new M(t(E.argument));case"shift":return new k(t(E.argument));case"blend_density":return new K(p(E.argument));case"clamp":return new Y(p(E.input),(W=v.readNumber(E.min))!=null?W:0,(ce=v.readNumber(E.max))!=null?ce:1);case"abs":case"square":case"cube":case"half_negative":case"quarter_negative":case"squeeze":return new Q(ot,p(E.argument));case"slide":return new ee(p(E.argument));case"add":case"mul":case"min":case"max":return new ne(v.readEnum(ot,j),p(E.argument1),p(E.argument2));case"spline":return new V(Te.fromJson(E.spline,p),(fe=v.readNumber(E.min_value))!=null?fe:0,(Ye=v.readNumber(E.max_value))!=null?Ye:1);case"terrain_shaper_spline":return new Ae(p(E.continentalness),p(E.erosion),p(E.weirdness),v.readEnum(E.spline,z),(Xe=v.readNumber(E.min_value))!=null?Xe:0,(ye=v.readNumber(E.max_value))!=null?ye:1);case"constant":return new r((_e=v.readNumber(E.argument))!=null?_e:0);case"y_clamped_gradient":return new Pe((Le=v.readInt(E.from_y))!=null?Le:-4064,(Fe=v.readInt(E.to_y))!=null?Fe:4062,(ie=v.readNumber(E.from_value))!=null?ie:-4064,(Se=v.readNumber(E.to_value))!=null?Se:4062)}return r.ZERO};const i=class extends s{constructor(b){super(),this.value=b}compute(){return this.value}minValue(){return this.value}maxValue(){return this.value}};let r=i;r.ZERO=new i(0),r.ONE=new i(1),s.Constant=r;class n extends s{constructor(l){super(),this.holder=l}compute(l){return this.holder.value().compute(l)}minValue(){return this.holder.value().minValue()}maxValue(){return this.holder.value().maxValue()}}s.HolderHolder=n;class a extends s.Constant{constructor(l,p,A){super(l),this.min=p,this.max=A}minValue(){return this.min}maxValue(){return this.max}}s.ConstantMinMax=a;class o extends s{constructor(l){super(),this.blendedNoise=l!=null?l:new ss(L.create(BigInt(0)),{xzScale:1,yScale:1,xzFactor:80,yFactor:160},4,8)}compute(l){return this.blendedNoise.sample(l.x,l.y,l.z)}maxValue(){return this.blendedNoise.maxValue}}s.OldBlendedNoise=o;class u extends s{constructor(l){super(),this.wrapped=l}minValue(){return this.wrapped.minValue()}maxValue(){return this.wrapped.maxValue()}}class f extends u{constructor(l){super(l),this.lastValue=0}compute(l){const p=l.x>>2,A=l.z>>2;return this.lastQuartX===p&&this.lastQuartZ===A||(this.lastValue=this.wrapped.compute(s.context(p<<2,0,A<<2)),this.lastQuartX=p,this.lastQuartZ=A),this.lastValue}mapAll(l){return l.map(new f(this.wrapped.mapAll(l)))}}s.FlatCache=f;class c extends u{constructor(l){super(l)}compute(l){return this.wrapped.compute(l)}mapAll(l){return l.map(new c(this.wrapped.mapAll(l)))}}s.CacheAllInCell=c;class h extends u{constructor(l){super(l),this.lastValue=0}compute(l){const p=l.x,A=l.z;return this.lastBlockX===p&&this.lastBlockZ===A||(this.lastValue=this.wrapped.compute(l),this.lastBlockX=p,this.lastBlockZ=A),this.lastValue}mapAll(l){return l.map(new h(this.wrapped.mapAll(l)))}}s.Cache2D=h;class m extends u{constructor(l){super(l),this.lastValue=0}compute(l){const p=l.x,A=l.y,y=l.z;return this.lastBlockX===p&&this.lastBlockY===A&&this.lastBlockZ===y||(this.lastValue=this.wrapped.compute(l),this.lastBlockX=p,this.lastBlockY=A,this.lastBlockZ=y),this.lastValue}mapAll(l){return l.map(new m(this.wrapped.mapAll(l)))}}s.CacheOnce=m;class d extends u{constructor(l,p=4,A=4){super(l),this.cellWidth=p,this.cellHeight=A,this.values=new Map}compute({x:l,y:p,z:A}){const y=this.cellWidth,O=this.cellHeight,U=(l%y+y)%y/y,se=(p%O+O)%O/O,be=(A%y+y)%y/y,Z=Math.floor(l/y)*y,q=Math.floor(p/O)*O,W=Math.floor(A/y)*y;return Rs(U,se,be,()=>this.computeCorner(Z,q,W),()=>this.computeCorner(Z+y,q,W),()=>this.computeCorner(Z,q+O,W),()=>this.computeCorner(Z+y,q+O,W),()=>this.computeCorner(Z,q,W+y),()=>this.computeCorner(Z+y,q,W+y),()=>this.computeCorner(Z,q+O,W+y),()=>this.computeCorner(Z+y,q+O,W+y))}computeCorner(l,p,A){return nt(this.values,`${l} ${p} ${A}`,()=>this.wrapped.compute(s.context(l,p,A)))}mapAll(l){return l.map(new d(this.wrapped.mapAll(l)))}withCellSize(l,p){return new d(this.wrapped,l,p)}}s.Interpolated=d;class g extends s{constructor(l,p,A,y){super(),this.xzScale=l,this.yScale=p,this.noiseData=A,this.noise=y}compute(l){var p,A;return(A=(p=this.noise)==null?void 0:p.sample(l.x*this.xzScale,l.y*this.yScale,l.z*this.xzScale))!=null?A:0}maxValue(){var l,p;return(p=(l=this.noise)==null?void 0:l.maxValue)!=null?p:2}}s.Noise=g;class w extends s{compute(){return 0}minValue(){return-.84375}maxValue(){return .5625}}const S=["type_1","type_2"],I=class extends e{constructor(b,l,p,A){super(b),this.rarityValueMapper=l,this.noiseData=p,this.noise=A,this.mapper=I.ValueMapper[this.rarityValueMapper]}transform(b,l){if(!this.noise)return 0;const p=this.mapper(l);return p*Math.abs(this.noise.sample(b.x/p,b.y/p,b.z/p))}mapAll(b){return b.map(new I(this.input.mapAll(b),this.rarityValueMapper,this.noiseData,this.noise))}minValue(){return 0}maxValue(){return this.rarityValueMapper==="type_1"?2:3}static rarityValueMapper1(b){return b<-.5?.75:b<0?1:b<.5?1.5:2}static rarityValueMapper2(b){return b<-.75?.5:b<-.5?.75:b<.5?1:b<.75?2:3}};let B=I;B.ValueMapper={type_1:I.rarityValueMapper1,type_2:I.rarityValueMapper2},s.WeirdScaledSampler=B;class R extends g{constructor(l,p,A,y,O,U,se){super(y,O,U,se),this.shiftX=l,this.shiftY=p,this.shiftZ=A}compute(l){var p,A;const y=l.x*this.xzScale+this.shiftX.compute(l),O=l.y*this.yScale+this.shiftY.compute(l),U=l.z*this.xzScale+this.shiftZ.compute(l);return(A=(p=this.noise)==null?void 0:p.sample(y,O,U))!=null?A:0}mapAll(l){return l.map(new R(this.shiftX.mapAll(l),this.shiftY.mapAll(l),this.shiftZ.mapAll(l),this.xzScale,this.yScale,this.noiseData,this.noise))}}s.ShiftedNoise=R;class _ extends s{constructor(l,p,A,y,O){super(),this.input=l,this.minInclusive=p,this.maxExclusive=A,this.whenInRange=y,this.whenOutOfRange=O}compute(l){const p=this.input.compute(l);return this.minInclusive<=p&&p<this.maxExclusive?this.whenInRange.compute(l):this.whenOutOfRange.compute(l)}mapAll(l){return l.map(new _(this.input.mapAll(l),this.minInclusive,this.maxExclusive,this.whenInRange.mapAll(l),this.whenOutOfRange.mapAll(l)))}minValue(){return Math.min(this.whenInRange.minValue(),this.whenOutOfRange.minValue())}maxValue(){return Math.max(this.whenInRange.maxValue(),this.whenOutOfRange.maxValue())}}s.RangeChoice=_;class x extends s{constructor(l,p){super(),this.noiseData=l,this.offsetNoise=p}compute(l){var p,A;return(A=(p=this.offsetNoise)==null?void 0:p.sample(.25*l.x,.25*l.y,.25*l.z))!=null?A:0}maxValue(){var l,p;return 4*((p=(l=this.offsetNoise)==null?void 0:l.maxValue)!=null?p:2)}}s.ShiftNoise=x;class T extends x{constructor(l,p){super(l,p)}compute(l){return super.compute(s.context(l.x,0,l.z))}withNewNoise(l){return new T(this.noiseData,l)}}s.ShiftA=T;class M extends x{constructor(l,p){super(l,p)}compute(l){return super.compute(s.context(l.z,l.x,0))}withNewNoise(l){return new M(this.noiseData,l)}}s.ShiftB=M;class k extends x{constructor(l,p){super(l,p)}withNewNoise(l){return new k(this.noiseData,l)}}s.Shift=k;class K extends e{constructor(l){super(l)}transform(l,p){return p}mapAll(l){return l.map(new K(this.input.mapAll(l)))}minValue(){return-1/0}maxValue(){return 1/0}}s.BlendDensity=K;class Y extends e{constructor(l,p,A){super(l),this.min=p,this.max=A}transform(l,p){return ve(p,this.min,this.max)}mapAll(l){return l.map(new Y(this.input.mapAll(l),this.min,this.max))}minValue(){return this.min}maxValue(){return this.max}}s.Clamp=Y;const H=class extends e{constructor(b,l,p,A){super(l),this.type=b,this.min=p,this.max=A,this.transformer=H.MappedTypes[this.type]}transform(b,l){return this.transformer(l)}mapAll(b){return b.map(new H(this.type,this.input.mapAll(b)))}minValue(){var b;return(b=this.min)!=null?b:-1/0}maxValue(){var b;return(b=this.max)!=null?b:1/0}withMinMax(){const b=this.input.minValue();let l=this.transformer(b),p=this.transformer(this.input.maxValue());return this.type!=="abs"&&this.type!=="square"||(p=Math.max(l,p),l=Math.max(0,b)),new H(this.type,this.input,l,p)}};let Q=H;Q.MappedTypes={abs:b=>Math.abs(b),square:b=>b*b,cube:b=>b*b*b,half_negative:b=>b>0?b:.5*b,quarter_negative:b=>b>0?b:.25*b,squeeze:b=>{const l=ve(b,-1,1);return l/2-l*l*l/24}},s.Mapped=Q;class ee extends e{constructor(l,p){super(l),this.settings=p}transform(l,p){return this.settings?G.applySlides(this.settings,p,l.y):p}mapAll(l){return l.map(new ee(this.input.mapAll(l),this.settings))}minValue(){return this.settings?Math.min(this.input.minValue(),this.settings.bottomSlide.target,this.settings.topSlide.target):this.input.minValue()}maxValue(){return this.settings?Math.max(this.input.maxValue(),this.settings.bottomSlide.target,this.settings.topSlide.target):this.input.maxValue()}}s.Slide=ee;const j=["add","mul","min","max"];class ne extends s{constructor(l,p,A,y,O){super(),this.type=l,this.argument1=p,this.argument2=A,this.min=y,this.max=O}compute(l){const p=this.argument1.compute(l);switch(this.type){case"add":return p+this.argument2.compute(l);case"mul":return p===0?0:p*this.argument2.compute(l);case"min":return p<this.argument2.minValue()?p:Math.min(p,this.argument2.compute(l));case"max":return p>this.argument2.maxValue()?p:Math.max(p,this.argument2.compute(l))}}mapAll(l){return l.map(new ne(this.type,this.argument1.mapAll(l),this.argument2.mapAll(l)))}minValue(){var l;return(l=this.min)!=null?l:-1/0}maxValue(){var l;return(l=this.max)!=null?l:1/0}withMinMax(){const l=this.argument1.minValue(),p=this.argument2.minValue(),A=this.argument1.maxValue(),y=this.argument2.maxValue();let O,U;switch(this.type!=="min"&&this.type!=="max"||!(l>=y||p>=A)||console.warn(`Creating a ${this.type} function between two non-overlapping inputs`),this.type){case"add":O=l+p,U=A+y;break;case"mul":O=l>0&&p>0?l*p||0:A<0&&y<0?A*y||0:Math.min(l*y||0,p*A||0),U=l>0&&p>0?A*y||0:A<0&&y<0?l*p||0:Math.max(l*p||0,A*y||0);break;case"min":O=Math.min(l,p),U=Math.min(A,y);break;case"max":O=Math.max(l,p),U=Math.max(A,y)}return new ne(this.type,this.argument1,this.argument2,O,U)}}s.Ap2=ne;class V extends s{constructor(l,p,A){super(),this.spline=l,this.min=p,this.max=A}compute(l){return ve(this.spline.compute(l),this.min,this.max)}mapAll(l){return l.map(new V(this.spline.mapAll(p=>p instanceof s?p.mapAll(l):p),this.min,this.max))}minValue(){return this.min}maxValue(){return this.max}}s.Spline=V;const z=["offset","factor","jaggedness"];class Ae extends s{constructor(l,p,A,y,O,U,se){super(),this.continentalness=l,this.erosion=p,this.weirdness=A,this.spline=y,this.min=O,this.max=U,this.shaper=se}compute(l){if(!this.shaper)return 0;const p=pe.point(this.continentalness.compute(l),this.erosion.compute(l),this.weirdness.compute(l));return ve(this.shaper[this.spline](p),this.min,this.max)}mapAll(l){return l.map(new Ae(this.continentalness.mapAll(l),this.erosion.mapAll(l),this.weirdness.mapAll(l),this.spline,this.min,this.max,this.shaper))}minValue(){return this.min}maxValue(){return this.max}}s.TerrainShaperSpline=Ae;class Pe extends s{constructor(l,p,A,y){super(),this.fromY=l,this.toY=p,this.fromValue=A,this.toValue=y}compute(l){return es(l.y,this.fromY,this.toY,this.fromValue,this.toValue)}minValue(){return Math.min(this.fromValue,this.toValue)}maxValue(){return Math.max(this.fromValue,this.toValue)}}s.YClampedGradient=Pe})(C||(C={}));class it{constructor(e,t){this.level=e,this.type=t}at(e){return e<this.level?this.type:P.AIR}}(xt||(xt={})).createDisabled=function(s){return{compute({x:e,y:t,z:i},r){if(!(r>0))return s(e,t,i).at(t)}}};const re=class{constructor(s,e,t,i,r,n,a,o,u,f){this.noiseChunk=s,this.barrierNoise=t,this.fluidLevelFloodednessNoise=i,this.fluidLevelSpreadNoise=r,this.lavaNoise=n,this.random=a,this.globalFluidPicker=f,this.minGridX=this.gridX($.minBlockX(e))-1,this.gridSizeX=this.gridX($.maxBlockX(e))+1-this.minGridX+1,this.minGridY=this.gridY(o)-1,this.minGridZ=this.gridZ($.minBlockZ(e))-1,this.gridSizeZ=this.gridZ($.maxBlockZ(e))+1-this.minGridZ+1;const c=this.gridY(o+u)+1-this.minGridY+1;this.gridSize=this.gridSizeX*c*this.gridSizeZ,this.aquiferCache=Array(this.gridSize).fill(void 0),this.aquiferLocationCache=Array(this.gridSize).fill(J.ZERO)}compute({x:s,y:e,z:t},i){if(i<=0){if(this.globalFluidPicker(s,e,t).at(e).is(P.LAVA))return P.LAVA;{const r=this.gridX(s-5),n=this.gridY(e+1),a=this.gridZ(t-5);let o=Number.MAX_SAFE_INTEGER,u=Number.MAX_SAFE_INTEGER,f=Number.MAX_SAFE_INTEGER,c=J.ZERO,h=J.ZERO,m=J.ZERO;for(let _=0;_<=1;_+=1)for(let x=-1;x<=1;x+=1)for(let T=0;T<=1;T+=1){const M=this.getLocation(r+_,n+x,a+T),k=J.magnitude(M);o>=k?(m=h,h=c,c=M,f=u,u=o,o=k):u>=k?(m=h,h=M,f=u,u=k):f>=k&&(m=M,f=k)}const d=this.getStatus(c),g=this.getStatus(h),w=this.getStatus(m),S=re.similarity(o,u),I=re.similarity(o,f),B=re.similarity(u,f);let R;if(d.at(e).is(P.WATER)&&this.globalFluidPicker(s,e-1,t).at(e-1).is(P.LAVA))R=1;else if(S>-1){const _=qe(()=>this.barrierNoise.compute(C.context(s,.5*e,t))),x=this.calculatePressure(e,d,g,_),T=this.calculatePressure(e,d,w,_),M=this.calculatePressure(e,g,w,_),k=Math.max(x,T*Math.max(0,I),M*Math.max(B));R=Math.max(0,2*Math.max(0,S)*k)}else R=0;if(i+R<=0)return d.at(e)}}}static similarity(s,e){return 1-Math.abs(e-s)/25}calculatePressure(s,e,t,i){const r=e.at(s),n=t.at(s);if(r.is(P.LAVA)&&n.is(P.WATER)||r.is(P.WATER)&&n.is(P.LAVA))return 1;const a=Math.abs(e.level-t.level);if(a===0)return 0;const o=s+.5-(e.level+t.level)/2,u=a/2-Math.abs(o),f=o>0?u>0?u/1.5:u/2.5:u>-3?(u+3)/3:(u+3)/10;return f<-2||f>2?f:f+i()}getStatus(s){const[e,t,i]=s,r=this.getIndex(this.gridX(e),this.gridY(t),this.gridZ(i)),n=this.aquiferCache[r];if(n!==void 0)return n;const a=this.computeStatus(e,t,i);return this.aquiferCache[r]=a,a}computeStatus(s,e,t){const i=this.globalFluidPicker(s,e,t);let r=Number.MAX_SAFE_INTEGER,n=!1;for(const[d,g]of re.SURFACE_SAMPLING){const w=s+(g<<4),S=t+(g<<4),I=this.noiseChunk.getPreliminarySurfaceLevel(w,S);r=Math.min(r,I);const B=d===0&&g===0;if(B&&e-12>I+8)return i;if(B||e+12>I+8){const R=this.globalFluidPicker(w,I+8,S);if(!R.at(I+8).is(P.AIR)){if(B)return R;n=!0}}}const a=n?es(r+8-e,0,64,1,0):0,o=ve(this.fluidLevelFloodednessNoise.compute(C.context(s,.67*e,t)),-1,1);if(o>Qe(a,1,0,-.3,.8))return i;if(o<=Qe(a,1,0,-.8,.4))return new it(Number.MIN_SAFE_INTEGER,i.type);const u=Math.floor(e/40),f=this.fluidLevelSpreadNoise.compute(C.context(Math.floor(s/16),u,Math.floor(t/16))),c=40*u+20+3*Math.floor(f/3),h=Math.min(r,c),m=this.getFluidType(s,e,t,i.type,c);return new it(h,m)}getFluidType(s,e,t,i,r){if(r<=-10){const n=this.lavaNoise.compute(C.context(Math.floor(s/64),Math.floor(e/40),Math.floor(t/64)));if(Math.abs(n)>.3)return P.LAVA}return i}getLocation(s,e,t){const i=this.getIndex(s,e,t),r=this.aquiferLocationCache[i];if(J.equals(r,J.ZERO))return r;const n=this.random.at(s,e,t),a=J.create(s*re.X_SPACING+n.nextInt(10),e*re.Y_SPACING+n.nextInt(9),t*re.Z_SPACING+n.nextInt(10));return this.aquiferLocationCache[i]=a,a}getIndex(s,e,t){const i=s-this.minGridX,r=e-this.minGridY,n=t-this.minGridZ,a=(r*this.gridSizeZ+n)*this.gridSizeX+i;if(a<0||a>=this.gridSize)throw new Error(`Invalid aquifer index at ${s} ${e} ${t}: 0 <= ${a} < ${this.gridSize}`);return a}gridX(s){return Math.floor(s/re.X_SPACING)}gridY(s){return Math.floor(s/re.Y_SPACING)}gridZ(s){return Math.floor(s/re.Z_SPACING)}};let je=re;var rt,le;je.X_SPACING=16,je.Y_SPACING=12,je.Z_SPACING=16,je.SURFACE_SAMPLING=[[-2,-1],[-1,-1],[0,-1],[1,-1],[-3,0],[-2,0],[-1,0],[0,0],[1,0],[-2,1],[-1,1],[0,1],[1,1]],function(s){function e(c,h){return typeof c=="number"?new t(c,h!=null?h:c):c}s.target=function(c,h,m,d,g,w){return new r(c,h,m,d,g,w)},s.parameters=function(c,h,m,d,g,w,S){return new i(e(c),e(h),e(m),e(d),e(g),e(w),S)},s.param=e;class t{constructor(h,m){this.min=h,this.max=m}distance(h){const m=(typeof h=="number"?h:h.min)-this.max,d=this.min-(typeof h=="number"?h:h.max);return m>0?m:Math.max(d,0)}union(h){return new t(Math.min(this.min,h.min),Math.max(this.max,h.max))}static fromJson(h){var m;if(typeof h=="number")return new t(h,h);const[d,g]=(m=v.readArray(h,w=>v.readNumber(w)))!=null?m:[];return new t(d!=null?d:0,g!=null?g:0)}}s.Param=t;class i{constructor(h,m,d,g,w,S,I){this.temperature=h,this.humidity=m,this.continentalness=d,this.erosion=g,this.depth=w,this.weirdness=S,this.offset=I}fittness(h){return de(this.temperature.distance(h.temperature))+de(this.humidity.distance(h.humidity))+de(this.continentalness.distance(h.continentalness))+de(this.erosion.distance(h.erosion))+de(this.depth.distance(h.depth))+de(this.weirdness.distance(h.weirdness))+de(this.offset-h.offset)}space(){return[this.temperature,this.humidity,this.continentalness,this.erosion,this.depth,this.weirdness,new t(this.offset,this.offset)]}static fromJson(h){var m,d;const g=(m=v.readObject(h))!=null?m:{};return new i(t.fromJson(g.temperature),t.fromJson(g.humidity),t.fromJson(g.continentalness),t.fromJson(g.erosion),t.fromJson(g.depth),t.fromJson(g.weirdness),(d=v.readInt(g.offset))!=null?d:0)}}s.ParamPoint=i;class r{constructor(h,m,d,g,w,S){this.temperature=h,this.humidity=m,this.continentalness=d,this.erosion=g,this.depth=w,this.weirdness=S}get offset(){return 0}toArray(){return[this.temperature,this.humidity,this.continentalness,this.erosion,this.depth,this.weirdness,this.offset]}}s.TargetPoint=r,s.Parameters=class{constructor(c){this.things=c,this.index=new a(c)}find(c){return this.index.search(c,(h,m)=>h.distance(m))}},s.Sampler=class{constructor(c,h,m,d,g,w){this.temperature=c,this.humidity=h,this.continentalness=m,this.erosion=d,this.depth=g,this.weirdness=w}static fromRouter(c){return new s.Sampler(c.temperature,c.vegetation,c.continents,c.erosion,c.depth,c.ridges)}sample(c,h,m){const d=C.context(c<<2,h<<2,m<<2);return s.target(this.temperature.compute(d),this.humidity.compute(d),this.continentalness.compute(d),this.erosion.compute(d),this.depth.compute(d),this.weirdness.compute(d))}};const n=class{constructor(c){this.root=n.build(c.map(([h,m])=>new f(h,m)))}static build(c){if(c.length===1)return c[0];if(c.length<=n.CHILDREN_PER_NODE){const g=c.map(w=>{let S=0;for(let I=0;I<7;I+=1){const B=w.space[I];S+=Math.abs((B.min+B.max)/2)}return{key:S,node:w}}).sort((w,S)=>w.key-S.key).map(({node:w})=>w);return new u(g)}let h=1/0,m=-1,d=[];for(let g=0;g<7;++g){c=n.sort(c,g,!1),d=n.bucketize(c);let w=0;for(const S of d)w+=n.area(S.space);h>w&&(h=w,m=g)}return c=n.sort(c,m,!1),d=n.bucketize(c),d=n.sort(d,m,!0),new u(d.map(g=>n.build(g.children)))}static sort(c,h,m){return c.map(d=>{const g=d.space[h],w=(g.min+g.max)/2;return{key:m?Math.abs(w):w,node:d}}).sort((d,g)=>d.key-g.key).map(({node:d})=>d)}static bucketize(c){const h=[];let m=[];const d=Math.pow(10,Math.floor(Math.log(c.length-.01)/Math.log(10)));for(const g of c)m.push(g),m.length<d||(h.push(new u(m)),m=[]);return m.length!==0&&h.push(new u(m)),h}static area(c){let h=0;for(const m of c)h+=Math.abs(m.max-m.min);return h}search(c,h){return this.root.search(c.toArray(),h).thing()}};let a=n;a.CHILDREN_PER_NODE=10,s.RTree=a;class o{constructor(h){this.space=h}distance(h){let m=0;for(let d=0;d<7;d+=1)m+=de(this.space[d].distance(h[d]));return m}}s.RNode=o;class u extends o{constructor(h){super(u.buildSpace(h)),this.children=h}static buildSpace(h){let m=[...Array(7)].map(()=>new t(1/0,-1/0));for(const d of h)m=[...Array(7)].map((g,w)=>m[w].union(d.space[w]));return m}search(h,m){let d=1/0,g=null;for(const w of this.children){const S=m(w,h);if(d<=S)continue;const I=w.search(h,m),B=w==I?S:m(I,h);d<=B||(d=B,g=I)}return g}}s.RSubTree=u;class f extends o{constructor(h,m){super(h.space()),this.thing=m}search(){return this}}s.RLeaf=f}(rt||(rt={}));class as{constructor(e){this.biome=e}getBiome(){return this.biome}static fromJson(e){var t,i;const r=(t=v.readObject(e))!=null?t:{},n=D.parse((i=v.readString(r.biome))!=null?i:"minecraft:the_void");return new as(n)}}class os{constructor(e){this.parameters=e}getBiome(e,t,i,r){const n=r.sample(e,t,i);return this.parameters.find(n)}static fromJson(e){var t,i;const r=(t=v.readObject(e))!=null?t:{},n=((i=v.readArray(r.biomes,a=>{var o,u,f;return u=(o=v.readObject(a))!=null?o:{},{biome:D.parse((f=v.readString(u.biome))!=null?f:"minecraft:the_void"),parameters:rt.ParamPoint.fromJson(u.parameters)}}))!=null?i:[]).map(a=>[a.parameters,()=>a.biome]);return new os(new rt.Parameters(n))}}(function(s){function e(i,r,n){return ke.NOISE.register(D.create(i),et.create(r,n))}s.TEMPERATURE=e("temperature",-10,[1.5,0,1,0,0,0]),s.VEGETATION=e("vegetation",-8,[1,1,0,0,0,0]),s.CONTINENTALNESS=e("continentalness",-9,[1,1,2,2,2,1,1,1,1]),s.EROSION=e("erosion",-9,[1,1,0,1,1]),s.TEMPERATURE_LARGE=e("temperature_large",-12,[1.5,0,1,0,0,0]),s.VEGETATION_LARGE=e("vegetation_large",-10,[1,1,0,0,0,0]),s.CONTINENTALNESS_LARGE=e("continentalness_large",-11,[1,1,2,2,2,1,1,1,1]),s.EROSION_LARGE=e("erosion_large",-11,[1,1,0,1,1]),s.RIDGE=e("ridge",-7,[1,2,1,0,0,0]),s.SHIFT=e("offset",-3,[1,1,1,0]),s.AQUIFER_BARRIER=e("aquifer_barrier",-3,[1]),s.AQUIFER_FLUID_LEVEL_FLOODEDNESS=e("aquifer_fluid_level_floodedness",-7,[1]),s.AQUIFER_FLUID_LEVEL_SPREAD=e("aquifer_fluid_level_spread",-5,[1]),s.AQUIFER_LAVA=e("aquifer_lava",-1,[1]),s.PILLAR=e("pillar",-7,[1,1]),s.PILLAR_RARENESS=e("pillar_rareness",-8,[1]),s.PILLAR_THICKNESS=e("pillar_thickness",-8,[1]),s.SPAGHETTI_2D=e("spaghetti_2d",-8,[1]),s.SPAGHETTI_2D_ELEVATION=e("spaghetti_2d_elevation",-8,[1]),s.SPAGHETTI_2D_MODULATOR=e("spaghetti_2d_modulator",-8,[1]),s.SPAGHETTI_2D_THICKNESS=e("spaghetti_2d_thickness",-8,[1]),s.SPAGHETTI_3D_1=e("spaghetti_3d_1",-8,[1]),s.SPAGHETTI_3D_2=e("spaghetti_3d_2",-8,[1]),s.SPAGHETTI_3D_RARITY=e("spaghetti_3d_rarity",-8,[1]),s.SPAGHETTI_3D_THICKNESS=e("spaghetti_3d_thickness",-8,[1]),s.SPAGHETTI_ROUGHNESS=e("spaghetti_roughness",-8,[1]),s.SPAGHETTI_ROUGHNESS_MODULATOR=e("spaghetti_roughness_modulator",-8,[1]),s.CAVE_ENTRANCE=e("cave_entrance",-7,[.4,.5,1]),s.CAVE_LAYER=e("cave_layer",-8,[1]),s.CAVE_CHEESE=e("cave_cheese",-8,[.5,1,2,1,2,1,0,2,0]),s.NOODLE=e("noodle",-8,[1]),s.NOODLE_THICKNESS=e("noodle_thickness",-8,[1]),s.NOODLE_RIDGE_A=e("noodle_ridge_a",-7,[1]),s.NOODLE_RIDGE_B=e("noodle_ridge_b",-7,[1]),s.JAGGED=e("jagged",-16,[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]),s.SURFACE=e("surface",-6,[1,1,1]),s.SURFACE_SECONDARY=e("surface_secondary",-6,[1,1,0,1]);const t=new Map;s.instantiate=function(i,r){var n;const a=(n=r.key())==null?void 0:n.toString();if(!a)throw new Error("Cannot instantiate noise from direct holder");const o=i.seedKey(),u=t.get(a);if(u&&u[0]===o[0]&&u[1]===o[1])return u[2];const f=new is(i.fromHashOf(a),r.value());return t.set(a,[o[0],o[1],f]),f}})(le||(le={}));var ze,At,Ge,yt,_t,ct,zt,Us=Object.defineProperty,Gs=Object.defineProperties,zs=Object.getOwnPropertyDescriptors,Yt=Object.getOwnPropertySymbols,Ys=Object.prototype.hasOwnProperty,Xs=Object.prototype.propertyIsEnumerable,Xt=(s,e,t)=>e in s?Us(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,Ht=(s,e)=>{for(var t in e||(e={}))Ys.call(e,t)&&Xt(s,t,e[t]);if(Yt)for(var t of Yt(e))Xs.call(e,t)&&Xt(s,t,e[t]);return s};(function(s){const e=i=>Me.parser(ke.DENSITY_FUNCTION,C.fromJson)(i).value();s.fromJson=function(i){var r;const n=(r=v.readObject(i))!=null?r:{};return{barrier:e(n.barrier),fluidLevelFloodedness:e(n.fluid_level_floodedness),fluidLevelSpread:e(n.fluid_level_spread),lava:e(n.lava),temperature:e(n.temperature),vegetation:e(n.vegetation),continents:e(n.continents),erosion:e(n.erosion),depth:e(n.depth),ridges:e(n.ridges),initialDensityWithoutJaggedness:e(n.initial_density_without_jaggedness),finalDensity:e(n.final_density),veinToggle:e(n.vein_toggle),veinRidged:e(n.vein_ridged),veinGap:e(n.vein_gap)}},s.create=function(i){return Ht({barrier:C.Constant.ZERO,fluidLevelFloodedness:C.Constant.ZERO,fluidLevelSpread:C.Constant.ZERO,lava:C.Constant.ZERO,temperature:C.Constant.ZERO,vegetation:C.Constant.ZERO,continents:C.Constant.ZERO,erosion:C.Constant.ZERO,depth:C.Constant.ZERO,ridges:C.Constant.ZERO,initialDensityWithoutJaggedness:C.Constant.ZERO,finalDensity:C.Constant.ZERO,veinToggle:C.Constant.ZERO,veinRidged:C.Constant.ZERO,veinGap:C.Constant.ZERO},i)},s.withSettings=function(i,r,n,a=!1){const o=(a?new he(n):L.create(n)).forkPositional(),u=new t(o,r);return f=Ht({},u.mapAll(i)),c={aquiferPositionalRandomFactory:o.fromHashOf(D.create("aquifer").toString()).forkPositional(),oreVeinsPositionalRandomFactory:o.fromHashOf(D.create("ore").toString()).forkPositional()},Gs(f,zs(c));var f,c};class t{constructor(r,n){this.random=r,this.settings=n,this.mapped=new Map}map(r){if(r instanceof C.HolderHolder){const n=r.holder.key();if(n!==void 0&&this.mapped.has(n.toString()))return this.mapped.get(n.toString());{const a=r.holder.value().mapAll(this);return n!==void 0&&this.mapped.set(n.toString(),a),a}}if(r instanceof C.Interpolated)return r.withCellSize(G.cellWidth(this.settings),G.cellHeight(this.settings));if(r instanceof C.Noise)return new C.Noise(r.xzScale,r.yScale,r.noiseData,le.instantiate(this.random,r.noiseData));if(r instanceof C.ShiftNoise)return r.withNewNoise(le.instantiate(this.random,r.noiseData));if(r instanceof C.ShiftedNoise){const n=le.instantiate(this.random,r.noiseData);return new C.ShiftedNoise(r.shiftX,r.shiftY,r.shiftZ,r.xzScale,r.yScale,r.noiseData,n)}return r instanceof C.WeirdScaledSampler?new C.WeirdScaledSampler(r.input,r.rarityValueMapper,r.noiseData,le.instantiate(this.random,r.noiseData)):r instanceof C.OldBlendedNoise?new C.OldBlendedNoise(new ss(this.random.fromHashOf(D.create("terrain").toString()),this.settings.sampling,G.cellWidth(this.settings),G.cellHeight(this.settings))):r instanceof C.Mapped||r instanceof C.Ap2?r.withMinMax():r instanceof C.TerrainShaperSpline?new C.TerrainShaperSpline(r.continentalness,r.erosion,r.weirdness,r.spline,r.min,r.max,this.settings.terrainShaper):r instanceof C.Slide?new C.Slide(r.input,this.settings):r}mapAll(r){return{barrier:r.barrier.mapAll(this),fluidLevelFloodedness:r.fluidLevelFloodedness.mapAll(this),fluidLevelSpread:r.fluidLevelSpread.mapAll(this),lava:r.lava.mapAll(this),temperature:r.temperature.mapAll(this),vegetation:r.vegetation.mapAll(this),continents:r.continents.mapAll(this),erosion:r.erosion.mapAll(this),depth:r.depth.mapAll(this),ridges:r.ridges.mapAll(this),initialDensityWithoutJaggedness:r.initialDensityWithoutJaggedness.mapAll(this),finalDensity:r.finalDensity.mapAll(this),veinToggle:r.veinToggle.mapAll(this),veinRidged:r.veinRidged.mapAll(this),veinGap:r.veinGap.mapAll(this)}}}s.Visitor=t,s.computePreliminarySurfaceLevelScanning=function(i,r,n,a){const o=G.minCellY(i)+G.cellCountY(i),u=G.minCellY(i),f=G.cellHeight(i);for(let c=o;c>=u;c-=1){const h=c*f,m=ve(r.compute(C.context(n,h,a)),-64,64);if(G.applySlides(i,m,h)>=.390625)return h}return Number.MAX_SAFE_INTEGER}})(ze||(ze={}));class Hs{constructor(e,t,i,r,n,a,o,u,f){this.cellCountXZ=e,this.cellCountY=t,this.cellNoiseMinY=i,this.router=r,this.minX=n,this.minZ=a,this.settings=o,this.preliminarySurfaceLevel=new Map,this.cellWidth=G.cellWidth(o),this.cellHeight=G.cellHeight(o),this.firstCellX=Math.floor(n/this.cellWidth),this.firstCellZ=Math.floor(a/this.cellWidth),this.firstNoiseX=n>>2,this.firstNoiseZ=a>>2,this.noiseSizeXZ=e*this.cellWidth>>2,this.aquifer=xt.createDisabled(f);const c=this.router.finalDensity;this.materialRule=At.fromList([h=>this.aquifer.compute(h,c.compute(h))]),this.initialDensityWithoutJaggedness=this.router.initialDensityWithoutJaggedness}getFinalState(e,t,i){return this.materialRule({x:e,y:t,z:i})}getPreliminarySurfaceLevel(e,t){return nt(this.preliminarySurfaceLevel,$.asLong(e,t),()=>ze.computePreliminarySurfaceLevelScanning(this.settings,this.initialDensityWithoutJaggedness,e<<2,t<<2))}getAquifer(){return this.aquifer}}(At||(At={})).fromList=function(s){return e=>{for(const t of s){const i=t(e);if(i)return i}}},(Ge||(Ge={})).fromJson=function(s){var e,t,i,r;const n=(e=v.readObject(s))!=null?e:{};return n.absolute!==void 0?(a=(t=v.readNumber(n.absolute))!=null?t:0,()=>a):n.above_bottom!==void 0?function(o){return u=>u.minY+o}((i=v.readNumber(n.above_bottom))!=null?i:0):n.below_top!==void 0?function(o){return u=>u.maxY-o}((r=v.readNumber(n.below_top))!=null?r:0):()=>0;var a},(yt||(yt={})).create=function(s,e){return{minY:s,height:e,maxY:s+e-1}};class js{constructor(e,t,i){this.rule=e,this.defaultBlock=t,this.random=L.create(i).forkPositional(),this.surfaceNoise=le.instantiate(this.random,le.SURFACE),this.surfaceSecondaryNoise=le.instantiate(this.random,le.SURFACE_SECONDARY),this.positionalRandoms=new Map}buildSurface(e,t,i,r){const n=$.minBlockX(e.pos),a=$.minBlockZ(e.pos),o=new Zs(this,e,t,i,r),u=this.rule(o);for(let f=0;f<16;f+=1){const c=n+f;for(let h=0;h<1;h+=1){const m=a+h;o.updateXZ(c,m);let d=0,g=Number.MIN_SAFE_INTEGER,w=Number.MAX_SAFE_INTEGER;for(let S=e.maxY;S>=e.minY;S-=1){const I=J.create(c,S,m),B=e.getBlockState(I);if(B.equals(P.AIR)){d=0,g=Number.MIN_SAFE_INTEGER;continue}if(B.isFluid()){g===Number.MIN_SAFE_INTEGER&&(g=S+1);continue}if(w>=S){w=Number.MIN_SAFE_INTEGER;for(let x=S-1;x>=e.minY;x-=1){const T=e.getBlockState(J.create(c,x,m));if(T.equals(P.AIR)||T.isFluid()){w=x+1;break}}}d+=1;const R=S-w+1;if(!B.equals(this.defaultBlock))continue;o.updateY(d,R,g,S);const _=u(c,S,m);_&&e.setBlockState(I,_)}}}}getSurfaceDepth(e,t){return 2.75*this.surfaceNoise.sample(e,0,t)+3+.25*this.random.at(e,0,t).nextDouble()}getSurfaceSecondary(e,t){return this.surfaceSecondaryNoise.sample(e,0,t)}getRandom(e){return nt(this.positionalRandoms,e,()=>this.random.fromHashOf(e))}}class Zs{constructor(e,t,i,r,n){this.system=e,this.chunk=t,this.noiseChunk=i,this.context=r,this.getBiome=n,this.blockX=0,this.blockY=0,this.blockZ=0,this.stoneDepthAbove=0,this.stoneDepthBelow=0,this.surfaceDepth=0,this.waterHeight=0,this.biome=()=>"",this.surfaceSecondary=()=>0,this.minSurfaceLevel=()=>0}updateXZ(e,t){this.blockX=e,this.blockZ=t,this.surfaceDepth=this.system.getSurfaceDepth(e,t),this.surfaceSecondary=qe(()=>this.system.getSurfaceSecondary(e,t)),this.minSurfaceLevel=qe(()=>this.calculateMinSurfaceLevel(e,t))}updateY(e,t,i,r){this.blockY=r,this.stoneDepthAbove=e,this.stoneDepthBelow=t,this.waterHeight=i,this.biome=qe(()=>this.getBiome(J.create(this.blockX,this.blockY,this.blockZ)))}calculateMinSurfaceLevel(e,t){const i=e>>4,r=t>>4,n=this.noiseChunk.getPreliminarySurfaceLevel(i<<4,r<<4),a=this.noiseChunk.getPreliminarySurfaceLevel(i+1<<4,r<<4),o=this.noiseChunk.getPreliminarySurfaceLevel(i<<4,r+1<<4),u=this.noiseChunk.getPreliminarySurfaceLevel(i+1<<4,r+1<<4);return Math.floor(vt((15&e)/16,(15&t)/16,n,a,o,u))+this.surfaceDepth-8}}(function(s){function e(r){return()=>()=>r}function t(r){return n=>{const a=r.map(o=>o(n));return(o,u,f)=>{for(const c of a){const h=c(o,u,f);if(h)return h}}}}function i(r,n){return a=>(o,u,f)=>{if(r(a))return n(a)(o,u,f)}}s.NOOP=()=>()=>{},s.fromJson=function(r){var n,a,o;const u=(n=v.readObject(r))!=null?n:{};switch((a=v.readString(u.type))==null?void 0:a.replace(/^minecraft:/,"")){case"block":return e(P.fromJson(u.result_state));case"sequence":return t((o=v.readArray(u.sequence,s.fromJson))!=null?o:[]);case"condition":return i(ct.fromJson(u.if_true),s.fromJson(u.then_run))}return s.NOOP},s.block=e,s.sequence=t,s.condition=i})(_t||(_t={})),function(s){function e(){return u=>u.blockY>=u.minSurfaceLevel()}function t(u){const f=new Set(u);return c=>f.has(c.biome())}function i(u){return f=>!u(f)}function r(u,f,c,h){return m=>{const d=h?m.stoneDepthBelow:m.stoneDepthAbove,g=f?m.surfaceDepth:0,w=c===0?0:Qe(m.surfaceSecondary(),-1,1,0,c);return d<=1+u+g+w}}function n(u,f,c){return h=>{const m=f(h.context),d=c(h.context);if(h.blockY<=m)return!0;if(h.blockY>=d)return!1;const g=h.system.getRandom(u),w=Qe(h.blockY,m,d,1,0);return g.nextFloat()<w}}function a(u,f,c){return h=>{if(h.waterHeight===Number.MIN_SAFE_INTEGER)return!0;const m=c?h.stoneDepthAbove:0;return h.blockY+m>=h.waterHeight+u+h.surfaceDepth*f}}function o(u,f,c){return h=>{const m=c?h.stoneDepthAbove:0;return h.blockY+m>=u(h.context)+h.surfaceDepth*f}}s.FALSE=()=>!1,s.TRUE=()=>!0,s.fromJson=function(u){var f,c,h,m,d,g,w,S,I,B,R,_;const x=(f=v.readObject(u))!=null?f:{};switch((c=v.readString(x.type))==null?void 0:c.replace(/^minecraft:/,"")){case"above_preliminary_surface":return T=>T.blockY>=T.minSurfaceLevel();case"biome":return t((h=v.readArray(x.biome_is,T=>{var M;return(M=v.readString(T))!=null?M:""}))!=null?h:[]);case"not":return i(s.fromJson(x.invert));case"stone_depth":return r((m=v.readInt(x.offset))!=null?m:0,(d=v.readBoolean(x.add_surface_depth))!=null&&d,(g=v.readInt(x.secondary_depth_range))!=null?g:0,v.readString(x.surface_type)==="ceiling");case"vertical_gradient":return n((w=v.readString(x.random_name))!=null?w:"",Ge.fromJson(x.true_at_and_below),Ge.fromJson(x.false_at_and_above));case"water":return a((S=v.readInt(x.offset))!=null?S:0,(I=v.readInt(x.surface_depth_multiplier))!=null?I:0,(B=v.readBoolean(x.add_surface_depth))!=null&&B);case"y_above":return o(Ge.fromJson(x.anchor),(R=v.readInt(x.surface_depth_multiplier))!=null?R:0,(_=v.readBoolean(x.add_surface_depth))!=null&&_)}return s.FALSE},s.abovePreliminarySurface=e,s.biome=t,s.not=i,s.stoneDepth=r,s.verticalGradient=n,s.water=a,s.yAbove=o}(ct||(ct={}));class ri{constructor(e,t,i){this.biomeSource=t,this.settings=i,this.router=ze.withSettings(i.noiseRouter,i.noise,e,i.legacyRandomSource),this.noiseChunkCache=new Map,this.surfaceSystem=new js(i.surfaceRule,i.defaultBlock,e);const r=new it(-54,P.LAVA),n=new it(i.seaLevel,i.defaultFluid);this.globalFluidPicker=(a,o,u)=>o<Math.min(-54,i.seaLevel)?r:n}fill(e,t=!1){var i;const r=Math.max(e.minY,this.settings.noise.minY),n=Math.min(e.maxY,this.settings.noise.minY+this.settings.noise.height),a=G.cellWidth(this.settings.noise),o=G.cellHeight(this.settings.noise),u=Math.floor(16/a),f=Math.floor(r/o),c=Math.floor((n-r)/o),h=$.minBlockX(e.pos),m=$.minBlockZ(e.pos),d=this.getNoiseChunk(e);for(let g=0;g<u;g+=1)for(let w=0;w<(t?1:u);w+=1){let S=e.getOrCreateSection(e.sectionsCount-1);for(let I=c-1;I>=0;I-=1)for(let B=o-1;B>=0;B-=1){const R=(f+I)*o+B,_=15&R,x=e.getSectionIndex(R);e.getSectionIndex(S.minBlockY)!==x&&(S=e.getOrCreateSection(x));for(let T=0;T<a;T+=1){const M=h+g*a+T,k=15&M;for(let K=0;K<(t?1:a);K+=1){const Y=m+w*a+K,H=15&Y,Q=(i=d.getFinalState(M,R,Y))!=null?i:this.settings.defaultBlock;S.setBlockState(k,_,H,Q)}}}}}buildSurface(e,t="minecraft:plains"){const i=this.getNoiseChunk(e),r=yt.create(this.settings.noise.minY,this.settings.noise.height);this.surfaceSystem.buildSurface(e,i,r,()=>t)}getNoiseChunk(e){return nt(this.noiseChunkCache,$.toLong(e.pos),()=>{const t=Math.max(e.minY,this.settings.noise.minY),i=Math.min(e.maxY,this.settings.noise.minY+this.settings.noise.height),r=G.cellWidth(this.settings.noise),n=G.cellHeight(this.settings.noise),a=Math.floor(16/r),o=Math.floor(t/n),u=Math.floor((i-t)/n),f=$.minBlockX(e.pos),c=$.minBlockZ(e.pos);return new Hs(a,u,o,this.router,f,c,this.settings.noise,this.settings.aquifersEnabled,this.globalFluidPicker)})}}(zt||(zt={})).fromJson=function(s){var e,t,i,r,n,a;const o=(e=v.readObject(s))!=null?e:{};return{surfaceRule:_t.fromJson(o.surface_rule),noise:G.fromJson(o.noise),defaultBlock:P.fromJson(o.default_block),defaultFluid:P.fromJson(o.default_fluid),noiseRouter:ze.fromJson(o.noise_router),seaLevel:(t=v.readInt(o.sea_level))!=null?t:0,disableMobGeneration:(i=v.readBoolean(o.disable_mob_generation))!=null&&i,aquifersEnabled:(r=v.readBoolean(o.aquifers_enabled))!=null&&r,oreVeinsEnabled:(n=v.readBoolean(o.ore_veins_enabled))!=null&&n,legacyRandomSource:(a=v.readBoolean(o.legacy_random_source))!=null&&a}};export{xt as Aquifer,ss as BlendedNoise,Ps as BlockColors,Bt as BlockDefinition,at as BlockModel,J as BlockPos,P as BlockState,ti as Chunk,$ as ChunkPos,pt as ChunkSection,rt as Climate,Te as CubicSpline,C as DensityFunction,F as Direction,as as FixedBiome,it as FluidStatus,Me as Holder,D as Identifier,Pt as ImprovedNoise,Ts as LegacyPositionalRandom,he as LegacyRandom,At as MaterialRule,os as MultiNoise,Ss as NbtReader,xs as NbtWriter,je as NoiseAquifer,Hs as NoiseChunk,ri as NoiseChunkGenerator,zt as NoiseGeneratorSettings,et as NoiseParameters,ze as NoiseRouter,bt as NoiseSamplingSettings,G as NoiseSettings,Ne as NoiseSlideSettings,le as Noises,is as NormalNoise,X as PerlinNoise,si as PerlinSimplexNoise,gt as Registry,te as SimplexNoise,Kt as Structure,ii as StructureRenderer,ct as SurfaceCondition,Zs as SurfaceContext,_t as SurfaceRule,js as SurfaceSystem,pe as TerrainShaper,Ke as TextureAtlas,Ge as VerticalAnchor,yt as WorldgenContext,ke as WorldgenRegistries,Cs as XoroshiroPositionalRandom,L as XoroshiroRandom,Bs as binarySearch,ve as clamp,Rt as clampedLerp,es as clampedMap,He as getListTag,$t as getOptional,ts as getSeed,Be as getTag,Qt as inverseLerp,Je as lazyLerp,Ot as lazyLerp2,Rs as lazyLerp3,we as lerp,vt as lerp2,Ns as lerp3,wt as longfromBytes,Qe as map,Ws as read,$s as readChunk,Wt as readCompressed,Js as readRegion,Et as readUncompressed,lt as smoothstep,de as square,Ct as tagNames,Ve as tagTypes,Ks as write,ei as writeChunk,dt as writeCompressed,Qs as writeRegion,It as writeUncompressed};
|
|
//# sourceMappingURL=deepslate.esm.666d0ed0.js.map
|