|
1 | 1 | import Stats from 'three/examples/jsm/libs/stats.module.js' |
2 | 2 | import * as dat from 'three/examples/jsm/libs/dat.gui.module.js' |
3 | | -import { WebGLRenderer, Scene, PerspectiveCamera, AmbientLight } from 'three' |
| 3 | +import { WebGLRenderer, Scene, PerspectiveCamera, AmbientLight, TextureLoader } from 'three' |
4 | 4 | import { DistanceBasedFog } from './rendering/DistanceBasedFog.js' |
5 | 5 | import { UrlParams } from './UrlParams.js' |
6 | 6 | import { gpuInfo } from './additional/gpuInfo.js' |
@@ -45,7 +45,7 @@ function Setup (game) { |
45 | 45 | UrlParams(game) |
46 | 46 | console.warn(gpuInfo()) |
47 | 47 | game.socket = new Socket(game) |
48 | | - game.pii = new PlayerInInventory(game) |
| 48 | + game.pii = new PlayerInInventory(game) |
49 | 49 | game.bb = new BlockBreak(game) |
50 | 50 | game.bp = new BlockPlace(game) |
51 | 51 | game.world = new World(game) |
@@ -81,20 +81,20 @@ function Setup (game) { |
81 | 81 | if(id!=="ERR"){ |
82 | 82 | console.log(`UUID: ${id}`) |
83 | 83 | //SKIN |
84 | | - fetch(`${document.location.protocol}//${hostname}:${port}/getSkin?id=${id}`) |
85 | | - .then(response => response.json()) |
86 | | - .then(data => { |
87 | | - // console.log(data) |
88 | | - const nd=JSON.parse(atob(data.properties[0].value)) |
89 | | - // console.log(nd) |
90 | | - console.log(`SKIN: ${nd.textures.SKIN.url}`) |
91 | | - }); |
| 84 | + game.skinUrl=`${document.location.protocol}//${hostname}:${port}/getSkin?id=${id}` |
| 85 | + console.log(game.skinUrl) |
| 86 | + new TextureLoader().load(game.skinUrl, (texture) => { |
| 87 | + game.pii.setup(texture) |
| 88 | + }) |
| 89 | + |
92 | 90 | }else{ |
93 | 91 | console.log("UUID not found!") |
| 92 | + game.pii.setup(game.al.get('playerTex')) |
94 | 93 | } |
95 | 94 | }); |
96 | 95 | } |
97 | 96 | }); |
| 97 | + |
98 | 98 | game.distanceBasedFog.addShaderToMaterials([ |
99 | 99 | game.world.material, |
100 | 100 | game.ent.mobMaterial, |
|
0 commit comments