提交 a4329d0e 编写于 作者: 6 622eda98dfef6c4fdb84ccca

Wed Mar 22 13:30:00 UTC 2023 inscode

node_modules node_modules
.DS_Store .DS_Store
<<<<<<< HEAD
dist dist
=======
>>>>>>> 8e27e4d91d171fdca6522f4297ff30d0fdedccd0
dist-ssr dist-ssr
*.local *.local
*-lock.yaml *-lock.yaml
<<<<<<< HEAD
run = "upm add guess;npm run dev" run = "upm add guess;npm run dev"
=======
run = "dist/index.html"
>>>>>>> 8e27e4d91d171fdca6522f4297ff30d0fdedccd0
entrypoint = "index.ts" entrypoint = "index.ts"
[nix] [nix]
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
var vt=Object.defineProperty;var kt=(a,t,s)=>t in a?vt(a,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[t]=s;var i=(a,t,s)=>(kt(a,typeof t!="symbol"?t+"":t,s),s);import{P as wt,W as bt,S as J,F as st,C as ot,a as Z,A as Mt,T as xt,N as v,M as m,R as I,B as L,b as _,I as S,c as at,d as F,e as P,V as y,f as Ct,g as K,h as It,E as Pt,i as zt,j as Lt,k as V}from"./vendor.b16e062d.js";const St=function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))e(o);new MutationObserver(o=>{for(const n of o)if(n.type==="childList")for(const d of n.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&e(d)}).observe(document,{childList:!0,subtree:!0});function s(o){const n={};return o.integrity&&(n.integrity=o.integrity),o.referrerpolicy&&(n.referrerPolicy=o.referrerpolicy),o.crossorigin==="use-credentials"?n.credentials="include":o.crossorigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function e(o){if(o.ep)return;o.ep=!0;const n=s(o);fetch(o.href,n)}};St();class Et{constructor(){i(this,"camera");i(this,"scene");i(this,"renderer");i(this,"initCamera",()=>{this.camera.fov=50,this.camera.aspect=window.innerWidth/window.innerHeight,this.camera.near=.01,this.camera.far=500,this.camera.updateProjectionMatrix(),this.camera.position.set(8,50,8),this.camera.lookAt(100,30,100),window.addEventListener("resize",()=>{this.camera.aspect=window.innerWidth/window.innerHeight,this.camera.updateProjectionMatrix()})});i(this,"initScene",()=>{this.scene=new J;const t=8900331;this.scene.fog=new st(t,1,96),this.scene.background=new ot(t);const s=new Z(16777215,.5);s.position.set(500,500,500),this.scene.add(s);const e=new Z(16777215,.2);e.position.set(-500,500,-500),this.scene.add(e);const o=new Mt(4210752);this.scene.add(o)});i(this,"initRenderer",()=>{this.renderer.setSize(window.innerWidth,window.innerHeight),document.body.appendChild(this.renderer.domElement),window.addEventListener("resize",()=>{this.renderer.setSize(window.innerWidth,window.innerHeight)})});this.camera=new wt,this.renderer=new bt,this.scene=new J,this.initScene(),this.initRenderer(),this.initCamera()}}var b=(a=>(a.walking="walking",a.sprinting="sprinting",a.flying="flying",a.sprintFlying="sprintFlying",a.sneaking="sneaking",a))(b||{}),G=(a=>(a[a.walking=5.612]="walking",a[a.sprinting=5.612]="sprinting",a[a.flying=21.78]="flying",a[a.sprintFlying=21.78]="sprintFlying",a[a.sneaking=1.95]="sneaking",a))(G||{});class Ft{constructor(){i(this,"mode","walking");i(this,"speed",G[this.mode]);i(this,"falling",38.4);i(this,"jump",1.2522);i(this,"body",{height:1.8,width:.5})}setMode(t){this.mode=t,this.speed=G[this.mode]}}var Ht="/dist/assets/stone.fa5e82cb.png",At="/dist/assets/coal_ore.29c9a29e.png",jt="/dist/assets/iron_ore.78230e9e.png",Bt="/dist/assets/grass_block_side.1f5d4845.png",qt="/dist/assets/grass_top_green.be9cf310.png",Rt="/dist/assets/dirt.fb045025.png",Ot="/dist/assets/oak_log.fc1a2462.png",_t="/dist/assets/oak_log_top.6a68c340.png",Gt="/dist/assets/oak_leaves.776aee85.png",Xt="/dist/assets/sand.f4bf1751.png",$t="/dist/assets/oak_planks.be4a7f91.png",Nt="/dist/assets/diamond_block.fb45cc99.png",Tt="/dist/assets/quartz_block_side.0e4d401c.png",Yt="/dist/assets/glass.17e849a2.png",Dt="/dist/assets/bedrock.3e3a8330.png",w=(a=>(a.grass="grass",a.dirt="dirt",a.tree="tree",a.leaf="leaf",a.sand="sand",a.stone="stone",a.coal="coal",a.wood="wood",a.diamond="diamond",a.quartz="quartz",a.glass="glass",a.bedrock="bedrock",a))(w||{});let k=new xt;const nt=k.load(qt),q=k.load(Bt),R=k.load(Ot),X=k.load(_t),$=k.load(Rt),rt=k.load(Ht),lt=k.load(At),Ut=k.load(jt),ht=k.load(Gt),ct=k.load(Xt),dt=k.load($t),ut=k.load(Nt),mt=k.load(Tt),gt=k.load(Yt),ft=k.load(Dt);nt.magFilter=v;q.magFilter=v;R.magFilter=v;X.magFilter=v;$.magFilter=v;rt.magFilter=v;lt.magFilter=v;Ut.magFilter=v;ht.magFilter=v;ct.magFilter=v;dt.magFilter=v;ut.magFilter=v;mt.magFilter=v;gt.magFilter=v;ft.magFilter=v;class Wt{constructor(){i(this,"materials",{grass:[new m({map:q}),new m({map:q}),new m({map:nt}),new m({map:$}),new m({map:q}),new m({map:q})],dirt:new m({map:$}),sand:new m({map:ct}),tree:[new m({map:R}),new m({map:R}),new m({map:X}),new m({map:X}),new m({map:R}),new m({map:R})],leaf:new m({map:ht,color:new ot(0,1,0),transparent:!0}),stone:new m({map:rt}),coal:new m({map:lt}),wood:new m({map:dt}),diamond:new m({map:ut}),quartz:new m({map:mt}),glass:new m({map:gt,transparent:!0}),bedrock:new m({map:ft})});i(this,"get",t=>this.materials[t])}}class N{constructor(t,s,e,o,n){i(this,"object");i(this,"x");i(this,"y");i(this,"z");i(this,"type");i(this,"placed");this.x=t,this.y=s,this.z=e,this.type=o,this.placed=n}}class Jt{constructor(t,s,e){i(this,"scene");i(this,"camera");i(this,"terrain");i(this,"raycaster");i(this,"block",null);i(this,"geometry",new L(1.01,1.01,1.01));i(this,"material",new m({transparent:!0,opacity:.25}));i(this,"mesh",new _(new L,this.material));i(this,"index",0);i(this,"instanceMesh",new S(new L,new at,1e3));this.camera=s,this.scene=t,this.terrain=e,this.raycaster=new I,this.raycaster.far=8}update(){this.scene.remove(this.mesh),this.index=0,this.instanceMesh.instanceMatrix=new F(new Float32Array(1e3*16),16);const t=this.camera.position,s=new P,e=new Map,o=this.terrain.noise;let n=Math.round(t.x),d=Math.round(t.z);for(let l=-8;l<8;l++)for(let h=-8;h<8;h++){let g=n+l,u=d+h,p=Math.floor(o.get(g/o.gap,u/o.gap,o.seed)*o.amp)+30;e.set(`${g}_${p}_${u}`,this.index),s.setPosition(g,p,u),this.instanceMesh.setMatrixAt(this.index++,s);let M=o.get(g/o.stoneGap,u/o.stoneGap,o.stoneSeed)*o.stoneAmp;if(o.get(g/o.treeGap,u/o.treeGap,o.treeSeed)*o.treeAmp>o.treeThreshold&&p-30>=-3&&M<o.stoneThreshold)for(let c=1;c<=o.treeHeight;c++)e.set(`${g}_${p+c}_${u}`,this.index),s.setPosition(g,p+c,u),this.instanceMesh.setMatrixAt(this.index++,s)}for(const l of this.terrain.customBlocks)if(l.placed)s.setPosition(l.x,l.y,l.z),this.instanceMesh.setMatrixAt(this.index++,s);else if(e.has(`${l.x}_${l.y}_${l.z}`)){let h=e.get(`${l.x}_${l.y}_${l.z}`);this.instanceMesh.setMatrixAt(h,new P().set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0))}if(this.raycaster.setFromCamera({x:0,y:0},this.camera),this.block=this.raycaster.intersectObject(this.instanceMesh)[0],this.block&&this.block.object instanceof S&&typeof this.block.instanceId=="number"){this.mesh=new _(this.geometry,this.material);let l=new P;this.block.object.getMatrixAt(this.block.instanceId,l);const h=new y().setFromMatrixPosition(l);this.mesh.position.set(h.x,h.y,h.z),this.scene.add(this.mesh)}}}class Zt{constructor(){i(this,"noise",new Ct);i(this,"seed",Math.random());i(this,"gap",22);i(this,"amp",8);i(this,"stoneSeed",this.seed*.4);i(this,"stoneGap",12);i(this,"stoneAmp",8);i(this,"stoneThreshold",3.5);i(this,"coalSeed",this.seed*.5);i(this,"coalGap",3);i(this,"coalAmp",8);i(this,"coalThreshold",3);i(this,"treeSeed",this.seed*.7);i(this,"treeGap",2);i(this,"treeAmp",6);i(this,"treeHeight",10);i(this,"treeThreshold",4);i(this,"leafSeed",this.seed*.8);i(this,"leafGap",2);i(this,"leafAmp",5);i(this,"leafThreshold",-.03);i(this,"get",(t,s,e)=>this.noise.noise(t,s,e))}}function Kt(){return new Worker("/dist/assets/generate.707bb76c.js",{type:"module"})}var f=(a=>(a[a.grass=0]="grass",a[a.sand=1]="sand",a[a.tree=2]="tree",a[a.leaf=3]="leaf",a[a.dirt=4]="dirt",a[a.stone=5]="stone",a[a.coal=6]="coal",a[a.wood=7]="wood",a[a.diamond=8]="diamond",a[a.quartz=9]="quartz",a[a.glass=10]="glass",a[a.bedrock=11]="bedrock",a))(f||{});class Vt{constructor(t,s){i(this,"scene");i(this,"camera");i(this,"distance",3);i(this,"chunkSize",24);i(this,"maxCount");i(this,"chunk",new K(0,0));i(this,"previousChunk",new K(0,0));i(this,"noise",new Zt);i(this,"materials",new Wt);i(this,"materialType",[w.grass,w.sand,w.tree,w.leaf,w.dirt,w.stone,w.coal,w.wood,w.diamond,w.quartz,w.glass,w.bedrock]);i(this,"blocks",[]);i(this,"blocksCount",[]);i(this,"blocksFactor",[1,.2,.1,.7,.1,.2,.1,.1,.1,.1,.1,.1]);i(this,"customBlocks",[]);i(this,"highlight");i(this,"idMap",new Map);i(this,"generateWorker",new Kt);i(this,"cloud",new S(new L(20,5,14),new m({transparent:!0,color:16777215,opacity:.4}),1e3));i(this,"cloudCount",0);i(this,"cloudGap",5);i(this,"getCount",t=>this.blocksCount[t]);i(this,"setCount",t=>{this.blocksCount[t]=this.blocksCount[t]+1});i(this,"initBlocks",()=>{for(const s of this.blocks)this.scene.remove(s);this.blocks=[];const t=new L;for(let s=0;s<this.materialType.length;s++){let e=new S(t,this.materials.get(this.materialType[s]),this.maxCount*this.blocksFactor[s]);e.name=f[s],this.blocks.push(e),this.scene.add(e)}this.blocksCount=new Array(this.materialType.length).fill(0)});i(this,"resetBlocks",()=>{for(let t=0;t<this.blocks.length;t++)this.blocks[t].instanceMatrix=new F(new Float32Array(this.maxCount*this.blocksFactor[t]*16),16)});i(this,"generate",()=>{if(this.blocksCount=new Array(this.blocks.length).fill(0),this.generateWorker.postMessage({distance:this.distance,chunk:this.chunk,noiseSeed:this.noise.seed,treeSeed:this.noise.treeSeed,stoneSeed:this.noise.stoneSeed,coalSeed:this.noise.coalSeed,idMap:new Map,blocksFactor:this.blocksFactor,blocksCount:this.blocksCount,customBlocks:this.customBlocks,chunkSize:this.chunkSize}),this.cloudGap++>5){this.cloudGap=0,this.cloud.instanceMatrix=new F(new Float32Array(1e3*16),16),this.cloudCount=0;for(let t=-this.chunkSize*this.distance*3+this.chunkSize*this.chunk.x;t<this.chunkSize*this.distance*3+this.chunkSize+this.chunkSize*this.chunk.x;t+=20)for(let s=-this.chunkSize*this.distance*3+this.chunkSize*this.chunk.y;s<this.chunkSize*this.distance*3+this.chunkSize+this.chunkSize*this.chunk.y;s+=20){const e=new P;e.setPosition(t,80+(Math.random()-.5)*30,s),Math.random()>.8&&this.cloud.setMatrixAt(this.cloudCount++,e)}this.cloud.instanceMatrix.needsUpdate=!0}});i(this,"generateAdjacentBlocks",t=>{const{x:s,y:e,z:o}=t,n=this.noise,d=Math.floor(n.get(s/n.gap,o/n.gap,n.seed)*n.amp);if(e>30+d)return;const l=n.get(s/n.stoneGap,o/n.stoneGap,n.stoneSeed)*n.stoneAmp;let h;l>n.stoneThreshold||e<23?h=5:d<-3?h=1:h=4,this.buildBlock(new y(s,e-1,o),h),this.buildBlock(new y(s,e+1,o),h),this.buildBlock(new y(s-1,e,o),h),this.buildBlock(new y(s+1,e,o),h),this.buildBlock(new y(s,e,o-1),h),this.buildBlock(new y(s,e,o+1),h),this.blocks[h].instanceMatrix.needsUpdate=!0});i(this,"buildBlock",(t,s)=>{const e=this.noise,o=Math.floor(e.get(t.x/e.gap,t.z/e.gap,e.seed)*e.amp);if(t.y>=30+o||t.y<0)return;t.y===0&&(s=11);for(const d of this.customBlocks)if(d.x===t.x&&d.y===t.y&&d.z===t.z)return;this.customBlocks.push(new N(t.x,t.y,t.z,s,!0));const n=new P;n.setPosition(t),this.blocks[s].setMatrixAt(this.getCount(s),n),this.blocks[s].instanceMatrix.needsUpdate=!0,this.setCount(s)});i(this,"update",()=>{this.chunk.set(Math.floor(this.camera.position.x/this.chunkSize),Math.floor(this.camera.position.z/this.chunkSize)),(this.chunk.x!==this.previousChunk.x||this.chunk.y!==this.previousChunk.y)&&this.generate(),this.previousChunk.copy(this.chunk),this.highlight.update()});this.scene=t,this.camera=s,this.maxCount=(this.distance*this.chunkSize*2+this.chunkSize)**2+500,this.highlight=new Jt(t,s,this),this.scene.add(this.cloud),this.generateWorker.onmessage=e=>{this.resetBlocks(),this.idMap=e.data.idMap,this.blocksCount=e.data.blocksCount;for(let o=0;o<e.data.arrays.length;o++)this.blocks[o].instanceMatrix=new F(this.blocks[o].instanceMatrix.array=e.data.arrays[o],16);for(const o of this.blocks)o.instanceMatrix.needsUpdate=!0}}}const Qt=a=>{const t=document.createElement("template");t.innerHTML=a,window.document.body.appendChild(t.content)},x=/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent);class te{constructor(t,s,e,o,n){i(this,"scene");i(this,"camera");i(this,"player");i(this,"terrain");i(this,"control");i(this,"audio");i(this,"velocity",new y(0,0,0));i(this,"frontCollide",!1);i(this,"backCollide",!1);i(this,"leftCollide",!1);i(this,"rightCollide",!1);i(this,"downCollide",!0);i(this,"upCollide",!1);i(this,"isJumping",!1);i(this,"raycasterDown",new I);i(this,"raycasterUp",new I);i(this,"raycasterFront",new I);i(this,"raycasterBack",new I);i(this,"raycasterRight",new I);i(this,"raycasterLeft",new I);i(this,"tempMesh",new S(new L(1,1,1),new at,100));i(this,"tempMeshMatrix",new F(new Float32Array(100*16),16));i(this,"p1",performance.now());i(this,"p2",performance.now());i(this,"raycaster");i(this,"far");i(this,"holdingBlock",f.grass);i(this,"holdingBlocks",[f.grass,f.stone,f.tree,f.wood,f.diamond,f.quartz,f.glass,f.grass,f.grass,f.grass]);i(this,"holdingIndex",0);i(this,"wheelGap",!1);i(this,"clickInterval");i(this,"jumpInterval");i(this,"mouseHolding",!1);i(this,"spaceHolding",!1);i(this,"initRayCaster",()=>{this.raycasterUp.ray.direction=new y(0,1,0),this.raycasterDown.ray.direction=new y(0,-1,0),this.raycasterFront.ray.direction=new y(1,0,0),this.raycasterBack.ray.direction=new y(-1,0,0),this.raycasterLeft.ray.direction=new y(0,0,-1),this.raycasterRight.ray.direction=new y(0,0,1),this.raycasterUp.far=1.2,this.raycasterDown.far=this.player.body.height,this.raycasterFront.far=this.player.body.width,this.raycasterBack.far=this.player.body.width,this.raycasterLeft.far=this.player.body.width,this.raycasterRight.far=this.player.body.width});i(this,"setMovementHandler",t=>{if(!t.repeat)switch(t.key){case"q":this.player.mode===b.walking?this.player.setMode(b.flying):this.player.setMode(b.walking),this.velocity.y=0,this.velocity.x=0,this.velocity.z=0;break;case"w":case"W":this.velocity.x+=this.player.speed;break;case"s":case"S":this.velocity.x-=this.player.speed;break;case"a":case"A":this.velocity.z-=this.player.speed;break;case"d":case"D":this.velocity.z+=this.player.speed;break;case" ":this.player.mode===b.walking?this.isJumping||(this.velocity.y=8,this.isJumping=!0,this.downCollide=!1,this.far=0,setTimeout(()=>{this.far=this.player.body.height},300)):this.velocity.y+=this.player.speed,this.player.mode===b.walking&&!this.spaceHolding&&(this.spaceHolding=!0,this.jumpInterval=setInterval(()=>{this.setMovementHandler(t)},10));break;case"Shift":this.player.mode===b.walking||(this.velocity.y-=this.player.speed);break}});i(this,"resetMovementHandler",t=>{if(!t.repeat)switch(t.key){case"w":case"W":this.velocity.x=0;break;case"s":case"S":this.velocity.x=0;break;case"a":case"A":this.velocity.z=0;break;case"d":case"D":this.velocity.z=0;break;case" ":if(this.jumpInterval&&clearInterval(this.jumpInterval),this.spaceHolding=!1,this.player.mode===b.walking)return;this.velocity.y=0;break;case"Shift":if(this.player.mode===b.walking)return;this.velocity.y=0;break}});i(this,"mousedownHandler",t=>{t.preventDefault(),this.raycaster.setFromCamera({x:0,y:0},this.camera);const s=this.raycaster.intersectObjects(this.terrain.blocks)[0],e=new P;switch(t.button){case 0:if(s&&s.object instanceof S){s.object.getMatrixAt(s.instanceId,e);const o=new y().setFromMatrixPosition(e);if(f[s.object.name]===f.bedrock){this.terrain.generateAdjacentBlocks(o);return}s.object.setMatrixAt(s.instanceId,new P().set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),this.audio.playSound(f[s.object.name]);const n=new _(new L(1,1,1),this.terrain.materials.get(this.terrain.materialType[parseInt(f[s.object.name])]));n.position.set(o.x,o.y,o.z),this.scene.add(n);const d=performance.now();let l=0;const h=()=>{if(performance.now()-d>250){this.scene.remove(n),cancelAnimationFrame(l);return}l=requestAnimationFrame(h),n.geometry.scale(.85,.85,.85)};h(),s.object.instanceMatrix.needsUpdate=!0;let g=!1;for(const u of this.terrain.customBlocks)u.x===o.x&&u.y===o.y&&u.z===o.z&&(g=!0,u.placed=!1);g||this.terrain.customBlocks.push(new N(o.x,o.y,o.z,f[s.object.name],!1)),this.terrain.generateAdjacentBlocks(o)}break;case 2:if(s&&s.object instanceof S){const o=s.face.normal;s.object.getMatrixAt(s.instanceId,e);const n=new y().setFromMatrixPosition(e);if(n.x+o.x===Math.round(this.camera.position.x)&&n.z+o.z===Math.round(this.camera.position.z)&&(n.y+o.y===Math.round(this.camera.position.y)||n.y+o.y===Math.round(this.camera.position.y-1)))return;e.setPosition(o.x+n.x,o.y+n.y,o.z+n.z),this.terrain.blocks[this.holdingBlock].setMatrixAt(this.terrain.getCount(this.holdingBlock),e),this.terrain.setCount(this.holdingBlock),this.audio.playSound(this.holdingBlock),this.terrain.blocks[this.holdingBlock].instanceMatrix.needsUpdate=!0,this.terrain.customBlocks.push(new N(o.x+n.x,o.y+n.y,o.z+n.z,this.holdingBlock,!0))}break}!x&&!this.mouseHolding&&(this.mouseHolding=!0,this.clickInterval=setInterval(()=>{this.mousedownHandler(t)},333))});i(this,"mouseupHandler",()=>{this.clickInterval&&clearInterval(this.clickInterval),this.mouseHolding=!1});i(this,"changeHoldingBlockHandler",t=>{var s;isNaN(parseInt(t.key))||t.key==="0"||(this.holdingIndex=parseInt(t.key)-1,this.holdingBlock=(s=this.holdingBlocks[this.holdingIndex])!=null?s:f.grass)});i(this,"wheelHandler",t=>{var s;this.wheelGap||(this.wheelGap=!0,setTimeout(()=>{this.wheelGap=!1},100),t.deltaY>0?(this.holdingIndex++,this.holdingIndex>9&&(this.holdingIndex=0)):t.deltaY<0&&(this.holdingIndex--,this.holdingIndex<0&&(this.holdingIndex=9)),this.holdingBlock=(s=this.holdingBlocks[this.holdingIndex])!=null?s:f.grass)});i(this,"initEventListeners",()=>{document.addEventListener("pointerlockchange",()=>{document.pointerLockElement?(document.body.addEventListener("keydown",this.changeHoldingBlockHandler),document.body.addEventListener("wheel",this.wheelHandler),document.body.addEventListener("keydown",this.setMovementHandler),document.body.addEventListener("keyup",this.resetMovementHandler),document.body.addEventListener("mousedown",this.mousedownHandler),document.body.addEventListener("mouseup",this.mouseupHandler)):(document.body.removeEventListener("keydown",this.changeHoldingBlockHandler),document.body.removeEventListener("wheel",this.wheelHandler),document.body.removeEventListener("keydown",this.setMovementHandler),document.body.removeEventListener("keyup",this.resetMovementHandler),document.body.removeEventListener("mousedown",this.mousedownHandler),document.body.removeEventListener("mouseup",this.mouseupHandler),this.velocity=new y(0,0,0))})});i(this,"moveZ",(t,s)=>{this.camera.position.z+=t*(this.player.speed/Math.PI)*2*s});i(this,"collideCheckAll",(t,s,e,o)=>{this.collideCheck(4,t,s,e,o),this.collideCheck(0,t,s,e),this.collideCheck(1,t,s,e),this.collideCheck(2,t,s,e),this.collideCheck(3,t,s,e),this.collideCheck(5,t,s,e)});i(this,"collideCheck",(t,s,e,o,n=this.player.body.width)=>{const d=new P;let l=0;this.tempMesh.instanceMatrix=new F(new Float32Array(100*16),16);let h=!1,g=new Array(this.terrain.noise.treeHeight+1).fill(!1),u=Math.round(s.x),p=Math.round(s.z);switch(t){case 0:u++,this.raycasterFront.ray.origin=s;break;case 1:u--,this.raycasterBack.ray.origin=s;break;case 2:p--,this.raycasterLeft.ray.origin=s;break;case 3:p++,this.raycasterRight.ray.origin=s;break;case 4:this.raycasterDown.ray.origin=s,this.raycasterDown.far=n;break;case 5:this.raycasterUp.ray.origin=new y().copy(s),this.raycasterUp.ray.origin.y--;break}let M=Math.floor(e.get(u/e.gap,p/e.gap,e.seed)*e.amp)+30;for(const c of o)if(c.x===u&&c.z===p)if(c.placed)d.setPosition(c.x,c.y,c.z),this.tempMesh.setMatrixAt(l++,d);else if(c.y===M)h=!0;else for(let r=1;r<=this.terrain.noise.treeHeight;r++)c.y===M+r&&(g[r]=!0);h||(d.setPosition(u,M,p),this.tempMesh.setMatrixAt(l++,d));for(let c=1;c<=this.terrain.noise.treeHeight;c++)if(!g[c]){let r=e.get(u/e.treeGap,p/e.treeGap,e.treeSeed)*e.treeAmp,z=e.get(u/e.stoneGap,p/e.stoneGap,e.stoneSeed)*e.stoneAmp;r>e.treeThreshold&&M>=27&&z<e.stoneThreshold&&(d.setPosition(u,M+c,p),this.tempMesh.setMatrixAt(l++,d))}this.tempMesh.instanceMatrix.needsUpdate=!0;const C=new y(s.x,s.y-1,s.z);switch(t){case 0:{const c=this.raycasterFront.intersectObject(this.tempMesh).length;this.raycasterFront.ray.origin=C;const r=this.raycasterFront.intersectObject(this.tempMesh).length;c||r?this.frontCollide=!0:this.frontCollide=!1;break}case 1:{const c=this.raycasterBack.intersectObject(this.tempMesh).length;this.raycasterBack.ray.origin=C;const r=this.raycasterBack.intersectObject(this.tempMesh).length;c||r?this.backCollide=!0:this.backCollide=!1;break}case 2:{const c=this.raycasterLeft.intersectObject(this.tempMesh).length;this.raycasterLeft.ray.origin=C;const r=this.raycasterLeft.intersectObject(this.tempMesh).length;c||r?this.leftCollide=!0:this.leftCollide=!1;break}case 3:{const c=this.raycasterRight.intersectObject(this.tempMesh).length;this.raycasterRight.ray.origin=C;const r=this.raycasterRight.intersectObject(this.tempMesh).length;c||r?this.rightCollide=!0:this.rightCollide=!1;break}case 4:{this.raycasterDown.intersectObject(this.tempMesh).length?this.downCollide=!0:this.downCollide=!1;break}case 5:{this.raycasterUp.intersectObject(this.tempMesh).length?this.upCollide=!0:this.upCollide=!1;break}}});i(this,"update",()=>{this.p1=performance.now();const t=(this.p1-this.p2)/1e3;if(this.player.mode===b.flying)this.control.moveForward(this.velocity.x*t),this.control.moveRight(this.velocity.z*t),this.camera.position.y+=this.velocity.y*t;else{this.collideCheckAll(this.camera.position,this.terrain.noise,this.terrain.customBlocks,this.far-this.velocity.y*t),Math.abs(this.velocity.y)<this.player.falling&&(this.velocity.y-=25*t),this.upCollide&&(this.velocity.y=-225*t,this.far=this.player.body.height),this.downCollide&&!this.isJumping?this.velocity.y=0:this.downCollide&&this.isJumping&&(this.isJumping=!1);let s=new y(0,0,-1).applyQuaternion(this.camera.quaternion),e=Math.atan2(s.x,s.z);this.frontCollide||this.backCollide||this.leftCollide||this.rightCollide?(this.frontCollide&&(e<Math.PI&&e>0&&this.velocity.x>0?(!this.leftCollide&&e>Math.PI/2||!this.rightCollide&&e<Math.PI/2)&&this.moveZ(Math.PI/2-e,t):!this.leftCollide&&!this.rightCollide&&this.velocity.x>0&&this.control.moveForward(this.velocity.x*t),e<0&&e>-Math.PI&&this.velocity.x<0?(!this.leftCollide&&e>-Math.PI/2||!this.rightCollide&&e<-Math.PI/2)&&this.moveZ(-Math.PI/2-e,t):!this.leftCollide&&!this.rightCollide&&this.velocity.x<0&&this.control.moveForward(this.velocity.x*t),e<Math.PI/2&&e>-Math.PI/2&&this.velocity.z<0?(!this.rightCollide&&e<0||!this.leftCollide&&e>0)&&this.moveZ(-e,t):!this.leftCollide&&!this.rightCollide&&this.velocity.z<0&&this.control.moveRight(this.velocity.z*t),(e<-Math.PI/2||e>Math.PI/2)&&this.velocity.z>0?(!this.rightCollide&&e>0&&this.moveZ(Math.PI-e,t),!this.leftCollide&&e<0&&this.moveZ(-Math.PI-e,t)):!this.leftCollide&&!this.rightCollide&&this.velocity.z>0&&this.control.moveRight(this.velocity.z*t)),this.backCollide&&(e<0&&e>-Math.PI&&this.velocity.x>0?(!this.leftCollide&&e<-Math.PI/2||!this.rightCollide&&e>-Math.PI/2)&&this.moveZ(Math.PI/2+e,t):!this.leftCollide&&!this.rightCollide&&this.velocity.x>0&&this.control.moveForward(this.velocity.x*t),e<Math.PI&&e>0&&this.velocity.x<0?(!this.leftCollide&&e<Math.PI/2||!this.rightCollide&&e>Math.PI/2)&&this.moveZ(e-Math.PI/2,t):!this.leftCollide&&!this.rightCollide&&this.velocity.x<0&&this.control.moveForward(this.velocity.x*t),(e<-Math.PI/2||e>Math.PI/2)&&this.velocity.z<0?(!this.leftCollide&&e>0&&this.moveZ(-Math.PI+e,t),!this.rightCollide&&e<0&&this.moveZ(Math.PI+e,t)):!this.leftCollide&&!this.rightCollide&&this.velocity.z<0&&this.control.moveRight(this.velocity.z*t),e<Math.PI/2&&e>-Math.PI/2&&this.velocity.z>0?(!this.leftCollide&&e<0||!this.rightCollide&&e>0)&&this.moveZ(e,t):!this.leftCollide&&!this.rightCollide&&this.velocity.z>0&&this.control.moveRight(this.velocity.z*t)),this.leftCollide&&((e<-Math.PI/2||e>Math.PI/2)&&this.velocity.x>0?(!this.frontCollide&&e>0&&this.moveX(Math.PI-e,t),!this.backCollide&&e<0&&this.moveX(-Math.PI-e,t)):!this.frontCollide&&!this.backCollide&&this.velocity.x>0?this.control.moveForward(this.velocity.x*t):this.frontCollide&&e<0&&e>-Math.PI/2&&this.velocity.x>0?this.control.moveForward(this.velocity.x*t):this.backCollide&&e<Math.PI/2&&e>0&&this.velocity.x>0&&this.control.moveForward(this.velocity.x*t),e<Math.PI/2&&e>-Math.PI/2&&this.velocity.x<0?(!this.frontCollide&&e<0||!this.backCollide&&e>0)&&this.moveX(-e,t):!this.frontCollide&&!this.backCollide&&this.velocity.x<0?this.control.moveForward(this.velocity.x*t):this.frontCollide&&e<Math.PI&&e>Math.PI/2&&this.velocity.x<0?this.control.moveForward(this.velocity.x*t):this.backCollide&&e>-Math.PI&&e<-Math.PI/2&&this.velocity.x<0&&this.control.moveForward(this.velocity.x*t),e>0&&e<Math.PI&&this.velocity.z<0?(!this.backCollide&&e>Math.PI/2||!this.frontCollide&&e<Math.PI/2)&&this.moveX(Math.PI/2-e,t):!this.frontCollide&&!this.backCollide&&this.velocity.z<0?this.control.moveRight(this.velocity.z*t):this.frontCollide&&e>-Math.PI&&e<-Math.PI/2&&this.velocity.z<0?this.control.moveRight(this.velocity.z*t):this.backCollide&&e>-Math.PI/2&&e<0&&this.velocity.z<0&&this.control.moveRight(this.velocity.z*t),e<0&&e>-Math.PI&&this.velocity.z>0?(!this.backCollide&&e>-Math.PI/2||!this.frontCollide&&e<-Math.PI/2)&&this.moveX(-Math.PI/2-e,t):!this.frontCollide&&!this.backCollide&&this.velocity.z>0?this.control.moveRight(this.velocity.z*t):this.frontCollide&&e<Math.PI/2&&e>0&&this.velocity.z>0?this.control.moveRight(this.velocity.z*t):this.backCollide&&e<Math.PI&&e>Math.PI/2&&this.velocity.z>0&&this.control.moveRight(this.velocity.z*t)),this.rightCollide&&(e<Math.PI/2&&e>-Math.PI/2&&this.velocity.x>0?(!this.backCollide&&e<0||!this.frontCollide&&e>0)&&this.moveX(e,t):!this.frontCollide&&!this.backCollide&&this.velocity.x>0?this.control.moveForward(this.velocity.x*t):this.frontCollide&&e<-Math.PI/2&&e>-Math.PI&&this.velocity.x>0?this.control.moveForward(this.velocity.x*t):this.backCollide&&e<Math.PI&&e>Math.PI/2&&this.velocity.x>0&&this.control.moveForward(this.velocity.x*t),(e<-Math.PI/2||e>Math.PI/2)&&this.velocity.x<0?(!this.backCollide&&e>0&&this.moveX(-Math.PI+e,t),!this.frontCollide&&e<0&&this.moveX(Math.PI+e,t)):!this.frontCollide&&!this.backCollide&&this.velocity.x<0?this.control.moveForward(this.velocity.x*t):this.frontCollide&&e<Math.PI/2&&e>0&&this.velocity.x<0?this.control.moveForward(this.velocity.x*t):this.backCollide&&e<0&&e>-Math.PI/2&&this.velocity.x<0&&this.control.moveForward(this.velocity.x*t),e<0&&e>-Math.PI&&this.velocity.z<0?(!this.frontCollide&&e>-Math.PI/2||!this.backCollide&&e<-Math.PI/2)&&this.moveX(Math.PI/2+e,t):!this.frontCollide&&!this.backCollide&&this.velocity.z<0?this.control.moveRight(this.velocity.z*t):this.frontCollide&&e>Math.PI/2&&e<Math.PI&&this.velocity.z<0?this.control.moveRight(this.velocity.z*t):this.backCollide&&e>0&&e<Math.PI/2&&this.velocity.z<0&&this.control.moveRight(this.velocity.z*t),e>0&&e<Math.PI&&this.velocity.z>0?(!this.frontCollide&&e>Math.PI/2||!this.backCollide&&e<Math.PI/2)&&this.moveX(e-Math.PI/2,t):!this.frontCollide&&!this.backCollide&&this.velocity.z>0?this.control.moveRight(this.velocity.z*t):this.frontCollide&&e>-Math.PI/2&&e<0&&this.velocity.z>0?this.control.moveRight(this.velocity.z*t):this.backCollide&&e>-Math.PI&&e<-Math.PI/2&&this.velocity.z>0&&this.control.moveRight(this.velocity.z*t))):(this.control.moveForward(this.velocity.x*t),this.control.moveRight(this.velocity.z*t)),this.camera.position.y+=this.velocity.y*t,this.camera.position.y<-100&&(this.camera.position.y=60)}this.p2=this.p1});this.scene=t,this.camera=s,this.player=e,this.terrain=o,this.control=new It(s,document.body),this.audio=n,this.raycaster=new I,this.raycaster.far=8,this.far=this.player.body.height,this.initRayCaster(),this.initEventListeners()}moveX(t,s){this.camera.position.x+=t*(this.player.speed/Math.PI)*2*s}}class ee{constructor(){i(this,"p1",performance.now());i(this,"p2",performance.now());i(this,"gap",performance.now());i(this,"fps",document.createElement("div"));i(this,"count",0);i(this,"update",()=>{this.p1=performance.now(),this.count++,performance.now()-this.gap>1e3&&(this.fps.innerHTML=`FPS: ${this.count}`,this.gap=performance.now(),this.count=0),this.p2=this.p1});this.fps.className="fps",this.fps.innerHTML="FPS: 60",document.body.appendChild(this.fps)}}var ie="/dist/assets/grass.020eb145.png",se="/dist/assets/stone.53e38748.png",oe="/dist/assets/tree.98a9b0d4.png",ae="/dist/assets/wood.9768871f.png",ne="/dist/assets/diamond.b6171099.png",re="/dist/assets/quartz.9ffd1d51.png",le="/dist/assets/glass.3e48b289.png";class he{constructor(){i(this,"wheelGap",!1);i(this,"current",0);i(this,"icon",[ie,se,oe,ae,ne,re,le]);i(this,"iconIndex",0);i(this,"y",0);i(this,"bag",document.createElement("div"));i(this,"items",new Array(10).fill(null).map(()=>{let t=document.createElement("div");t.className="item";let s=document.createElement("img");return this.icon[this.iconIndex]&&(s.className="icon",s.alt="block",s.src=this.icon[this.iconIndex++],t.appendChild(s)),t}));if(!x){this.bag.className="bag",this.items[0].classList.add("selected");for(let t=0;t<this.items.length;t++)this.bag.appendChild(this.items[t]);document.body.appendChild(this.bag),document.body.addEventListener("keydown",t=>{if(!(isNaN(parseInt(t.key))||t.key==="0")){for(let s=0;s<this.items.length;s++)this.items[s].classList.remove("selected");this.current=parseInt(t.key)-1,this.items[this.current].classList.add("selected")}}),document.body.addEventListener("wheel",t=>{if(!this.wheelGap){this.wheelGap=!0,setTimeout(()=>{this.wheelGap=!1},100),t.deltaY>0?(this.current++,this.current>9&&(this.current=0)):t.deltaY<0&&(this.current--,this.current<0&&(this.current=9));for(let s=0;s<this.items.length;s++)this.items[s].classList.remove("selected");this.items[this.current].classList.add("selected")}})}}}var ce=`<div class="joystick">
<button id="action-front" class="joystick-button front" role="div">\u{1F53C}</button>
<button id="action-left" class="joystick-button left" role="div">\u25C0\uFE0F</button>
<button id="action-right" class="joystick-button right" role="div">\u25B6\uFE0F</button>
<button id="action-back" class="joystick-button back" role="div">\u{1F53D}</button>
<button id="action-mode" class="joystick-button mode" role="div">\u23F9\uFE0F</button>
<button id="action-up" class="joystick-button up" role="div">\u{1F53C}</button>
<button id="action-down" class="joystick-button down hidden" role="div">
\u{1F53D}
</button>
</div>
<style>
.joystick {
position: fixed;
bottom: 0;
display: grid;
width: 100%;
grid-template-columns: repeat(auto-fill, 50px);
grid-template-rows: repeat(3, 1fr);
gap: 10px;
padding: 10px;
}
.joystick-button {
width: 52px;
height: 50px;
font-size: 50px;
line-height: 50px;
padding: 0px;
border: none;
background-color: transparent;
}
.front {
grid-column: 2 / 3;
grid-row: 1;
}
.left {
grid-column: 1 / 2;
grid-row: 2;
}
.right {
grid-column: 3 / 4;
grid-row: 2;
}
.back {
grid-column: 2 / 3;
grid-row: 3;
}
.mode {
grid-column: 2 / 3;
grid-row: 2;
}
.up {
grid-column: -3 / -2;
grid-row: 2;
}
.down {
grid-column: -3 / -2;
grid-row: 3;
}
</style>
`;class de{constructor(t){i(this,"control");i(this,"pageX",0);i(this,"pageY",0);i(this,"clickX",0);i(this,"clickY",0);i(this,"euler");i(this,"clickTimeout");i(this,"clickInterval");i(this,"hold",!1);i(this,"emitKeyboardEvent",t=>({key:t}));i(this,"emitClickEvent",t=>({button:t,preventDefault:()=>{}}));i(this,"initButton",({actionKey:t,key:s})=>{const e=document.querySelector(`#action-${t}`);e.addEventListener("pointermove",o=>{o.stopPropagation()}),e.addEventListener("pointerdown",o=>{this.control.setMovementHandler(this.emitKeyboardEvent(s)),o.stopPropagation()}),e.addEventListener("pointerup",o=>{this.control.resetMovementHandler(this.emitKeyboardEvent(s)),o.stopPropagation()}),t==="mode"&&s==="q"&&(this.initButton({actionKey:"mode",key:" "}),e.addEventListener("pointerdown",()=>{var o,n;this.control.player.mode===b.flying?(o=document.querySelector("#action-down"))==null||o.classList.remove("hidden"):(n=document.querySelector("#action-down"))==null||n.classList.add("hidden")}))});i(this,"init",()=>{Qt(ce),this.initButton({actionKey:"front",key:"w"}),this.initButton({actionKey:"left",key:"a"}),this.initButton({actionKey:"right",key:"d"}),this.initButton({actionKey:"back",key:"s"}),this.initButton({actionKey:"mode",key:"q"}),this.initButton({actionKey:"up",key:" "}),this.initButton({actionKey:"down",key:"Shift"}),document.addEventListener("pointermove",t=>{(this.pageX!==0||this.pageY!==0)&&(this.euler.setFromQuaternion(this.control.camera.quaternion),this.euler.y-=.01*(t.pageX-this.pageX),this.euler.x-=.01*(t.pageY-this.pageY),this.euler.x=Math.max(-Math.PI/2,Math.min(Math.PI/2,this.euler.x)),this.control.camera.quaternion.setFromEuler(this.euler)),this.pageX=t.pageX,this.pageY=t.pageY,this.clickTimeout&&clearTimeout(this.clickTimeout)}),document.addEventListener("pointerdown",t=>{this.clickX=t.pageX,this.clickY=t.pageY,this.clickTimeout=setTimeout(()=>{t.pageX===this.clickX&&t.pageY===this.clickY&&(this.control.mousedownHandler(this.emitClickEvent(0)),this.clickInterval=setInterval(()=>{this.control.mousedownHandler(this.emitClickEvent(0))},333),this.hold=!0)},500)}),document.addEventListener("pointerup",t=>{this.clickTimeout&&clearTimeout(this.clickTimeout),this.clickInterval&&clearInterval(this.clickInterval),!this.hold&&t.pageX===this.clickX&&t.pageY===this.clickY&&this.control.mousedownHandler(this.emitClickEvent(2)),this.hold=!1,this.pageX=0,this.pageY=0})});this.control=t,this.euler=new Pt(0,0,0,"YXZ")}}class ue{constructor(t,s){i(this,"fps");i(this,"bag");i(this,"joystick");i(this,"menu",document.querySelector(".menu"));i(this,"crossHair",document.createElement("div"));i(this,"play",document.querySelector("#play"));i(this,"control",document.querySelector("#control"));i(this,"setting",document.querySelector("#setting"));i(this,"feature",document.querySelector("#feature"));i(this,"back",document.querySelector("#back"));i(this,"exit",document.querySelector("#exit"));i(this,"save",document.querySelector("#save"));i(this,"saveModal",document.querySelector(".save-modal"));i(this,"loadModal",document.querySelector(".load-modal"));i(this,"settings",document.querySelector(".settings"));i(this,"features",document.querySelector(".features"));i(this,"github",document.querySelector(".github"));i(this,"distance",document.querySelector("#distance"));i(this,"distanceInput",document.querySelector("#distance-input"));i(this,"fov",document.querySelector("#fov"));i(this,"fovInput",document.querySelector("#fov-input"));i(this,"music",document.querySelector("#music"));i(this,"musicInput",document.querySelector("#music-input"));i(this,"settingBack",document.querySelector("#setting-back"));i(this,"onPlay",()=>{var t,s,e;x&&this.joystick.init(),(t=this.menu)==null||t.classList.add("hidden"),(s=this.menu)==null||s.classList.remove("start"),this.play&&(this.play.innerHTML="Resume"),this.crossHair.classList.remove("hidden"),this.github&&this.github.classList.add("hidden"),(e=this.feature)==null||e.classList.add("hidden")});i(this,"onPause",()=>{var t;(t=this.menu)==null||t.classList.remove("hidden"),this.crossHair.classList.add("hidden"),this.save&&(this.save.innerHTML="Save and Exit"),this.github&&this.github.classList.remove("hidden")});i(this,"onExit",()=>{var t,s;(t=this.menu)==null||t.classList.add("start"),this.play&&(this.play.innerHTML="Play"),this.save&&(this.save.innerHTML="Load Game"),(s=this.feature)==null||s.classList.remove("hidden")});i(this,"onSave",()=>{var t;(t=this.saveModal)==null||t.classList.remove("hidden"),setTimeout(()=>{var s;(s=this.saveModal)==null||s.classList.add("show")}),setTimeout(()=>{var s;(s=this.saveModal)==null||s.classList.remove("show")},1e3),setTimeout(()=>{var s;(s=this.saveModal)==null||s.classList.add("hidden")},1350)});i(this,"onLoad",()=>{var t;(t=this.loadModal)==null||t.classList.remove("hidden"),setTimeout(()=>{var s;(s=this.loadModal)==null||s.classList.add("show")}),setTimeout(()=>{var s;(s=this.loadModal)==null||s.classList.remove("show")},1e3),setTimeout(()=>{var s;(s=this.loadModal)==null||s.classList.add("hidden")},1350)});i(this,"update",()=>{this.fps.update()});var e,o,n,d,l,h,g,u,p,M,C,c;this.fps=new ee,this.bag=new he,this.joystick=new de(s),this.crossHair.className="cross-hair",this.crossHair.innerHTML="+",document.body.appendChild(this.crossHair),(e=this.play)==null||e.addEventListener("click",()=>{var r;((r=this.play)==null?void 0:r.innerHTML)==="Play"&&(this.onPlay(),t.noise.seed=Math.random(),t.noise.stoneSeed=Math.random(),t.noise.treeSeed=Math.random(),t.noise.coalSeed=Math.random(),t.noise.leafSeed=Math.random(),t.customBlocks=[],t.initBlocks(),t.generate(),t.camera.position.y=40,s.player.setMode(b.walking)),!x&&s.control.lock()}),(o=this.save)==null||o.addEventListener("click",()=>{var r,z,U,W;if(((r=this.save)==null?void 0:r.innerHTML)==="Save and Exit")window.localStorage.setItem("block",JSON.stringify(t.customBlocks)),window.localStorage.setItem("seed",JSON.stringify(t.noise.seed)),window.localStorage.setItem("position",JSON.stringify({x:t.camera.position.x,y:t.camera.position.y,z:t.camera.position.z})),this.onExit(),this.onSave();else{t.noise.seed=(z=Number(window.localStorage.getItem("seed")))!=null?z:Math.random();const pt=(U=JSON.parse(window.localStorage.getItem("block")||"null"))!=null?U:[];t.customBlocks=pt,t.initBlocks(),t.generate();const E=(W=JSON.parse(window.localStorage.getItem("position")||"null"))!=null?W:null;E&&(t.camera.position.x=E.x),E&&(t.camera.position.y=E.y),E&&(t.camera.position.z=E.z),this.onPlay(),this.onLoad(),!x&&s.control.lock()}}),(n=this.feature)==null||n.addEventListener("click",()=>{var r;(r=this.features)==null||r.classList.remove("hidden")}),(d=this.back)==null||d.addEventListener("click",()=>{var r;(r=this.features)==null||r.classList.add("hidden")}),(l=this.setting)==null||l.addEventListener("click",()=>{var r;(r=this.settings)==null||r.classList.remove("hidden")}),(h=this.settingBack)==null||h.addEventListener("click",()=>{var r;(r=this.settings)==null||r.classList.add("hidden")}),(g=this.distanceInput)==null||g.addEventListener("input",r=>{this.distance&&r.target instanceof HTMLInputElement&&(this.distance.innerHTML=`Render Distance: ${r.target.value}`)}),(u=this.fovInput)==null||u.addEventListener("input",r=>{this.fov&&r.target instanceof HTMLInputElement&&(this.fov.innerHTML=`Field of View: ${r.target.value}`,s.camera.fov=parseInt(r.target.value),s.camera.updateProjectionMatrix())}),(p=this.musicInput)==null||p.addEventListener("input",r=>{if(this.fov&&r.target instanceof HTMLInputElement){const z=r.target.value==="0";s.audio.disabled=z,this.music.innerHTML=`Music: ${z?"Off":"On"}`}}),(M=this.settingBack)==null||M.addEventListener("click",()=>{this.distanceInput instanceof HTMLInputElement&&(t.distance=parseInt(this.distanceInput.value),t.maxCount=(t.distance*t.chunkSize*2+t.chunkSize)**2+500,t.initBlocks(),t.generate(),t.scene.fog=new st(8900331,1,t.distance*24+24))}),document.body.addEventListener("keydown",r=>{r.key==="e"&&document.pointerLockElement&&!x&&s.control.unlock(),r.key==="f"&&(document.fullscreenElement?document.exitFullscreen():document.body.requestFullscreen())}),(C=this.exit)==null||C.addEventListener("click",()=>{this.onExit()}),document.addEventListener("pointerlockchange",()=>{document.pointerLockElement?this.onPlay():this.onPause()}),document.addEventListener("contextmenu",r=>{r.preventDefault()}),(c=document.querySelector("canvas"))==null||c.addEventListener("click",r=>{r.preventDefault(),!x&&s.control.lock()})}}var me="/dist/assets/hal3.2642662e.ogg",ge="/dist/assets/grass1.3619fdb8.ogg",fe="/dist/assets/grass2.b0763cf2.ogg",ye="/dist/assets/grass3.9ac02803.ogg",pe="/dist/assets/grass4.dd733357.ogg",ve="/dist/assets/sand1.1260ef32.ogg",ke="/dist/assets/sand2.74ef2fa1.ogg",we="/dist/assets/sand3.0441e996.ogg",be="/dist/assets/sand4.42ac9116.ogg",H="/dist/assets/stone1.97f2a8a7.ogg",A="/dist/assets/stone2.98a5c319.ogg",j="/dist/assets/stone3.19273f0e.ogg",B="/dist/assets/stone4.b164e732.ogg",Me="/dist/assets/dirt1.55a610c8.ogg",xe="/dist/assets/dirt2.60ebf0ed.ogg",Ce="/dist/assets/dirt3.ab5e4b40.ogg",Ie="/dist/assets/dirt4.fd4aa755.ogg",Q="/dist/assets/tree1.cb6071c8.ogg",tt="/dist/assets/tree2.59edca84.ogg",et="/dist/assets/tree3.cf6be231.ogg",it="/dist/assets/tree4.de868b31.ogg",Pe="/dist/assets/leaf1.74400cfe.ogg",ze="/dist/assets/leaf2.b7636085.ogg",Le="/dist/assets/leaf3.6228533c.ogg",Se="/dist/assets/leaf4.72db3634.ogg";class Ee{constructor(t){i(this,"disabled",!1);i(this,"sourceSet",[[ge,fe,ye,pe],[ve,ke,we,be],[Q,tt,et,it],[Pe,ze,Le,Se],[Me,xe,Ce,Ie],[H,A,j,B],[H,A,j,B],[Q,tt,et,it],[H,A,j,B],[H,A,j,B],[H,A,j,B]]);i(this,"soundSet",[]);i(this,"index",0);if(x)return;const s=new zt,e=new Lt;t.add(s);const o=new V(s);o.autoplay=!1,e.load(me,n=>{o.setBuffer(n),o.setVolume(.1),o.setLoop(!0),o.isPlaying&&(o.pause(),o.play())}),document.addEventListener("pointerlockchange",()=>{document.pointerLockElement&&!o.isPlaying&&!this.disabled?o.play():o.pause()});for(const n of this.sourceSet){const d=[];for(const l of n)e.load(l,h=>{const g=new V(s);g.setBuffer(h),g.setVolume(.15),d.push(g)});this.soundSet.push(d)}}playSound(t){var s,e;!this.disabled&&!x&&(this.index++===3&&(this.index=0),(e=(s=this.soundSet[t])==null?void 0:s[this.index])==null||e.play())}}const T=new Et,O=T.camera,Y=T.scene,Fe=T.renderer,He=new Ft,Ae=new Ee(O),D=new Vt(Y,O),yt=new te(Y,O,He,D,Ae),je=new ue(D,yt);(function a(){requestAnimationFrame(a),yt.update(),D.update(),je.update(),Fe.render(Y,O)})();
//# sourceMappingURL=index.3d64fa62.js.map
{"version":3,"file":"index.3d64fa62.js","sources":["../../vite/modulepreload-polyfill","../../src/core/index.ts","../../src/player/index.ts","../../src/static/textures/block/stone.png","../../src/static/textures/block/coal_ore.png","../../src/static/textures/block/iron_ore.png","../../src/static/textures/block/grass_block_side.png","../../src/static/textures/block/grass_top_green.png","../../src/static/textures/block/dirt.png","../../src/static/textures/block/oak_log.png","../../src/static/textures/block/oak_log_top.png","../../src/static/textures/block/oak_leaves.png","../../src/static/textures/block/sand.png","../../src/static/textures/block/oak_planks.png","../../src/static/textures/block/diamond_block.png","../../src/static/textures/block/quartz_block_side.png","../../src/static/textures/block/glass.png","../../src/static/textures/block/bedrock.png","../../src/terrain/mesh/materials.ts","../../src/terrain/mesh/block.ts","../../src/terrain/highlight/index.ts","../../src/terrain/noise/index.ts","../../src/terrain/index.ts","../../src/utils/index.ts","../../src/control/index.ts","../../src/ui/fps/index.ts","../../src/static/block-icon/grass.png","../../src/static/block-icon/stone.png","../../src/static/block-icon/tree.png","../../src/static/block-icon/wood.png","../../src/static/block-icon/diamond.png","../../src/static/block-icon/quartz.png","../../src/static/block-icon/glass.png","../../src/ui/bag/index.ts","../../src/ui/joystick/joystick.html?raw","../../src/ui/joystick/index.ts","../../src/ui/index.ts","../../src/audio/musics/hal3.ogg","../../src/audio/blocks/grass1.ogg","../../src/audio/blocks/grass2.ogg","../../src/audio/blocks/grass3.ogg","../../src/audio/blocks/grass4.ogg","../../src/audio/blocks/sand1.ogg","../../src/audio/blocks/sand2.ogg","../../src/audio/blocks/sand3.ogg","../../src/audio/blocks/sand4.ogg","../../src/audio/blocks/stone1.ogg","../../src/audio/blocks/stone2.ogg","../../src/audio/blocks/stone3.ogg","../../src/audio/blocks/stone4.ogg","../../src/audio/blocks/dirt1.ogg","../../src/audio/blocks/dirt2.ogg","../../src/audio/blocks/dirt3.ogg","../../src/audio/blocks/dirt4.ogg","../../src/audio/blocks/tree1.ogg","../../src/audio/blocks/tree2.ogg","../../src/audio/blocks/tree3.ogg","../../src/audio/blocks/tree4.ogg","../../src/audio/blocks/leaf1.ogg","../../src/audio/blocks/leaf2.ogg","../../src/audio/blocks/leaf3.ogg","../../src/audio/blocks/leaf4.ogg","../../src/audio/index.ts","../../src/main.ts"],"sourcesContent":["const p = function polyfill() {\n const relList = document.createElement('link').relList;\n if (relList && relList.supports && relList.supports('modulepreload')) {\n return;\n }\n for (const link of document.querySelectorAll('link[rel=\"modulepreload\"]')) {\n processPreload(link);\n }\n new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n if (mutation.type !== 'childList') {\n continue;\n }\n for (const node of mutation.addedNodes) {\n if (node.tagName === 'LINK' && node.rel === 'modulepreload')\n processPreload(node);\n }\n }\n }).observe(document, { childList: true, subtree: true });\n function getFetchOpts(script) {\n const fetchOpts = {};\n if (script.integrity)\n fetchOpts.integrity = script.integrity;\n if (script.referrerpolicy)\n fetchOpts.referrerPolicy = script.referrerpolicy;\n if (script.crossorigin === 'use-credentials')\n fetchOpts.credentials = 'include';\n else if (script.crossorigin === 'anonymous')\n fetchOpts.credentials = 'omit';\n else\n fetchOpts.credentials = 'same-origin';\n return fetchOpts;\n }\n function processPreload(link) {\n if (link.ep)\n // ep marker = processed\n return;\n link.ep = true;\n // prepopulate the load record\n const fetchOpts = getFetchOpts(link);\n fetch(link.href, fetchOpts);\n }\n};__VITE_IS_MODERN__&&p();","import * as THREE from 'three'\n\nexport default class Core {\n constructor() {\n this.camera = new THREE.PerspectiveCamera()\n this.renderer = new THREE.WebGLRenderer()\n this.scene = new THREE.Scene()\n this.initScene()\n this.initRenderer()\n this.initCamera()\n }\n\n camera: THREE.PerspectiveCamera\n scene: THREE.Scene\n renderer: THREE.Renderer\n\n initCamera = () => {\n this.camera.fov = 50\n this.camera.aspect = window.innerWidth / window.innerHeight\n this.camera.near = 0.01\n this.camera.far = 500\n this.camera.updateProjectionMatrix()\n this.camera.position.set(8, 50, 8)\n\n this.camera.lookAt(100, 30, 100)\n\n window.addEventListener('resize', () => {\n this.camera.aspect = window.innerWidth / window.innerHeight\n this.camera.updateProjectionMatrix()\n })\n }\n\n initScene = () => {\n this.scene = new THREE.Scene()\n const backgroundColor = 0x87ceeb\n\n this.scene.fog = new THREE.Fog(backgroundColor, 1, 96)\n this.scene.background = new THREE.Color(backgroundColor)\n\n const sunLight = new THREE.PointLight(0xffffff, 0.5)\n sunLight.position.set(500, 500, 500)\n this.scene.add(sunLight)\n\n const sunLight2 = new THREE.PointLight(0xffffff, 0.2)\n sunLight2.position.set(-500, 500, -500)\n this.scene.add(sunLight2)\n\n const reflectionLight = new THREE.AmbientLight(0x404040)\n this.scene.add(reflectionLight)\n }\n\n initRenderer = () => {\n this.renderer.setSize(window.innerWidth, window.innerHeight)\n document.body.appendChild(this.renderer.domElement)\n\n window.addEventListener('resize', () => {\n this.renderer.setSize(window.innerWidth, window.innerHeight)\n })\n }\n}\n","export enum Mode {\n walking = 'walking',\n sprinting = 'sprinting',\n flying = 'flying',\n sprintFlying = 'sprintFlying',\n sneaking = 'sneaking'\n}\n\nexport enum Speed {\n // walking = 4.317,\n walking = 5.612,\n sprinting = 5.612,\n // flying = 10.89,\n flying = 21.78,\n sprintFlying = 21.78,\n sneaking = 1.95\n}\nexport default class Player {\n mode = Mode.walking\n speed = Speed[this.mode]\n\n setMode(Mode: Mode) {\n this.mode = Mode\n this.speed = Speed[this.mode]\n }\n falling = 38.4\n\n jump = 1.2522\n\n body = {\n height: 1.8,\n width: 0.5\n }\n}\n","export default \"__VITE_ASSET__fa5e82cb__\"","export default \"__VITE_ASSET__29c9a29e__\"","export default \"__VITE_ASSET__78230e9e__\"","export default \"__VITE_ASSET__1f5d4845__\"","export default \"__VITE_ASSET__be9cf310__\"","export default \"__VITE_ASSET__fb045025__\"","export default \"__VITE_ASSET__fc1a2462__\"","export default \"__VITE_ASSET__6a68c340__\"","export default \"__VITE_ASSET__776aee85__\"","export default \"__VITE_ASSET__f4bf1751__\"","export default \"__VITE_ASSET__be4a7f91__\"","export default \"__VITE_ASSET__fb45cc99__\"","export default \"__VITE_ASSET__0e4d401c__\"","export default \"__VITE_ASSET__17e849a2__\"","export default \"__VITE_ASSET__3e3a8330__\"","import * as THREE from 'three'\nimport stone from '../../static/textures/block/stone.png'\nimport coal_ore from '../../static/textures/block/coal_ore.png'\nimport iron_ore from '../../static/textures/block/iron_ore.png'\nimport grass_side from '../../static/textures/block/grass_block_side.png'\nimport grass_top_green from '../../static/textures/block/grass_top_green.png'\nimport dirt from '../../static/textures/block/dirt.png'\nimport oak_log from '../../static/textures/block/oak_log.png'\nimport oak_log_top from '../../static/textures/block/oak_log_top.png'\nimport oak_leaves from '../../static/textures/block/oak_leaves.png'\nimport sand from '../../static/textures/block/sand.png'\n// import water from '../../static/textures/block/water.png'\nimport oak_wood from '../../static/textures/block/oak_planks.png'\nimport diamond from '../../static/textures/block/diamond_block.png'\nimport quartz from '../../static/textures/block/quartz_block_side.png'\nimport glass from '../../static/textures/block/glass.png'\nimport bedrock from '../../static/textures/block/bedrock.png'\n\nexport enum MaterialType {\n grass = 'grass',\n dirt = 'dirt',\n tree = 'tree',\n leaf = 'leaf',\n sand = 'sand',\n // water = 'water',\n stone = 'stone',\n coal = 'coal',\n wood = 'wood',\n diamond = 'diamond',\n quartz = 'quartz',\n glass = 'glass',\n bedrock = 'bedrock'\n}\nlet loader = new THREE.TextureLoader()\n\n// load texture\nconst grassTopMaterial = loader.load(grass_top_green)\nconst grassMaterial = loader.load(grass_side)\nconst treeMaterial = loader.load(oak_log)\nconst treeTopMaterial = loader.load(oak_log_top)\nconst dirtMaterial = loader.load(dirt)\nconst stoneMaterial = loader.load(stone)\nconst coalMaterial = loader.load(coal_ore)\nconst ironMaterial = loader.load(iron_ore)\nconst leafMaterial = loader.load(oak_leaves)\nconst sandMaterial = loader.load(sand)\n// const waterMaterial = loader.load(water)\nconst woodMaterial = loader.load(oak_wood)\nconst diamondMaterial = loader.load(diamond)\nconst quartzMaterial = loader.load(quartz)\nconst glassMaterial = loader.load(glass)\nconst bedrockMaterial = loader.load(bedrock)\n\n// pixelate texture\ngrassTopMaterial.magFilter = THREE.NearestFilter\ngrassMaterial.magFilter = THREE.NearestFilter\ntreeMaterial.magFilter = THREE.NearestFilter\ntreeTopMaterial.magFilter = THREE.NearestFilter\ndirtMaterial.magFilter = THREE.NearestFilter\nstoneMaterial.magFilter = THREE.NearestFilter\ncoalMaterial.magFilter = THREE.NearestFilter\nironMaterial.magFilter = THREE.NearestFilter\nleafMaterial.magFilter = THREE.NearestFilter\nsandMaterial.magFilter = THREE.NearestFilter\n// waterMaterial.magFilter = THREE.NearestFilter\nwoodMaterial.magFilter = THREE.NearestFilter\ndiamondMaterial.magFilter = THREE.NearestFilter\nquartzMaterial.magFilter = THREE.NearestFilter\nglassMaterial.magFilter = THREE.NearestFilter\nbedrockMaterial.magFilter = THREE.NearestFilter\n\nexport default class Materials {\n materials = {\n grass: [\n new THREE.MeshStandardMaterial({ map: grassMaterial }),\n new THREE.MeshStandardMaterial({ map: grassMaterial }),\n new THREE.MeshStandardMaterial({\n map: grassTopMaterial\n }),\n new THREE.MeshStandardMaterial({ map: dirtMaterial }),\n new THREE.MeshStandardMaterial({ map: grassMaterial }),\n new THREE.MeshStandardMaterial({ map: grassMaterial })\n ],\n dirt: new THREE.MeshStandardMaterial({ map: dirtMaterial }),\n sand: new THREE.MeshStandardMaterial({ map: sandMaterial }),\n tree: [\n new THREE.MeshStandardMaterial({ map: treeMaterial }),\n new THREE.MeshStandardMaterial({ map: treeMaterial }),\n new THREE.MeshStandardMaterial({ map: treeTopMaterial }),\n new THREE.MeshStandardMaterial({ map: treeTopMaterial }),\n new THREE.MeshStandardMaterial({ map: treeMaterial }),\n new THREE.MeshStandardMaterial({ map: treeMaterial })\n ],\n leaf: new THREE.MeshStandardMaterial({\n map: leafMaterial,\n color: new THREE.Color(0, 1, 0),\n transparent: true\n }),\n // water: new THREE.MeshStandardMaterial({\n // map: waterMaterial,\n // transparent: true,\n // opacity: 0.7\n // }),\n stone: new THREE.MeshStandardMaterial({ map: stoneMaterial }),\n coal: new THREE.MeshStandardMaterial({ map: coalMaterial }),\n wood: new THREE.MeshStandardMaterial({ map: woodMaterial }),\n diamond: new THREE.MeshStandardMaterial({ map: diamondMaterial }),\n quartz: new THREE.MeshStandardMaterial({ map: quartzMaterial }),\n glass: new THREE.MeshStandardMaterial({\n map: glassMaterial,\n transparent: true\n }),\n bedrock: new THREE.MeshStandardMaterial({ map: bedrockMaterial })\n }\n\n get = (\n type: MaterialType\n ): THREE.MeshStandardMaterial | THREE.MeshStandardMaterial[] => {\n return this.materials[type]\n }\n}\n","import { BlockType } from '../index'\n\n/**\n * Custom block\n */\nexport default class Block {\n object: any\n constructor(\n x: number,\n y: number,\n z: number,\n type: BlockType,\n placed: boolean\n ) {\n this.x = x\n this.y = y\n this.z = z\n this.type = type\n this.placed = placed\n }\n x: number\n y: number\n z: number\n type: BlockType\n placed: boolean\n}\n","import * as THREE from 'three'\nimport Terrain from '..'\n\n/**\n * Highlight block on crosshair\n */\nexport default class BlockHighlight {\n constructor(\n scene: THREE.Scene,\n camera: THREE.PerspectiveCamera,\n terrain: Terrain\n ) {\n this.camera = camera\n this.scene = scene\n this.terrain = terrain\n this.raycaster = new THREE.Raycaster()\n this.raycaster.far = 8\n }\n\n scene: THREE.Scene\n camera: THREE.PerspectiveCamera\n terrain: Terrain\n raycaster: THREE.Raycaster\n block: THREE.Intersection | null = null\n\n // highlight block mesh\n geometry = new THREE.BoxGeometry(1.01, 1.01, 1.01)\n material = new THREE.MeshStandardMaterial({\n transparent: true,\n opacity: 0.25\n // depthWrite: false\n })\n mesh = new THREE.Mesh(new THREE.BoxGeometry(), this.material)\n\n // block simulation\n index = 0\n instanceMesh = new THREE.InstancedMesh(\n new THREE.BoxGeometry(),\n new THREE.MeshBasicMaterial(),\n 1000\n )\n\n update() {\n // remove last highlight and reset block simulation\n this.scene.remove(this.mesh)\n this.index = 0\n this.instanceMesh.instanceMatrix = new THREE.InstancedBufferAttribute(\n new Float32Array(1000 * 16),\n 16\n )\n\n const position = this.camera.position\n const matrix = new THREE.Matrix4()\n const idMap = new Map<string, number>()\n const noise = this.terrain.noise\n\n let xPos = Math.round(position.x)\n let zPos = Math.round(position.z)\n\n for (let i = -8; i < 8; i++) {\n for (let j = -8; j < 8; j++) {\n // check terrain\n let x = xPos + i\n let z = zPos + j\n let y =\n Math.floor(\n noise.get(x / noise.gap, z / noise.gap, noise.seed) * noise.amp\n ) + 30\n\n idMap.set(`${x}_${y}_${z}`, this.index)\n matrix.setPosition(x, y, z)\n this.instanceMesh.setMatrixAt(this.index++, matrix)\n\n let stoneOffset =\n noise.get(x / noise.stoneGap, z / noise.stoneGap, noise.stoneSeed) *\n noise.stoneAmp\n\n let treeOffset =\n noise.get(x / noise.treeGap, z / noise.treeGap, noise.treeSeed) *\n noise.treeAmp\n\n // check tree\n if (\n treeOffset > noise.treeThreshold &&\n y - 30 >= -3 &&\n stoneOffset < noise.stoneThreshold\n ) {\n for (let t = 1; t <= noise.treeHeight; t++) {\n idMap.set(`${x}_${y + t}_${z}`, this.index)\n matrix.setPosition(x, y + t, z)\n this.instanceMesh.setMatrixAt(this.index++, matrix)\n }\n\n // leaf\n // for (let i = -3; i < 3; i++) {\n // for (let j = -3; j < 3; j++) {\n // for (let k = -3; k < 3; k++) {\n // if (i === 0 && k === 0) {\n // continue\n // }\n // let leafOffset =\n // noise.get(\n // (x + i + j) / noise.leafGap,\n // (z + k) / noise.leafGap,\n // noise.leafSeed\n // ) * noise.leafAmp\n\n // if (leafOffset > noise.leafThreshold) {\n // idMap.set(\n // `${x + i}_${y + noise.treeHeight + j}_${z + k}`,\n // this.index\n // )\n // matrix.setPosition(x + i, y + noise.treeHeight + j, z + k)\n // this.instanceMesh.setMatrixAt(this.index++, matrix)\n // }\n // }\n // }\n // }\n }\n }\n }\n\n // check custom blocks\n for (const block of this.terrain.customBlocks) {\n if (block.placed) {\n matrix.setPosition(block.x, block.y, block.z)\n this.instanceMesh.setMatrixAt(this.index++, matrix)\n } else {\n if (idMap.has(`${block.x}_${block.y}_${block.z}`)) {\n let id = idMap.get(`${block.x}_${block.y}_${block.z}`)\n this.instanceMesh.setMatrixAt(\n id!,\n new THREE.Matrix4().set(\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0\n )\n )\n }\n }\n }\n\n // highlight new block\n this.raycaster.setFromCamera({ x: 0, y: 0 }, this.camera)\n this.block = this.raycaster.intersectObject(this.instanceMesh)[0]\n if (\n this.block &&\n this.block.object instanceof THREE.InstancedMesh &&\n typeof this.block.instanceId === 'number'\n ) {\n this.mesh = new THREE.Mesh(this.geometry, this.material)\n let matrix = new THREE.Matrix4()\n this.block.object.getMatrixAt(this.block.instanceId, matrix)\n const position = new THREE.Vector3().setFromMatrixPosition(matrix)\n\n this.mesh.position.set(position.x, position.y, position.z)\n this.scene.add(this.mesh)\n }\n }\n}\n","import { ImprovedNoise } from 'three/examples/jsm/math/ImprovedNoise'\n// import { SimplexNoise } from 'three/examples/jsm/math/SimplexNoise'\n\nexport default class Noise {\n noise = new ImprovedNoise()\n seed = Math.random()\n gap = 22\n amp = 8\n\n stoneSeed = this.seed * 0.4\n stoneGap = 12\n stoneAmp = 8\n stoneThreshold = 3.5\n\n coalSeed = this.seed * 0.5\n coalGap = 3\n coalAmp = 8\n coalThreshold = 3\n\n treeSeed = this.seed * 0.7\n treeGap = 2\n treeAmp = 6\n treeHeight = 10\n treeThreshold = 4\n\n leafSeed = this.seed * 0.8\n leafGap = 2\n leafAmp = 5\n leafThreshold = -0.03\n\n get = (x: number, y: number, z: number) => {\n return this.noise.noise(x, y, z)\n }\n}\n","import * as THREE from 'three'\nimport Materials, { MaterialType } from './mesh/materials'\nimport Block from './mesh/block'\nimport Highlight from './highlight'\nimport Noise from './noise'\n\nimport Generate from './worker/generate?worker'\n\nexport enum BlockType {\n grass = 0,\n sand = 1,\n tree = 2,\n leaf = 3,\n dirt = 4,\n stone = 5,\n coal = 6,\n wood = 7,\n diamond = 8,\n quartz = 9,\n glass = 10,\n bedrock = 11\n}\nexport default class Terrain {\n constructor(scene: THREE.Scene, camera: THREE.PerspectiveCamera) {\n this.scene = scene\n this.camera = camera\n this.maxCount =\n (this.distance * this.chunkSize * 2 + this.chunkSize) ** 2 + 500\n this.highlight = new Highlight(scene, camera, this)\n this.scene.add(this.cloud)\n\n // generate worker callback handler\n this.generateWorker.onmessage = (\n msg: MessageEvent<{\n idMap: Map<string, number>\n arrays: ArrayLike<number>[]\n blocksCount: number[]\n }>\n ) => {\n this.resetBlocks()\n this.idMap = msg.data.idMap\n this.blocksCount = msg.data.blocksCount\n\n for (let i = 0; i < msg.data.arrays.length; i++) {\n this.blocks[i].instanceMatrix = new THREE.InstancedBufferAttribute(\n (this.blocks[i].instanceMatrix.array = msg.data.arrays[i]),\n 16\n )\n }\n\n for (const block of this.blocks) {\n block.instanceMatrix.needsUpdate = true\n }\n }\n }\n // core properties\n scene: THREE.Scene\n camera: THREE.PerspectiveCamera\n distance = 3\n chunkSize = 24\n\n // terrain properties\n maxCount: number\n chunk = new THREE.Vector2(0, 0)\n previousChunk = new THREE.Vector2(0, 0)\n noise = new Noise()\n\n // materials\n materials = new Materials()\n materialType = [\n MaterialType.grass,\n MaterialType.sand,\n MaterialType.tree,\n MaterialType.leaf,\n MaterialType.dirt,\n MaterialType.stone,\n MaterialType.coal,\n MaterialType.wood,\n MaterialType.diamond,\n MaterialType.quartz,\n MaterialType.glass,\n MaterialType.bedrock\n ]\n\n // other properties\n blocks: THREE.InstancedMesh[] = []\n blocksCount: number[] = []\n blocksFactor = [1, 0.2, 0.1, 0.7, 0.1, 0.2, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1]\n\n customBlocks: Block[] = []\n highlight: Highlight\n\n idMap = new Map<string, number>()\n generateWorker = new Generate()\n\n // cloud\n cloud = new THREE.InstancedMesh(\n new THREE.BoxGeometry(20, 5, 14),\n new THREE.MeshStandardMaterial({\n transparent: true,\n color: 0xffffff,\n opacity: 0.4\n }),\n 1000\n )\n cloudCount = 0\n cloudGap = 5\n\n getCount = (type: BlockType) => {\n return this.blocksCount[type]\n }\n\n setCount = (type: BlockType) => {\n this.blocksCount[type] = this.blocksCount[type] + 1\n }\n\n initBlocks = () => {\n // reset\n for (const block of this.blocks) {\n this.scene.remove(block)\n }\n this.blocks = []\n\n // create instance meshes\n const geometry = new THREE.BoxGeometry()\n\n for (let i = 0; i < this.materialType.length; i++) {\n let block = new THREE.InstancedMesh(\n geometry,\n this.materials.get(this.materialType[i]),\n this.maxCount * this.blocksFactor[i]\n )\n block.name = BlockType[i]\n this.blocks.push(block)\n this.scene.add(block)\n }\n\n this.blocksCount = new Array(this.materialType.length).fill(0)\n }\n\n resetBlocks = () => {\n // reest count and instance matrix\n for (let i = 0; i < this.blocks.length; i++) {\n this.blocks[i].instanceMatrix = new THREE.InstancedBufferAttribute(\n new Float32Array(this.maxCount * this.blocksFactor[i] * 16),\n 16\n )\n }\n }\n\n generate = () => {\n this.blocksCount = new Array(this.blocks.length).fill(0)\n // post work to generate worker\n this.generateWorker.postMessage({\n distance: this.distance,\n chunk: this.chunk,\n noiseSeed: this.noise.seed,\n treeSeed: this.noise.treeSeed,\n stoneSeed: this.noise.stoneSeed,\n coalSeed: this.noise.coalSeed,\n idMap: new Map<string, number>(),\n blocksFactor: this.blocksFactor,\n blocksCount: this.blocksCount,\n customBlocks: this.customBlocks,\n chunkSize: this.chunkSize\n })\n\n // cloud\n\n if (this.cloudGap++ > 5) {\n this.cloudGap = 0\n this.cloud.instanceMatrix = new THREE.InstancedBufferAttribute(\n new Float32Array(1000 * 16),\n 16\n )\n this.cloudCount = 0\n for (\n let x =\n -this.chunkSize * this.distance * 3 + this.chunkSize * this.chunk.x;\n x <\n this.chunkSize * this.distance * 3 +\n this.chunkSize +\n this.chunkSize * this.chunk.x;\n x += 20\n ) {\n for (\n let z =\n -this.chunkSize * this.distance * 3 + this.chunkSize * this.chunk.y;\n z <\n this.chunkSize * this.distance * 3 +\n this.chunkSize +\n this.chunkSize * this.chunk.y;\n z += 20\n ) {\n const matrix = new THREE.Matrix4()\n matrix.setPosition(x, 80 + (Math.random() - 0.5) * 30, z)\n\n if (Math.random() > 0.8) {\n this.cloud.setMatrixAt(this.cloudCount++, matrix)\n }\n }\n }\n this.cloud.instanceMatrix.needsUpdate = true\n }\n }\n\n // generate adjacent blocks after removing a block (vertical infinity world)\n generateAdjacentBlocks = (position: THREE.Vector3) => {\n const { x, y, z } = position\n const noise = this.noise\n const yOffset = Math.floor(\n noise.get(x / noise.gap, z / noise.gap, noise.seed) * noise.amp\n )\n\n if (y > 30 + yOffset) {\n return\n }\n\n const stoneOffset =\n noise.get(x / noise.stoneGap, z / noise.stoneGap, noise.stoneSeed) *\n noise.stoneAmp\n\n let type: BlockType\n\n if (stoneOffset > noise.stoneThreshold || y < 23) {\n type = BlockType.stone\n } else {\n if (yOffset < -3) {\n type = BlockType.sand\n } else {\n type = BlockType.dirt\n }\n }\n\n this.buildBlock(new THREE.Vector3(x, y - 1, z), type)\n this.buildBlock(new THREE.Vector3(x, y + 1, z), type)\n this.buildBlock(new THREE.Vector3(x - 1, y, z), type)\n this.buildBlock(new THREE.Vector3(x + 1, y, z), type)\n this.buildBlock(new THREE.Vector3(x, y, z - 1), type)\n this.buildBlock(new THREE.Vector3(x, y, z + 1), type)\n\n this.blocks[type].instanceMatrix.needsUpdate = true\n }\n\n buildBlock = (position: THREE.Vector3, type: BlockType) => {\n const noise = this.noise\n // check if it's natural terrain\n const yOffset = Math.floor(\n noise.get(position.x / noise.gap, position.z / noise.gap, noise.seed) *\n noise.amp\n )\n if (position.y >= 30 + yOffset || position.y < 0) {\n return\n }\n\n position.y === 0 && (type = BlockType.bedrock)\n\n // check custom blocks\n for (const block of this.customBlocks) {\n if (\n block.x === position.x &&\n block.y === position.y &&\n block.z === position.z\n ) {\n return\n }\n }\n\n // build block\n this.customBlocks.push(\n new Block(position.x, position.y, position.z, type, true)\n )\n\n const matrix = new THREE.Matrix4()\n matrix.setPosition(position)\n this.blocks[type].setMatrixAt(this.getCount(type), matrix)\n this.blocks[type].instanceMatrix.needsUpdate = true\n this.setCount(type)\n }\n\n update = () => {\n this.chunk.set(\n Math.floor(this.camera.position.x / this.chunkSize),\n Math.floor(this.camera.position.z / this.chunkSize)\n )\n\n //generate terrain when getting into new chunk\n if (\n this.chunk.x !== this.previousChunk.x ||\n this.chunk.y !== this.previousChunk.y\n ) {\n this.generate()\n }\n\n this.previousChunk.copy(this.chunk)\n\n this.highlight.update()\n }\n}\n","export const htmlToDom = (html: string) => {\n const templateDom = document.createElement('template')\n templateDom.innerHTML = html\n window.document.body.appendChild(templateDom.content)\n}\n\nexport const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(\n navigator.userAgent\n)\n","import * as THREE from 'three'\nimport { PointerLockControls } from 'three/examples/jsm/controls/PointerLockControls'\nimport Player, { Mode } from '../player'\nimport Terrain, { BlockType } from '../terrain'\n\nimport Block from '../terrain/mesh/block'\nimport Noise from '../terrain/noise'\nimport Audio from '../audio'\nimport { isMobile } from '../utils'\nenum Side {\n front,\n back,\n left,\n right,\n down,\n up\n}\n\nexport default class Control {\n constructor(\n scene: THREE.Scene,\n camera: THREE.PerspectiveCamera,\n player: Player,\n terrain: Terrain,\n audio: Audio\n ) {\n this.scene = scene\n this.camera = camera\n this.player = player\n this.terrain = terrain\n this.control = new PointerLockControls(camera, document.body)\n this.audio = audio\n\n this.raycaster = new THREE.Raycaster()\n this.raycaster.far = 8\n this.far = this.player.body.height\n\n this.initRayCaster()\n this.initEventListeners()\n }\n\n // core properties\n scene: THREE.Scene\n camera: THREE.PerspectiveCamera\n player: Player\n terrain: Terrain\n control: PointerLockControls\n audio: Audio\n velocity = new THREE.Vector3(0, 0, 0)\n\n // collide and jump properties\n frontCollide = false\n backCollide = false\n leftCollide = false\n rightCollide = false\n downCollide = true\n upCollide = false\n isJumping = false\n\n raycasterDown = new THREE.Raycaster()\n raycasterUp = new THREE.Raycaster()\n raycasterFront = new THREE.Raycaster()\n raycasterBack = new THREE.Raycaster()\n raycasterRight = new THREE.Raycaster()\n raycasterLeft = new THREE.Raycaster()\n\n tempMesh = new THREE.InstancedMesh(\n new THREE.BoxGeometry(1, 1, 1),\n new THREE.MeshBasicMaterial(),\n 100\n )\n tempMeshMatrix = new THREE.InstancedBufferAttribute(\n new Float32Array(100 * 16),\n 16\n )\n\n // other properties\n p1 = performance.now()\n p2 = performance.now()\n raycaster: THREE.Raycaster\n far: number\n\n holdingBlock = BlockType.grass\n holdingBlocks = [\n BlockType.grass,\n BlockType.stone,\n BlockType.tree,\n BlockType.wood,\n BlockType.diamond,\n BlockType.quartz,\n BlockType.glass,\n BlockType.grass,\n BlockType.grass,\n BlockType.grass\n ]\n holdingIndex = 0\n wheelGap = false\n clickInterval?: ReturnType<typeof setInterval>\n jumpInterval?: ReturnType<typeof setInterval>\n mouseHolding = false\n spaceHolding = false\n\n initRayCaster = () => {\n this.raycasterUp.ray.direction = new THREE.Vector3(0, 1, 0)\n this.raycasterDown.ray.direction = new THREE.Vector3(0, -1, 0)\n this.raycasterFront.ray.direction = new THREE.Vector3(1, 0, 0)\n this.raycasterBack.ray.direction = new THREE.Vector3(-1, 0, 0)\n this.raycasterLeft.ray.direction = new THREE.Vector3(0, 0, -1)\n this.raycasterRight.ray.direction = new THREE.Vector3(0, 0, 1)\n\n this.raycasterUp.far = 1.2\n this.raycasterDown.far = this.player.body.height\n this.raycasterFront.far = this.player.body.width\n this.raycasterBack.far = this.player.body.width\n this.raycasterLeft.far = this.player.body.width\n this.raycasterRight.far = this.player.body.width\n }\n\n setMovementHandler = (e: KeyboardEvent) => {\n if (e.repeat) {\n return\n }\n\n switch (e.key) {\n case 'q':\n if (this.player.mode === Mode.walking) {\n this.player.setMode(Mode.flying)\n } else {\n this.player.setMode(Mode.walking)\n }\n this.velocity.y = 0\n this.velocity.x = 0\n this.velocity.z = 0\n break\n case 'w':\n case 'W':\n this.velocity.x += this.player.speed\n break\n case 's':\n case 'S':\n this.velocity.x -= this.player.speed\n break\n case 'a':\n case 'A':\n this.velocity.z -= this.player.speed\n break\n case 'd':\n case 'D':\n this.velocity.z += this.player.speed\n break\n case ' ':\n if (this.player.mode === Mode.walking) {\n // jump\n if (!this.isJumping) {\n this.velocity.y = 8\n this.isJumping = true\n this.downCollide = false\n this.far = 0\n setTimeout(() => {\n this.far = this.player.body.height\n }, 300)\n }\n } else {\n this.velocity.y += this.player.speed\n }\n if (this.player.mode === Mode.walking && !this.spaceHolding) {\n this.spaceHolding = true\n this.jumpInterval = setInterval(() => {\n this.setMovementHandler(e)\n }, 10)\n }\n break\n case 'Shift':\n if (this.player.mode === Mode.walking) {\n } else {\n this.velocity.y -= this.player.speed\n }\n break\n default:\n break\n }\n }\n\n resetMovementHandler = (e: KeyboardEvent) => {\n if (e.repeat) {\n return\n }\n\n switch (e.key) {\n case 'w':\n case 'W':\n this.velocity.x = 0\n break\n case 's':\n case 'S':\n this.velocity.x = 0\n break\n case 'a':\n case 'A':\n this.velocity.z = 0\n break\n case 'd':\n case 'D':\n this.velocity.z = 0\n break\n case ' ':\n this.jumpInterval && clearInterval(this.jumpInterval)\n this.spaceHolding = false\n if (this.player.mode === Mode.walking) {\n return\n }\n this.velocity.y = 0\n break\n case 'Shift':\n if (this.player.mode === Mode.walking) {\n return\n }\n this.velocity.y = 0\n break\n default:\n break\n }\n }\n\n mousedownHandler = (e: MouseEvent) => {\n e.preventDefault()\n // let p1 = performance.now()\n this.raycaster.setFromCamera({ x: 0, y: 0 }, this.camera)\n const block = this.raycaster.intersectObjects(this.terrain.blocks)[0]\n const matrix = new THREE.Matrix4()\n\n switch (e.button) {\n // left click to remove block\n case 0:\n {\n if (block && block.object instanceof THREE.InstancedMesh) {\n // calculate position\n block.object.getMatrixAt(block.instanceId!, matrix)\n const position = new THREE.Vector3().setFromMatrixPosition(matrix)\n\n // don't remove bedrock\n if (\n (BlockType[block.object.name as any] as unknown as BlockType) ===\n BlockType.bedrock\n ) {\n this.terrain.generateAdjacentBlocks(position)\n return\n }\n\n // remove the block\n block.object.setMatrixAt(\n block.instanceId!,\n new THREE.Matrix4().set(\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n 0\n )\n )\n\n // block and sound effect\n this.audio.playSound(\n BlockType[block.object.name as any] as unknown as BlockType\n )\n\n const mesh = new THREE.Mesh(\n new THREE.BoxGeometry(1, 1, 1),\n this.terrain.materials.get(\n this.terrain.materialType[\n parseInt(BlockType[block.object.name as any])\n ]\n )\n )\n mesh.position.set(position.x, position.y, position.z)\n this.scene.add(mesh)\n const time = performance.now()\n let raf = 0\n const animate = () => {\n if (performance.now() - time > 250) {\n this.scene.remove(mesh)\n cancelAnimationFrame(raf)\n return\n }\n raf = requestAnimationFrame(animate)\n mesh.geometry.scale(0.85, 0.85, 0.85)\n }\n animate()\n\n // update\n block.object.instanceMatrix.needsUpdate = true\n\n // check existence\n let existed = false\n for (const customBlock of this.terrain.customBlocks) {\n if (\n customBlock.x === position.x &&\n customBlock.y === position.y &&\n customBlock.z === position.z\n ) {\n existed = true\n customBlock.placed = false\n }\n }\n\n // add to custom blocks when it's not existed\n if (!existed) {\n this.terrain.customBlocks.push(\n new Block(\n position.x,\n position.y,\n position.z,\n BlockType[block.object.name as any] as unknown as BlockType,\n false\n )\n )\n }\n\n // generate adjacent blocks\n this.terrain.generateAdjacentBlocks(position)\n }\n }\n break\n\n // right click to put block\n case 2:\n {\n if (block && block.object instanceof THREE.InstancedMesh) {\n // calculate normal and position\n const normal = block.face!.normal\n block.object.getMatrixAt(block.instanceId!, matrix)\n const position = new THREE.Vector3().setFromMatrixPosition(matrix)\n\n // return when block overlaps with player\n if (\n position.x + normal.x === Math.round(this.camera.position.x) &&\n position.z + normal.z === Math.round(this.camera.position.z) &&\n (position.y + normal.y === Math.round(this.camera.position.y) ||\n position.y + normal.y ===\n Math.round(this.camera.position.y - 1))\n ) {\n return\n }\n\n // put the block\n matrix.setPosition(\n normal.x + position.x,\n normal.y + position.y,\n normal.z + position.z\n )\n this.terrain.blocks[this.holdingBlock].setMatrixAt(\n this.terrain.getCount(this.holdingBlock),\n matrix\n )\n this.terrain.setCount(this.holdingBlock)\n\n //sound effect\n this.audio.playSound(this.holdingBlock)\n\n // update\n this.terrain.blocks[this.holdingBlock].instanceMatrix.needsUpdate =\n true\n\n // add to custom blocks\n this.terrain.customBlocks.push(\n new Block(\n normal.x + position.x,\n normal.y + position.y,\n normal.z + position.z,\n this.holdingBlock,\n true\n )\n )\n }\n }\n break\n default:\n break\n }\n\n if (!isMobile && !this.mouseHolding) {\n this.mouseHolding = true\n this.clickInterval = setInterval(() => {\n this.mousedownHandler(e)\n }, 333)\n }\n\n // console.log(performance.now() - p1)\n }\n mouseupHandler = () => {\n this.clickInterval && clearInterval(this.clickInterval)\n this.mouseHolding = false\n }\n\n changeHoldingBlockHandler = (e: KeyboardEvent) => {\n if (isNaN(parseInt(e.key)) || e.key === '0') {\n return\n }\n this.holdingIndex = parseInt(e.key) - 1\n\n this.holdingBlock = this.holdingBlocks[this.holdingIndex] ?? BlockType.grass\n }\n\n wheelHandler = (e: WheelEvent) => {\n if (!this.wheelGap) {\n this.wheelGap = true\n setTimeout(() => {\n this.wheelGap = false\n }, 100)\n if (e.deltaY > 0) {\n this.holdingIndex++\n this.holdingIndex > 9 && (this.holdingIndex = 0)\n } else if (e.deltaY < 0) {\n this.holdingIndex--\n this.holdingIndex < 0 && (this.holdingIndex = 9)\n }\n this.holdingBlock =\n this.holdingBlocks[this.holdingIndex] ?? BlockType.grass\n }\n }\n\n initEventListeners = () => {\n // add / remove handler when pointer lock / unlock\n document.addEventListener('pointerlockchange', () => {\n if (document.pointerLockElement) {\n document.body.addEventListener(\n 'keydown',\n this.changeHoldingBlockHandler\n )\n document.body.addEventListener('wheel', this.wheelHandler)\n document.body.addEventListener('keydown', this.setMovementHandler)\n document.body.addEventListener('keyup', this.resetMovementHandler)\n document.body.addEventListener('mousedown', this.mousedownHandler)\n document.body.addEventListener('mouseup', this.mouseupHandler)\n } else {\n document.body.removeEventListener(\n 'keydown',\n this.changeHoldingBlockHandler\n )\n document.body.removeEventListener('wheel', this.wheelHandler)\n document.body.removeEventListener('keydown', this.setMovementHandler)\n document.body.removeEventListener('keyup', this.resetMovementHandler)\n document.body.removeEventListener('mousedown', this.mousedownHandler)\n document.body.removeEventListener('mouseup', this.mouseupHandler)\n this.velocity = new THREE.Vector3(0, 0, 0)\n }\n })\n }\n\n // move along X with direction factor\n moveX(distance: number, delta: number) {\n this.camera.position.x +=\n distance * (this.player.speed / Math.PI) * 2 * delta\n }\n\n // move along Z with direction factor\n moveZ = (distance: number, delta: number) => {\n this.camera.position.z +=\n distance * (this.player.speed / Math.PI) * 2 * delta\n }\n\n // collide checking\n collideCheckAll = (\n position: THREE.Vector3,\n noise: Noise,\n customBlocks: Block[],\n far: number\n ) => {\n this.collideCheck(Side.down, position, noise, customBlocks, far)\n this.collideCheck(Side.front, position, noise, customBlocks)\n this.collideCheck(Side.back, position, noise, customBlocks)\n this.collideCheck(Side.left, position, noise, customBlocks)\n this.collideCheck(Side.right, position, noise, customBlocks)\n this.collideCheck(Side.up, position, noise, customBlocks)\n }\n\n collideCheck = (\n side: Side,\n position: THREE.Vector3,\n noise: Noise,\n customBlocks: Block[],\n far: number = this.player.body.width\n ) => {\n const matrix = new THREE.Matrix4()\n\n //reset simulation blocks\n let index = 0\n this.tempMesh.instanceMatrix = new THREE.InstancedBufferAttribute(\n new Float32Array(100 * 16),\n 16\n )\n\n // block to remove\n let removed = false\n let treeRemoved = new Array<boolean>(\n this.terrain.noise.treeHeight + 1\n ).fill(false)\n\n // get block position\n let x = Math.round(position.x)\n let z = Math.round(position.z)\n\n switch (side) {\n case Side.front:\n x++\n this.raycasterFront.ray.origin = position\n break\n case Side.back:\n x--\n this.raycasterBack.ray.origin = position\n break\n case Side.left:\n z--\n this.raycasterLeft.ray.origin = position\n break\n case Side.right:\n z++\n this.raycasterRight.ray.origin = position\n break\n case Side.down:\n this.raycasterDown.ray.origin = position\n this.raycasterDown.far = far\n break\n case Side.up:\n this.raycasterUp.ray.origin = new THREE.Vector3().copy(position)\n this.raycasterUp.ray.origin.y--\n break\n }\n\n let y =\n Math.floor(\n noise.get(x / noise.gap, z / noise.gap, noise.seed) * noise.amp\n ) + 30\n\n // check custom blocks\n for (const block of customBlocks) {\n if (block.x === x && block.z === z) {\n if (block.placed) {\n // placed blocks\n matrix.setPosition(block.x, block.y, block.z)\n this.tempMesh.setMatrixAt(index++, matrix)\n } else if (block.y === y) {\n // removed blocks\n removed = true\n } else {\n for (let i = 1; i <= this.terrain.noise.treeHeight; i++) {\n if (block.y === y + i) {\n treeRemoved[i] = true\n }\n }\n }\n }\n }\n\n // update simulation blocks (ignore removed blocks)\n if (!removed) {\n matrix.setPosition(x, y, z)\n this.tempMesh.setMatrixAt(index++, matrix)\n }\n for (let i = 1; i <= this.terrain.noise.treeHeight; i++) {\n if (!treeRemoved[i]) {\n let treeOffset =\n noise.get(x / noise.treeGap, z / noise.treeGap, noise.treeSeed) *\n noise.treeAmp\n\n let stoneOffset =\n noise.get(x / noise.stoneGap, z / noise.stoneGap, noise.stoneSeed) *\n noise.stoneAmp\n\n if (\n treeOffset > noise.treeThreshold &&\n y >= 27 &&\n stoneOffset < noise.stoneThreshold\n ) {\n matrix.setPosition(x, y + i, z)\n this.tempMesh.setMatrixAt(index++, matrix)\n }\n }\n }\n\n this.tempMesh.instanceMatrix.needsUpdate = true\n\n // update collide\n const origin = new THREE.Vector3(position.x, position.y - 1, position.z)\n switch (side) {\n case Side.front: {\n const c1 = this.raycasterFront.intersectObject(this.tempMesh).length\n this.raycasterFront.ray.origin = origin\n const c2 = this.raycasterFront.intersectObject(this.tempMesh).length\n c1 || c2 ? (this.frontCollide = true) : (this.frontCollide = false)\n\n break\n }\n case Side.back: {\n const c1 = this.raycasterBack.intersectObject(this.tempMesh).length\n this.raycasterBack.ray.origin = origin\n const c2 = this.raycasterBack.intersectObject(this.tempMesh).length\n c1 || c2 ? (this.backCollide = true) : (this.backCollide = false)\n break\n }\n case Side.left: {\n const c1 = this.raycasterLeft.intersectObject(this.tempMesh).length\n this.raycasterLeft.ray.origin = origin\n const c2 = this.raycasterLeft.intersectObject(this.tempMesh).length\n c1 || c2 ? (this.leftCollide = true) : (this.leftCollide = false)\n break\n }\n case Side.right: {\n const c1 = this.raycasterRight.intersectObject(this.tempMesh).length\n this.raycasterRight.ray.origin = origin\n const c2 = this.raycasterRight.intersectObject(this.tempMesh).length\n c1 || c2 ? (this.rightCollide = true) : (this.rightCollide = false)\n break\n }\n case Side.down: {\n const c1 = this.raycasterDown.intersectObject(this.tempMesh).length\n c1 ? (this.downCollide = true) : (this.downCollide = false)\n break\n }\n case Side.up: {\n const c1 = this.raycasterUp.intersectObject(this.tempMesh).length\n c1 ? (this.upCollide = true) : (this.upCollide = false)\n break\n }\n }\n }\n\n update = () => {\n this.p1 = performance.now()\n const delta = (this.p1 - this.p2) / 1000\n if (\n // dev mode\n this.player.mode === Mode.flying\n ) {\n this.control.moveForward(this.velocity.x * delta)\n this.control.moveRight(this.velocity.z * delta)\n this.camera.position.y += this.velocity.y * delta\n } else {\n // normal mode\n this.collideCheckAll(\n this.camera.position,\n this.terrain.noise,\n this.terrain.customBlocks,\n this.far - this.velocity.y * delta\n )\n\n // gravity\n if (Math.abs(this.velocity.y) < this.player.falling) {\n this.velocity.y -= 25 * delta\n }\n\n // up collide handler\n if (this.upCollide) {\n this.velocity.y = -225 * delta\n this.far = this.player.body.height\n }\n\n // down collide and jump handler\n if (this.downCollide && !this.isJumping) {\n this.velocity.y = 0\n } else if (this.downCollide && this.isJumping) {\n this.isJumping = false\n }\n\n // side collide handler\n let vector = new THREE.Vector3(0, 0, -1).applyQuaternion(\n this.camera.quaternion\n )\n let direction = Math.atan2(vector.x, vector.z)\n if (\n this.frontCollide ||\n this.backCollide ||\n this.leftCollide ||\n this.rightCollide\n ) {\n // collide front (positive x)\n if (this.frontCollide) {\n // camera front\n if (direction < Math.PI && direction > 0 && this.velocity.x > 0) {\n if (\n (!this.leftCollide && direction > Math.PI / 2) ||\n (!this.rightCollide && direction < Math.PI / 2)\n ) {\n this.moveZ(Math.PI / 2 - direction, delta)\n }\n } else if (\n !this.leftCollide &&\n !this.rightCollide &&\n this.velocity.x > 0\n ) {\n this.control.moveForward(this.velocity.x * delta)\n }\n\n // camera back\n if (direction < 0 && direction > -Math.PI && this.velocity.x < 0) {\n if (\n (!this.leftCollide && direction > -Math.PI / 2) ||\n (!this.rightCollide && direction < -Math.PI / 2)\n ) {\n this.moveZ(-Math.PI / 2 - direction, delta)\n }\n } else if (\n !this.leftCollide &&\n !this.rightCollide &&\n this.velocity.x < 0\n ) {\n this.control.moveForward(this.velocity.x * delta)\n }\n\n // camera left\n if (\n direction < Math.PI / 2 &&\n direction > -Math.PI / 2 &&\n this.velocity.z < 0\n ) {\n if (\n (!this.rightCollide && direction < 0) ||\n (!this.leftCollide && direction > 0)\n ) {\n this.moveZ(-direction, delta)\n }\n } else if (\n !this.leftCollide &&\n !this.rightCollide &&\n this.velocity.z < 0\n ) {\n this.control.moveRight(this.velocity.z * delta)\n }\n\n // camera right\n if (\n (direction < -Math.PI / 2 || direction > Math.PI / 2) &&\n this.velocity.z > 0\n ) {\n if (!this.rightCollide && direction > 0) {\n this.moveZ(Math.PI - direction, delta)\n }\n if (!this.leftCollide && direction < 0) {\n this.moveZ(-Math.PI - direction, delta)\n }\n } else if (\n !this.leftCollide &&\n !this.rightCollide &&\n this.velocity.z > 0\n ) {\n this.control.moveRight(this.velocity.z * delta)\n }\n }\n\n // collide back (negative x)\n if (this.backCollide) {\n // camera front\n if (direction < 0 && direction > -Math.PI && this.velocity.x > 0) {\n if (\n (!this.leftCollide && direction < -Math.PI / 2) ||\n (!this.rightCollide && direction > -Math.PI / 2)\n ) {\n this.moveZ(Math.PI / 2 + direction, delta)\n }\n } else if (\n !this.leftCollide &&\n !this.rightCollide &&\n this.velocity.x > 0\n ) {\n this.control.moveForward(this.velocity.x * delta)\n }\n\n // camera back\n if (direction < Math.PI && direction > 0 && this.velocity.x < 0) {\n if (\n (!this.leftCollide && direction < Math.PI / 2) ||\n (!this.rightCollide && direction > Math.PI / 2)\n ) {\n this.moveZ(direction - Math.PI / 2, delta)\n }\n } else if (\n !this.leftCollide &&\n !this.rightCollide &&\n this.velocity.x < 0\n ) {\n this.control.moveForward(this.velocity.x * delta)\n }\n\n // camera left\n if (\n (direction < -Math.PI / 2 || direction > Math.PI / 2) &&\n this.velocity.z < 0\n ) {\n if (!this.leftCollide && direction > 0) {\n this.moveZ(-Math.PI + direction, delta)\n }\n if (!this.rightCollide && direction < 0) {\n this.moveZ(Math.PI + direction, delta)\n }\n } else if (\n !this.leftCollide &&\n !this.rightCollide &&\n this.velocity.z < 0\n ) {\n this.control.moveRight(this.velocity.z * delta)\n }\n\n // camera right\n if (\n direction < Math.PI / 2 &&\n direction > -Math.PI / 2 &&\n this.velocity.z > 0\n ) {\n if (\n (!this.leftCollide && direction < 0) ||\n (!this.rightCollide && direction > 0)\n ) {\n this.moveZ(direction, delta)\n }\n } else if (\n !this.leftCollide &&\n !this.rightCollide &&\n this.velocity.z > 0\n ) {\n this.control.moveRight(this.velocity.z * delta)\n }\n }\n\n // collide left (negative z)\n if (this.leftCollide) {\n // camera front\n if (\n (direction < -Math.PI / 2 || direction > Math.PI / 2) &&\n this.velocity.x > 0\n ) {\n if (!this.frontCollide && direction > 0) {\n this.moveX(Math.PI - direction, delta)\n }\n if (!this.backCollide && direction < 0) {\n this.moveX(-Math.PI - direction, delta)\n }\n } else if (\n !this.frontCollide &&\n !this.backCollide &&\n this.velocity.x > 0\n ) {\n this.control.moveForward(this.velocity.x * delta)\n } else if (\n this.frontCollide &&\n direction < 0 &&\n direction > -Math.PI / 2 &&\n this.velocity.x > 0\n ) {\n this.control.moveForward(this.velocity.x * delta)\n } else if (\n this.backCollide &&\n direction < Math.PI / 2 &&\n direction > 0 &&\n this.velocity.x > 0\n ) {\n this.control.moveForward(this.velocity.x * delta)\n }\n\n // camera back\n if (\n direction < Math.PI / 2 &&\n direction > -Math.PI / 2 &&\n this.velocity.x < 0\n ) {\n if (\n (!this.frontCollide && direction < 0) ||\n (!this.backCollide && direction > 0)\n ) {\n this.moveX(-direction, delta)\n }\n } else if (\n !this.frontCollide &&\n !this.backCollide &&\n this.velocity.x < 0\n ) {\n this.control.moveForward(this.velocity.x * delta)\n } else if (\n this.frontCollide &&\n direction < Math.PI &&\n direction > Math.PI / 2 &&\n this.velocity.x < 0\n ) {\n this.control.moveForward(this.velocity.x * delta)\n } else if (\n this.backCollide &&\n direction > -Math.PI &&\n direction < -Math.PI / 2 &&\n this.velocity.x < 0\n ) {\n this.control.moveForward(this.velocity.x * delta)\n }\n\n // camera left\n if (direction > 0 && direction < Math.PI && this.velocity.z < 0) {\n if (\n (!this.backCollide && direction > Math.PI / 2) ||\n (!this.frontCollide && direction < Math.PI / 2)\n ) {\n this.moveX(Math.PI / 2 - direction, delta)\n }\n } else if (\n !this.frontCollide &&\n !this.backCollide &&\n this.velocity.z < 0\n ) {\n this.control.moveRight(this.velocity.z * delta)\n } else if (\n this.frontCollide &&\n direction > -Math.PI &&\n direction < -Math.PI / 2 &&\n this.velocity.z < 0\n ) {\n this.control.moveRight(this.velocity.z * delta)\n } else if (\n this.backCollide &&\n direction > -Math.PI / 2 &&\n direction < 0 &&\n this.velocity.z < 0\n ) {\n this.control.moveRight(this.velocity.z * delta)\n }\n\n // camera right\n if (direction < 0 && direction > -Math.PI && this.velocity.z > 0) {\n if (\n (!this.backCollide && direction > -Math.PI / 2) ||\n (!this.frontCollide && direction < -Math.PI / 2)\n ) {\n this.moveX(-Math.PI / 2 - direction, delta)\n }\n } else if (\n !this.frontCollide &&\n !this.backCollide &&\n this.velocity.z > 0\n ) {\n this.control.moveRight(this.velocity.z * delta)\n } else if (\n this.frontCollide &&\n direction < Math.PI / 2 &&\n direction > 0 &&\n this.velocity.z > 0\n ) {\n this.control.moveRight(this.velocity.z * delta)\n } else if (\n this.backCollide &&\n direction < Math.PI &&\n direction > Math.PI / 2 &&\n this.velocity.z > 0\n ) {\n this.control.moveRight(this.velocity.z * delta)\n }\n }\n\n // collide right (positive z)\n if (this.rightCollide) {\n // camera front\n if (\n direction < Math.PI / 2 &&\n direction > -Math.PI / 2 &&\n this.velocity.x > 0\n ) {\n if (\n (!this.backCollide && direction < 0) ||\n (!this.frontCollide && direction > 0)\n ) {\n this.moveX(direction, delta)\n }\n } else if (\n !this.frontCollide &&\n !this.backCollide &&\n this.velocity.x > 0\n ) {\n this.control.moveForward(this.velocity.x * delta)\n } else if (\n this.frontCollide &&\n direction < -Math.PI / 2 &&\n direction > -Math.PI &&\n this.velocity.x > 0\n ) {\n this.control.moveForward(this.velocity.x * delta)\n } else if (\n this.backCollide &&\n direction < Math.PI &&\n direction > Math.PI / 2 &&\n this.velocity.x > 0\n ) {\n this.control.moveForward(this.velocity.x * delta)\n }\n\n // camera back\n if (\n (direction < -Math.PI / 2 || direction > Math.PI / 2) &&\n this.velocity.x < 0\n ) {\n if (!this.backCollide && direction > 0) {\n this.moveX(-Math.PI + direction, delta)\n }\n if (!this.frontCollide && direction < 0) {\n this.moveX(Math.PI + direction, delta)\n }\n } else if (\n !this.frontCollide &&\n !this.backCollide &&\n this.velocity.x < 0\n ) {\n this.control.moveForward(this.velocity.x * delta)\n } else if (\n this.frontCollide &&\n direction < Math.PI / 2 &&\n direction > 0 &&\n this.velocity.x < 0\n ) {\n this.control.moveForward(this.velocity.x * delta)\n } else if (\n this.backCollide &&\n direction < 0 &&\n direction > -Math.PI / 2 &&\n this.velocity.x < 0\n ) {\n this.control.moveForward(this.velocity.x * delta)\n }\n\n // camera left\n if (direction < 0 && direction > -Math.PI && this.velocity.z < 0) {\n if (\n (!this.frontCollide && direction > -Math.PI / 2) ||\n (!this.backCollide && direction < -Math.PI / 2)\n ) {\n this.moveX(Math.PI / 2 + direction, delta)\n }\n } else if (\n !this.frontCollide &&\n !this.backCollide &&\n this.velocity.z < 0\n ) {\n this.control.moveRight(this.velocity.z * delta)\n } else if (\n this.frontCollide &&\n direction > Math.PI / 2 &&\n direction < Math.PI &&\n this.velocity.z < 0\n ) {\n this.control.moveRight(this.velocity.z * delta)\n } else if (\n this.backCollide &&\n direction > 0 &&\n direction < Math.PI / 2 &&\n this.velocity.z < 0\n ) {\n this.control.moveRight(this.velocity.z * delta)\n }\n\n // camera right\n if (direction > 0 && direction < Math.PI && this.velocity.z > 0) {\n if (\n (!this.frontCollide && direction > Math.PI / 2) ||\n (!this.backCollide && direction < Math.PI / 2)\n ) {\n this.moveX(direction - Math.PI / 2, delta)\n }\n } else if (\n !this.frontCollide &&\n !this.backCollide &&\n this.velocity.z > 0\n ) {\n this.control.moveRight(this.velocity.z * delta)\n } else if (\n this.frontCollide &&\n direction > -Math.PI / 2 &&\n direction < 0 &&\n this.velocity.z > 0\n ) {\n this.control.moveRight(this.velocity.z * delta)\n } else if (\n this.backCollide &&\n direction > -Math.PI &&\n direction < -Math.PI / 2 &&\n this.velocity.z > 0\n ) {\n this.control.moveRight(this.velocity.z * delta)\n }\n }\n } else {\n // no collide\n this.control.moveForward(this.velocity.x * delta)\n this.control.moveRight(this.velocity.z * delta)\n }\n\n this.camera.position.y += this.velocity.y * delta\n\n // catching net\n if (this.camera.position.y < -100) {\n this.camera.position.y = 60\n }\n }\n this.p2 = this.p1\n }\n}\n","/**\n * Display current FPS\n */\nexport default class FPS {\n constructor() {\n this.fps.className = 'fps'\n this.fps.innerHTML = `FPS: 60`\n\n document.body.appendChild(this.fps)\n }\n\n p1 = performance.now()\n p2 = performance.now()\n gap = performance.now()\n fps = document.createElement('div')\n count = 0\n\n update = () => {\n this.p1 = performance.now()\n this.count++\n\n if (performance.now() - this.gap > 1000) {\n this.fps.innerHTML = `FPS: ${this.count}`\n this.gap = performance.now()\n this.count = 0\n }\n\n this.p2 = this.p1\n }\n}\n","export default \"__VITE_ASSET__020eb145__\"","export default \"__VITE_ASSET__53e38748__\"","export default \"__VITE_ASSET__98a9b0d4__\"","export default \"__VITE_ASSET__9768871f__\"","export default \"__VITE_ASSET__b6171099__\"","export default \"__VITE_ASSET__9ffd1d51__\"","export default \"__VITE_ASSET__3e48b289__\"","import grass from '../../static/block-icon/grass.png'\nimport stone from '../../static/block-icon/stone.png'\nimport tree from '../../static/block-icon/tree.png'\nimport wood from '../../static/block-icon/wood.png'\nimport diamond from '../../static/block-icon/diamond.png'\nimport quartz from '../../static/block-icon/quartz.png'\nimport glass from '../../static/block-icon/glass.png'\nimport { isMobile } from '../../utils'\n\nexport default class Bag {\n constructor() {\n if (isMobile) return\n\n this.bag.className = 'bag'\n this.items[0].classList.add('selected')\n\n for (let i = 0; i < this.items.length; i++) {\n this.bag.appendChild(this.items[i])\n }\n document.body.appendChild(this.bag)\n\n document.body.addEventListener('keydown', (e: KeyboardEvent) => {\n if (isNaN(parseInt(e.key)) || e.key === '0') {\n return\n }\n\n for (let i = 0; i < this.items.length; i++) {\n this.items[i].classList.remove('selected')\n }\n\n this.current = parseInt(e.key) - 1\n this.items[this.current].classList.add('selected')\n })\n\n document.body.addEventListener('wheel', (e: WheelEvent) => {\n if (!this.wheelGap) {\n this.wheelGap = true\n setTimeout(() => {\n this.wheelGap = false\n }, 100)\n if (e.deltaY > 0) {\n this.current++\n this.current > 9 && (this.current = 0)\n } else if (e.deltaY < 0) {\n this.current--\n this.current < 0 && (this.current = 9)\n }\n for (let i = 0; i < this.items.length; i++) {\n this.items[i].classList.remove('selected')\n }\n this.items[this.current].classList.add('selected')\n }\n })\n }\n wheelGap = false\n current = 0\n icon = [grass, stone, tree, wood, diamond, quartz, glass]\n iconIndex = 0\n y = 0\n\n bag = document.createElement('div')\n\n items = new Array(10).fill(null).map(() => {\n let item = document.createElement('div')\n item.className = 'item'\n\n let img = document.createElement('img')\n if (this.icon[this.iconIndex]) {\n img.className = 'icon'\n img.alt = 'block'\n img.src = this.icon[this.iconIndex++]\n item.appendChild(img)\n }\n\n return item\n })\n}\n","export default \"<div class=\\\"joystick\\\">\\n <button id=\\\"action-front\\\" class=\\\"joystick-button front\\\" role=\\\"div\\\">🔼</button>\\n <button id=\\\"action-left\\\" class=\\\"joystick-button left\\\" role=\\\"div\\\">◀️</button>\\n <button id=\\\"action-right\\\" class=\\\"joystick-button right\\\" role=\\\"div\\\">▶️</button>\\n <button id=\\\"action-back\\\" class=\\\"joystick-button back\\\" role=\\\"div\\\">🔽</button>\\n <button id=\\\"action-mode\\\" class=\\\"joystick-button mode\\\" role=\\\"div\\\">⏹️</button>\\n <button id=\\\"action-up\\\" class=\\\"joystick-button up\\\" role=\\\"div\\\">🔼</button>\\n <button id=\\\"action-down\\\" class=\\\"joystick-button down hidden\\\" role=\\\"div\\\">\\n 🔽\\n </button>\\n</div>\\n\\n<style>\\n .joystick {\\n position: fixed;\\n bottom: 0;\\n display: grid;\\n width: 100%;\\n grid-template-columns: repeat(auto-fill, 50px);\\n grid-template-rows: repeat(3, 1fr);\\n gap: 10px;\\n padding: 10px;\\n }\\n .joystick-button {\\n width: 52px;\\n height: 50px;\\n font-size: 50px;\\n line-height: 50px;\\n padding: 0px;\\n border: none;\\n background-color: transparent;\\n }\\n .front {\\n grid-column: 2 / 3;\\n grid-row: 1;\\n }\\n .left {\\n grid-column: 1 / 2;\\n grid-row: 2;\\n }\\n .right {\\n grid-column: 3 / 4;\\n grid-row: 2;\\n }\\n .back {\\n grid-column: 2 / 3;\\n grid-row: 3;\\n }\\n .mode {\\n grid-column: 2 / 3;\\n grid-row: 2;\\n }\\n .up {\\n grid-column: -3 / -2;\\n grid-row: 2;\\n }\\n .down {\\n grid-column: -3 / -2;\\n grid-row: 3;\\n }\\n</style>\\n\"","import * as THREE from 'three'\nimport Control from '../../control'\nimport { Mode } from '../../player'\nimport { htmlToDom } from '../../utils'\nimport UI from './joystick.html?raw'\n\nenum ActionKey {\n FRONT = 'front',\n LEFT = 'left',\n RIGHT = 'right',\n BACK = 'back',\n MODE = 'mode',\n JUMP = 'jump',\n UP = 'up',\n DOWN = 'down'\n}\n\nexport default class Joystick {\n constructor(control: Control) {\n this.control = control\n this.euler = new THREE.Euler(0, 0, 0, 'YXZ')\n }\n\n control: Control\n pageX = 0\n pageY = 0\n clickX = 0\n clickY = 0\n euler: THREE.Euler\n clickTimeout?: ReturnType<typeof setTimeout>\n clickInterval?: ReturnType<typeof setInterval>\n hold = false\n\n // emit keyboard event\n private emitKeyboardEvent = (key: string) => {\n return {\n key\n } as KeyboardEvent\n }\n\n // emit click event\n private emitClickEvent = (button: number) => {\n return {\n button,\n preventDefault: () => { }\n } as MouseEvent\n }\n\n // init joystick button\n private initButton = ({\n actionKey,\n key\n }: {\n actionKey: ActionKey\n key: string\n }) => {\n const button = document.querySelector(\n `#action-${actionKey}`\n ) as HTMLButtonElement\n button.addEventListener('pointermove', e => {\n e.stopPropagation()\n })\n button.addEventListener('pointerdown', e => {\n this.control.setMovementHandler(this.emitKeyboardEvent(key))\n e.stopPropagation()\n })\n button.addEventListener('pointerup', e => {\n this.control.resetMovementHandler(this.emitKeyboardEvent(key))\n e.stopPropagation()\n })\n // extra config for mode switch button\n if (actionKey === ActionKey.MODE && key === 'q') {\n this.initButton({ actionKey: ActionKey.MODE, key: ' ' })\n button.addEventListener('pointerdown', () => {\n if (this.control.player.mode === Mode.flying) {\n document.querySelector('#action-down')?.classList.remove('hidden')\n } else {\n document.querySelector('#action-down')?.classList.add('hidden')\n }\n })\n }\n }\n\n init = () => {\n htmlToDom(UI)\n\n this.initButton({ actionKey: ActionKey.FRONT, key: 'w' })\n this.initButton({ actionKey: ActionKey.LEFT, key: 'a' })\n this.initButton({ actionKey: ActionKey.RIGHT, key: 'd' })\n this.initButton({ actionKey: ActionKey.BACK, key: 's' })\n this.initButton({ actionKey: ActionKey.MODE, key: 'q' })\n this.initButton({ actionKey: ActionKey.UP, key: ' ' })\n this.initButton({ actionKey: ActionKey.DOWN, key: 'Shift' })\n\n // camera control\n document.addEventListener('pointermove', e => {\n if (this.pageX !== 0 || this.pageY !== 0) {\n this.euler.setFromQuaternion(this.control.camera.quaternion)\n this.euler.y -= 0.01 * (e.pageX - this.pageX)\n this.euler.x -= 0.01 * (e.pageY - this.pageY)\n this.euler.x = Math.max(\n -Math.PI / 2,\n Math.min(Math.PI / 2, this.euler.x)\n )\n this.control.camera.quaternion.setFromEuler(this.euler)\n }\n this.pageX = e.pageX\n this.pageY = e.pageY\n this.clickTimeout && clearTimeout(this.clickTimeout)\n })\n\n // click control\n document.addEventListener('pointerdown', e => {\n this.clickX = e.pageX\n this.clickY = e.pageY\n\n this.clickTimeout = setTimeout(() => {\n if (e.pageX === this.clickX && e.pageY === this.clickY) {\n this.control.mousedownHandler(this.emitClickEvent(0))\n this.clickInterval = setInterval(() => {\n this.control.mousedownHandler(this.emitClickEvent(0))\n }, 333)\n this.hold = true\n }\n }, 500)\n })\n\n document.addEventListener('pointerup', e => {\n this.clickTimeout && clearTimeout(this.clickTimeout)\n this.clickInterval && clearInterval(this.clickInterval)\n\n if (!this.hold && e.pageX === this.clickX && e.pageY === this.clickY) {\n this.control.mousedownHandler(this.emitClickEvent(2))\n }\n this.hold = false\n this.pageX = 0\n this.pageY = 0\n })\n }\n}\n","import FPS from './fps'\nimport Bag from './bag'\nimport Terrain from '../terrain'\nimport Block from '../terrain/mesh/block'\nimport Control from '../control'\nimport { Mode } from '../player'\nimport Joystick from './joystick'\nimport { isMobile } from '../utils'\nimport * as THREE from 'three'\n\nexport default class UI {\n constructor(terrain: Terrain, control: Control) {\n this.fps = new FPS()\n this.bag = new Bag()\n this.joystick = new Joystick(control)\n\n this.crossHair.className = 'cross-hair'\n this.crossHair.innerHTML = '+'\n document.body.appendChild(this.crossHair)\n\n // play\n this.play?.addEventListener('click', () => {\n if (this.play?.innerHTML === 'Play') {\n this.onPlay()\n\n // reset game\n terrain.noise.seed = Math.random()\n terrain.noise.stoneSeed = Math.random()\n terrain.noise.treeSeed = Math.random()\n terrain.noise.coalSeed = Math.random()\n terrain.noise.leafSeed = Math.random()\n terrain.customBlocks = []\n terrain.initBlocks()\n terrain.generate()\n terrain.camera.position.y = 40\n control.player.setMode(Mode.walking)\n }\n !isMobile && control.control.lock()\n })\n\n // save load\n this.save?.addEventListener('click', () => {\n if (this.save?.innerHTML === 'Save and Exit') {\n // save game\n window.localStorage.setItem(\n 'block',\n JSON.stringify(terrain.customBlocks)\n )\n window.localStorage.setItem('seed', JSON.stringify(terrain.noise.seed))\n\n window.localStorage.setItem(\n 'position',\n JSON.stringify({\n x: terrain.camera.position.x,\n y: terrain.camera.position.y,\n z: terrain.camera.position.z\n })\n )\n\n // ui update\n this.onExit()\n this.onSave()\n } else {\n // load game\n terrain.noise.seed =\n Number(window.localStorage.getItem('seed')) ?? Math.random()\n\n const customBlocks =\n (JSON.parse(\n window.localStorage.getItem('block') || 'null'\n ) as Block[]) ?? []\n\n terrain.customBlocks = customBlocks\n terrain.initBlocks()\n terrain.generate()\n\n const position =\n (JSON.parse(window.localStorage.getItem('position') || 'null') as {\n x: number\n y: number\n z: number\n }) ?? null\n\n position && (terrain.camera.position.x = position.x)\n position && (terrain.camera.position.y = position.y)\n position && (terrain.camera.position.z = position.z)\n\n // ui update\n this.onPlay()\n this.onLoad()\n !isMobile && control.control.lock()\n }\n })\n\n // guide\n this.feature?.addEventListener('click', () => {\n this.features?.classList.remove('hidden')\n })\n this.back?.addEventListener('click', () => {\n this.features?.classList.add('hidden')\n })\n\n // setting\n this.setting?.addEventListener('click', () => {\n this.settings?.classList.remove('hidden')\n })\n this.settingBack?.addEventListener('click', () => {\n this.settings?.classList.add('hidden')\n })\n\n // render distance\n this.distanceInput?.addEventListener('input', (e: Event) => {\n if (this.distance && e.target instanceof HTMLInputElement) {\n this.distance.innerHTML = `Render Distance: ${e.target.value}`\n }\n })\n\n // fov\n this.fovInput?.addEventListener('input', (e: Event) => {\n if (this.fov && e.target instanceof HTMLInputElement) {\n this.fov.innerHTML = `Field of View: ${e.target.value}`\n control.camera.fov = parseInt(e.target.value)\n control.camera.updateProjectionMatrix()\n }\n })\n\n // music\n this.musicInput?.addEventListener('input', (e: Event) => {\n if (this.fov && e.target instanceof HTMLInputElement) {\n const disabled = e.target.value === '0'\n control.audio.disabled = disabled\n this.music!.innerHTML = `Music: ${disabled ? 'Off' : 'On'}`\n }\n })\n\n // apply settings\n this.settingBack?.addEventListener('click', () => {\n if (this.distanceInput instanceof HTMLInputElement) {\n terrain.distance = parseInt(this.distanceInput.value)\n terrain.maxCount =\n (terrain.distance * terrain.chunkSize * 2 + terrain.chunkSize) ** 2 +\n 500\n\n terrain.initBlocks()\n terrain.generate()\n terrain.scene.fog = new THREE.Fog(\n 0x87ceeb,\n 1,\n terrain.distance * 24 + 24\n )\n }\n })\n\n // menu and fullscreen\n document.body.addEventListener('keydown', (e: KeyboardEvent) => {\n // menu\n if (e.key === 'e' && document.pointerLockElement) {\n !isMobile && control.control.unlock()\n }\n\n // fullscreen\n if (e.key === 'f') {\n if (document.fullscreenElement) {\n document.exitFullscreen()\n } else {\n document.body.requestFullscreen()\n }\n }\n })\n\n // exit\n this.exit?.addEventListener('click', () => {\n this.onExit()\n })\n\n // play / pause handler\n document.addEventListener('pointerlockchange', () => {\n if (document.pointerLockElement) {\n this.onPlay()\n } else {\n this.onPause()\n }\n })\n\n // disable context menu\n document.addEventListener('contextmenu', e => {\n e.preventDefault()\n })\n\n // fallback lock handler\n document.querySelector('canvas')?.addEventListener('click', (e: Event) => {\n e.preventDefault()\n !isMobile && control.control.lock()\n })\n }\n\n fps: FPS\n bag: Bag\n joystick: Joystick\n\n menu = document.querySelector('.menu')\n crossHair = document.createElement('div')\n\n // buttons\n play = document.querySelector('#play')\n control = document.querySelector('#control')\n setting = document.querySelector('#setting')\n feature = document.querySelector('#feature')\n back = document.querySelector('#back')\n exit = document.querySelector('#exit')\n save = document.querySelector('#save')\n\n // modals\n saveModal = document.querySelector('.save-modal')\n loadModal = document.querySelector('.load-modal')\n settings = document.querySelector('.settings')\n features = document.querySelector('.features')\n github = document.querySelector('.github')\n\n // settings\n distance = document.querySelector('#distance')\n distanceInput = document.querySelector('#distance-input')\n\n fov = document.querySelector('#fov')\n fovInput = document.querySelector('#fov-input')\n\n music = document.querySelector('#music')\n musicInput = document.querySelector('#music-input')\n\n settingBack = document.querySelector('#setting-back')\n\n onPlay = () => {\n isMobile && this.joystick.init()\n this.menu?.classList.add('hidden')\n this.menu?.classList.remove('start')\n this.play && (this.play.innerHTML = 'Resume')\n this.crossHair.classList.remove('hidden')\n this.github && this.github.classList.add('hidden')\n this.feature?.classList.add('hidden')\n }\n\n onPause = () => {\n this.menu?.classList.remove('hidden')\n this.crossHair.classList.add('hidden')\n this.save && (this.save.innerHTML = 'Save and Exit')\n this.github && this.github.classList.remove('hidden')\n }\n\n onExit = () => {\n this.menu?.classList.add('start')\n this.play && (this.play.innerHTML = 'Play')\n this.save && (this.save.innerHTML = 'Load Game')\n this.feature?.classList.remove('hidden')\n }\n\n onSave = () => {\n this.saveModal?.classList.remove('hidden')\n setTimeout(() => {\n this.saveModal?.classList.add('show')\n })\n setTimeout(() => {\n this.saveModal?.classList.remove('show')\n }, 1000)\n\n setTimeout(() => {\n this.saveModal?.classList.add('hidden')\n }, 1350)\n }\n\n onLoad = () => {\n this.loadModal?.classList.remove('hidden')\n setTimeout(() => {\n this.loadModal?.classList.add('show')\n })\n setTimeout(() => {\n this.loadModal?.classList.remove('show')\n }, 1000)\n\n setTimeout(() => {\n this.loadModal?.classList.add('hidden')\n }, 1350)\n }\n\n update = () => {\n this.fps.update()\n }\n}\n","export default \"__VITE_ASSET__2642662e__\"","export default \"__VITE_ASSET__3619fdb8__\"","export default \"__VITE_ASSET__b0763cf2__\"","export default \"__VITE_ASSET__9ac02803__\"","export default \"__VITE_ASSET__dd733357__\"","export default \"__VITE_ASSET__1260ef32__\"","export default \"__VITE_ASSET__74ef2fa1__\"","export default \"__VITE_ASSET__0441e996__\"","export default \"__VITE_ASSET__42ac9116__\"","export default \"__VITE_ASSET__97f2a8a7__\"","export default \"__VITE_ASSET__98a5c319__\"","export default \"__VITE_ASSET__19273f0e__\"","export default \"__VITE_ASSET__b164e732__\"","export default \"__VITE_ASSET__55a610c8__\"","export default \"__VITE_ASSET__60ebf0ed__\"","export default \"__VITE_ASSET__ab5e4b40__\"","export default \"__VITE_ASSET__fd4aa755__\"","export default \"__VITE_ASSET__cb6071c8__\"","export default \"__VITE_ASSET__59edca84__\"","export default \"__VITE_ASSET__cf6be231__\"","export default \"__VITE_ASSET__de868b31__\"","export default \"__VITE_ASSET__74400cfe__\"","export default \"__VITE_ASSET__b7636085__\"","export default \"__VITE_ASSET__6228533c__\"","export default \"__VITE_ASSET__72db3634__\"","import * as THREE from 'three'\nimport hal3 from './musics/hal3.ogg'\nimport { BlockType } from '../terrain'\n\nimport grass1 from './blocks/grass1.ogg'\nimport grass2 from './blocks/grass2.ogg'\nimport grass3 from './blocks/grass3.ogg'\nimport grass4 from './blocks/grass4.ogg'\n\nimport sand1 from './blocks/sand1.ogg'\nimport sand2 from './blocks/sand2.ogg'\nimport sand3 from './blocks/sand3.ogg'\nimport sand4 from './blocks/sand4.ogg'\n\nimport stone1 from './blocks/stone1.ogg'\nimport stone2 from './blocks/stone2.ogg'\nimport stone3 from './blocks/stone3.ogg'\nimport stone4 from './blocks/stone4.ogg'\n\nimport dirt1 from './blocks/dirt1.ogg'\nimport dirt2 from './blocks/dirt2.ogg'\nimport dirt3 from './blocks/dirt3.ogg'\nimport dirt4 from './blocks/dirt4.ogg'\n\nimport tree1 from './blocks/tree1.ogg'\nimport tree2 from './blocks/tree2.ogg'\nimport tree3 from './blocks/tree3.ogg'\nimport tree4 from './blocks/tree4.ogg'\n\nimport leaf1 from './blocks/leaf1.ogg'\nimport leaf2 from './blocks/leaf2.ogg'\nimport leaf3 from './blocks/leaf3.ogg'\nimport leaf4 from './blocks/leaf4.ogg'\nimport { isMobile } from '../utils'\n\nexport default class Audio {\n constructor(camera: THREE.PerspectiveCamera) {\n if (isMobile) return\n\n const listener = new THREE.AudioListener()\n const audioLoader = new THREE.AudioLoader()\n camera.add(listener)\n\n // load bgm\n const bgm = new THREE.Audio(listener)\n bgm.autoplay = false\n audioLoader.load(hal3, buffer => {\n bgm.setBuffer(buffer)\n bgm.setVolume(0.1)\n bgm.setLoop(true)\n if (bgm.isPlaying) {\n bgm.pause()\n bgm.play()\n }\n })\n\n // play / pause bgm\n document.addEventListener('pointerlockchange', () => {\n if (document.pointerLockElement && !bgm.isPlaying && !this.disabled) {\n bgm.play()\n } else {\n bgm.pause()\n }\n })\n\n // load sound effect\n for (const types of this.sourceSet) {\n const audios: THREE.Audio[] = []\n for (const type of types) {\n audioLoader.load(type, buffer => {\n const audio = new THREE.Audio(listener!)\n audio.setBuffer(buffer)\n audio.setVolume(0.15)\n audios.push(audio)\n })\n }\n this.soundSet.push(audios)\n }\n }\n\n disabled = false\n\n sourceSet = [\n [grass1, grass2, grass3, grass4],\n [sand1, sand2, sand3, sand4],\n [tree1, tree2, tree3, tree4],\n [leaf1, leaf2, leaf3, leaf4],\n [dirt1, dirt2, dirt3, dirt4],\n [stone1, stone2, stone3, stone4],\n [stone1, stone2, stone3, stone4],\n [tree1, tree2, tree3, tree4],\n [stone1, stone2, stone3, stone4],\n [stone1, stone2, stone3, stone4],\n [stone1, stone2, stone3, stone4]\n ]\n\n soundSet: THREE.Audio[][] = []\n\n index = 0\n\n playSound(type: BlockType) {\n if (!this.disabled && !isMobile) {\n this.index++ === 3 && (this.index = 0)\n this.soundSet[type]?.[this.index]?.play()\n }\n }\n}\n","import Core from './core'\nimport Control from './control'\nimport Player from './player'\nimport Terrain from './terrain'\nimport UI from './ui'\nimport Audio from './audio'\n\nimport './style.css'\n\nconst core = new Core()\nconst camera = core.camera\nconst scene = core.scene\nconst renderer = core.renderer\n\nconst player = new Player()\nconst audio = new Audio(camera)\n\nconst terrain = new Terrain(scene, camera)\nconst control = new Control(scene, camera, player, terrain, audio)\n\nconst ui = new UI(terrain, control)\n\n// animation\n;(function animate() {\n // let p1 = performance.now()\n requestAnimationFrame(animate)\n\n control.update()\n terrain.update()\n ui.update()\n\n renderer.render(scene, camera)\n // console.log(performance.now()-p1)\n})()\n"],"names":["THREE.Scene","THREE.Fog","THREE.Color","THREE.PointLight","THREE.AmbientLight","THREE.PerspectiveCamera","THREE.WebGLRenderer","THREE.TextureLoader","stone","diamond","quartz","glass","THREE.NearestFilter","THREE.MeshStandardMaterial","THREE.BoxGeometry","THREE.Mesh","THREE.InstancedMesh","THREE.MeshBasicMaterial","THREE.Raycaster","THREE.InstancedBufferAttribute","THREE.Matrix4","THREE.Vector3","THREE.Vector2","Generate","Highlight","UI","THREE.Euler","THREE.AudioListener","THREE.AudioLoader","THREE.Audio"],"mappings":"yYAAA,KAAM,IAAI,UAAoB,CAC1B,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S,IAEtD,GAAK,GAAI,IAAG,EAAS,IAGzB,aAAmB,uBAEG,MAEd,WACA,YACL,YAEM,OAAO,EAAO"}
\ No newline at end of file
body{font-family:Minecraft,Avenir,Helvetica,Arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;margin:0;overflow:hidden}*{touch-action:none}@font-face{font-family:Minecraft;src:url(/dist/assets/mc-font.c5bcd562.otf);font-display:swap}.start{background-image:url(/dist/assets/menu.e25a1d96.jpeg);background-repeat:no-repeat;background-size:100% 100%}.start #exit{display:none}.menu{z-index:1;position:fixed;left:0%;top:0%;display:flex;flex-direction:column;align-items:center;width:100vw;height:75vh;padding-top:25vh;text-align:center;user-select:none;background-color:#1c1c1cb3}.button{width:300px;margin-bottom:15px;padding:10px;display:inline-block;font-family:Minecraft,Avenir,Helvetica,Arial,sans-serif;font-size:1.2rem;color:#fff;background-color:#727272;cursor:pointer;border-left:2px solid #a4a4a4;border-top:2px solid #a4a4a4;border-bottom:2px solid #545655;border-right:2px solid #545655;box-shadow:0 0 0 2px #000}.button:hover{background-color:#218306;border-left:2px solid #17cd07;border-top:2px solid #17cd07;border-bottom:2px solid #004e00;border-right:2px solid #004e00;box-shadow:0 0 0 2px #fff}.footer{position:fixed;color:#fff;left:50%;top:100%;opacity:75%;transform:translate(-50%,-100%);font-family:sans-serif}.fps{position:fixed;color:#fff;left:0%;top:0%;padding:5px;margin:1px;border:2px solid rgb(141,139,139);background-color:#1c1c1c80}.bag{position:fixed;left:50%;top:100%;transform:translate(-50%,-100%);width:fit-content;background-color:#1c1c1c80;height:62px}.item{display:inline-block;width:56px;height:56px;margin:1px;border:2px solid rgb(141,139,139)}.selected{border:2px solid rgb(236,234,234);outline:1px solid rgb(236,234,234)}.icon{display:block;margin:auto;transform:translateY(20%);width:40px;height:40px}.cross-hair{position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);user-select:none;font-size:3rem;color:#fff}.hidden{display:none}.features{z-index:2;position:fixed;left:50%;top:20%;transform:translate(-50%);width:300px;color:#fff;background-color:#727272;border-left:2px solid #a4a4a4;border-top:2px solid #a4a4a4;border-bottom:2px solid #545655;border-right:2px solid #545655;box-shadow:0 0 0 2px #000;padding:0 30px;text-align:center;user-select:none;text-align:left;line-height:1.8rem}.save-modal,.load-modal{z-index:3;position:fixed;left:50%;transform:translate(-50%);margin-top:calc(25vh + 62px);padding:12px 0;width:300px;color:#fff;background-color:#218306;border-left:2px solid #17cd07;border-top:2px solid #17cd07;border-bottom:2px solid #004e00;border-right:2px solid #004e00;box-shadow:0 0 0 2px #fff;opacity:0%;transition:opacity .35s ease-in-out;text-align:center;user-select:none}.load-modal{background-color:#727272;border-left:2px solid #a4a4a4;border-top:2px solid #a4a4a4;border-bottom:2px solid #545655;border-right:2px solid #545655;box-shadow:0 0 0 2px #000}.show{transition:opacity .5s ease-in-out;opacity:100%}.github svg{z-index:3;fill:#727272;position:fixed;left:100%;top:-1%;transform:translate(-99%) rotate(-90deg) scaleY(-1)}.settings{z-index:2;position:fixed;left:50%;top:20%;transform:translate(-50%);width:300px;height:370px;color:#fff;background-color:#727272;border-left:2px solid #a4a4a4;border-top:2px solid #a4a4a4;border-bottom:2px solid #545655;border-right:2px solid #545655;box-shadow:0 0 0 2px #000;padding:0 30px;text-align:center;user-select:none;text-align:left;line-height:1.8rem}#distance-input,#fov-input{appearance:none;width:100%;height:16px;background-color:#ddd;box-shadow:0 0 0 2px #000}#music-input{appearance:none;width:14%;height:16px;background-color:#ddd;box-shadow:0 0 0 2px #000}#distance-input::-webkit-slider-thumb:hover,#fov-input::-webkit-slider-thumb:hover,#music-input::-webkit-slider-thumb:hover{background-color:#218306;border-left:2px solid #17cd07;border-top:2px solid #17cd07;border-bottom:2px solid #004e00;border-right:2px solid #004e00;box-shadow:0 0 0 2px #fff}#distance-input::-webkit-slider-thumb,#fov-input::-webkit-slider-thumb,#music-input::-webkit-slider-thumb{appearance:none;width:20px;height:30px;background-color:#727272;border-left:2px solid #a4a4a4;border-top:2px solid #a4a4a4;border-bottom:2px solid #545655;border-right:2px solid #545655;box-shadow:0 0 0 2px #000;cursor:pointer}#distance-input::-moz-range-thumb,#fov-input::-moz-range-thumb,#music-input::-moz-range-thumb{appearance:none;width:20px;height:30px;background-color:#727272;border-left:2px solid #a4a4a4;border-top:2px solid #a4a4a4;border-bottom:2px solid #545655;border-right:2px solid #545655;box-shadow:0 0 0 2px #000;cursor:pointer}*{-webkit-touch-callout:none;-moz-touch-callout:none;-ms-touch-callout:none;-webkit-user-select:none;user-select:none}
因为 它太大了无法显示 source diff 。你可以改为 查看blob
因为 它太大了无法显示 source diff 。你可以改为 查看blob
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/dist/assets/mc.5fa29ff9.ico" />
<meta
name="viewport"
content="width=device-width,initial-scale=1,maximum-scale=1"
/>
<meta
name="description"
content="Minecraft clone made with Three.js + TypeScript, play minecraft in your own browser!"
/>
<title>Minecraft - Three.js</title>
<script type="module" crossorigin src="/dist/assets/index.3d64fa62.js"></script>
<link rel="modulepreload" href="/dist/assets/vendor.b16e062d.js">
<link rel="stylesheet" href="/dist/assets/index.648ad158.css">
</head>
<body>
<a
href="https://github.com/Vyse12138/minecraft-threejs"
title="Source on GitHub"
class="github"
target="_blank"
rel="noopener"
>
<svg width="72" height="72" viewBox="0 0 250 250">
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
<path
d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2"
fill="white"
></path>
<path
d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z"
fill="white"
></path>
</svg>
</a>
<div class="menu start">
<button id="play" class="button">Play</button>
<button id="save" class="button">Load Game</button>
<button id="setting" class="button">Setting</button>
<button id="feature" class="button">Guide</button>
<button id="exit" class="button">Exit</button>
<footer class="footer">© 2022 Yulei Zhu</footer>
</div>
<div class="features hidden">
<p>
<b> Left-Click: </b> destroy block <br />
<b> Right-Click:</b> place block <br />
<b> Wheel / Number Key: </b>change block <br />
<b> WASD: </b>move <br />
<b> Space: </b>jump <br />
<b> Q:</b> normal / dev mode <br />
<b> Shift:</b> fly up (in dev mode) <br />
<b> F: </b>full screen <br />
<b> E: </b>menu <br />
</p>
<button id="back" class="button">Back</button>
</div>
<div class="settings hidden">
<p id="distance">Render Distance: 3</p>
<input
type="range"
id="distance-input"
min="1"
max="8"
value="3"
step="1"
/>
<p id="fov">Field of View: 70</p>
<input
type="range"
id="fov-input"
min="40"
max="100"
value="70"
step="1"
/>
<p id="music">Music: On</p>
<input type="range" id="music-input" min="0" max="1" value="1" step="1" />
<br />
<br />
<button id="setting-back" class="button">Apply</button>
</div>
<div class="save-modal hidden">Game Saved!</div>
<div class="load-modal hidden">Game Loaded!</div>
</body>
</html>
...@@ -6,7 +6,11 @@ ...@@ -6,7 +6,11 @@
"description": "Minecraft clone made with Three.js and TypeScript", "description": "Minecraft clone made with Three.js and TypeScript",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
<<<<<<< HEAD
"build": "vite build", "build": "vite build",
=======
"build": "vite build --base=/dist/",
>>>>>>> 8e27e4d91d171fdca6522f4297ff30d0fdedccd0
"preview": "vite preview --port 8080", "preview": "vite preview --port 8080",
"lint": "tsc --noEmit" "lint": "tsc --noEmit"
}, },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册