minerender 2.1.0-alpha.1 → 2.1.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.d.mts +108 -86
- package/dist/browser/index.d.ts +108 -86
- package/dist/browser/index.js +1092 -968
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +1103 -979
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +554 -432
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +108 -86
- package/dist/node/index.d.ts +108 -86
- package/dist/node/index.js +1098 -970
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +1108 -980
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/bundle.js
CHANGED
|
@@ -82665,24 +82665,54 @@ return ${compiler2.callType("value", tagType)}
|
|
|
82665
82665
|
this.stats = new SceneStats();
|
|
82666
82666
|
this.instanceManager = new InstanceManager();
|
|
82667
82667
|
this.dirty = true;
|
|
82668
|
+
this.observedObjects = /* @__PURE__ */ new Set();
|
|
82669
|
+
this.onObjectChange = (event) => {
|
|
82670
|
+
if (event.target?.parent === this) {
|
|
82671
|
+
this.dirty = true;
|
|
82672
|
+
}
|
|
82673
|
+
};
|
|
82668
82674
|
this.options = (0, import_ts_deepmerge9.default)({}, _MineRenderScene.DEFAULT_OPTIONS, options ?? {});
|
|
82669
82675
|
}
|
|
82670
|
-
add(...
|
|
82671
|
-
|
|
82672
|
-
|
|
82673
|
-
|
|
82674
|
-
|
|
82675
|
-
|
|
82676
|
+
add(...objects) {
|
|
82677
|
+
for (const object of objects) {
|
|
82678
|
+
this.dirty = true;
|
|
82679
|
+
try {
|
|
82680
|
+
super.add(object);
|
|
82681
|
+
} finally {
|
|
82682
|
+
if (object?.isObject3D && object !== this) {
|
|
82683
|
+
this.updateObjectRegistration(object, object.parent === this);
|
|
82684
|
+
}
|
|
82676
82685
|
}
|
|
82677
|
-
obj.addEventListener("change", (event) => {
|
|
82678
|
-
this.dirty = true;
|
|
82679
|
-
});
|
|
82680
82686
|
}
|
|
82681
|
-
return
|
|
82687
|
+
return this;
|
|
82682
82688
|
}
|
|
82683
|
-
remove(...
|
|
82684
|
-
|
|
82685
|
-
|
|
82689
|
+
remove(...objects) {
|
|
82690
|
+
for (const object of objects) {
|
|
82691
|
+
if (!this.children.includes(object)) continue;
|
|
82692
|
+
this.dirty = true;
|
|
82693
|
+
this.updateObjectRegistration(object, false);
|
|
82694
|
+
try {
|
|
82695
|
+
super.remove(object);
|
|
82696
|
+
} finally {
|
|
82697
|
+
this.updateObjectRegistration(object, object.parent === this);
|
|
82698
|
+
}
|
|
82699
|
+
}
|
|
82700
|
+
return this;
|
|
82701
|
+
}
|
|
82702
|
+
updateObjectRegistration(object, attached) {
|
|
82703
|
+
if (this.observedObjects.has(object) === attached) return;
|
|
82704
|
+
if (attached) {
|
|
82705
|
+
this.observedObjects.add(object);
|
|
82706
|
+
object.addEventListener("change", this.onObjectChange);
|
|
82707
|
+
} else {
|
|
82708
|
+
this.observedObjects.delete(object);
|
|
82709
|
+
object.removeEventListener("change", this.onObjectChange);
|
|
82710
|
+
}
|
|
82711
|
+
const change = attached ? 1 : -1;
|
|
82712
|
+
this.stats.objectCount += change;
|
|
82713
|
+
if (isSceneObject(object)) {
|
|
82714
|
+
this.stats.sceneObjectCount += change;
|
|
82715
|
+
}
|
|
82686
82716
|
}
|
|
82687
82717
|
async initAndAdd(...object) {
|
|
82688
82718
|
this.dirty = true;
|
|
@@ -84513,425 +84543,7 @@ uniform float opacity;varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuf
|
|
|
84513
84543
|
return lerp2(a4, b4, 1 - 0.125);
|
|
84514
84544
|
}
|
|
84515
84545
|
|
|
84516
|
-
// src/
|
|
84517
|
-
var _Renderer = class _Renderer {
|
|
84518
|
-
constructor(options) {
|
|
84519
|
-
this._dirty = true;
|
|
84520
|
-
this._animationTimer = void 0;
|
|
84521
|
-
this._animationFrame = void 0;
|
|
84522
|
-
this._resizeListener = void 0;
|
|
84523
|
-
this.options = (0, import_ts_deepmerge10.default)({}, _Renderer.DEFAULT_OPTIONS, options ?? {});
|
|
84524
|
-
this._animationLoop = this.animate.bind(this);
|
|
84525
|
-
this._fpsTimer = this.options.render.fpsLimit > 0 ? 1e3 / this.options.render.fpsLimit : void 0;
|
|
84526
|
-
this._scene = this.createScene();
|
|
84527
|
-
this._camera = this.createCamera();
|
|
84528
|
-
this._renderer = this.createRenderer();
|
|
84529
|
-
this._composer = this.createComposer();
|
|
84530
|
-
if (this.options.render.stats) {
|
|
84531
|
-
this._stats = new import_stats.default();
|
|
84532
|
-
document.body.appendChild(this._stats.dom);
|
|
84533
|
-
}
|
|
84534
|
-
this.init();
|
|
84535
|
-
}
|
|
84536
|
-
//<editor-fold desc="INIT">
|
|
84537
|
-
createScene() {
|
|
84538
|
-
return new MineRenderScene();
|
|
84539
|
-
}
|
|
84540
|
-
createCamera() {
|
|
84541
|
-
switch (this.options.camera.type) {
|
|
84542
|
-
case "perspective":
|
|
84543
|
-
default:
|
|
84544
|
-
return new PerspectiveCamera(
|
|
84545
|
-
this.options.camera.perspective.fov,
|
|
84546
|
-
this.options.camera.perspective.aspect ?? this.viewWidth / this.viewHeight,
|
|
84547
|
-
this.options.camera.near,
|
|
84548
|
-
this.options.camera.far
|
|
84549
|
-
);
|
|
84550
|
-
case "orthographic":
|
|
84551
|
-
return new OrthographicCamera(
|
|
84552
|
-
this.options.camera.orthographic.left ?? this.viewWidth / -2,
|
|
84553
|
-
this.options.camera.orthographic.right ?? this.viewWidth / 2,
|
|
84554
|
-
this.options.camera.orthographic.top ?? this.viewHeight / 2,
|
|
84555
|
-
this.options.camera.orthographic.bottom ?? this.viewHeight / -2,
|
|
84556
|
-
this.options.camera.near,
|
|
84557
|
-
this.options.camera.far
|
|
84558
|
-
);
|
|
84559
|
-
}
|
|
84560
|
-
}
|
|
84561
|
-
createRenderer() {
|
|
84562
|
-
const renderer = new WebGLRenderer({
|
|
84563
|
-
antialias: this.options.render.antialias,
|
|
84564
|
-
alpha: true,
|
|
84565
|
-
powerPreference: "high-performance",
|
|
84566
|
-
depth: true
|
|
84567
|
-
});
|
|
84568
|
-
renderer.setClearColor(0, 0);
|
|
84569
|
-
renderer.shadowMap.enabled = true;
|
|
84570
|
-
renderer.shadowMap.type = PCFSoftShadowMap;
|
|
84571
|
-
renderer.outputEncoding = LinearEncoding;
|
|
84572
|
-
renderer.setSize(this.viewWidth, this.viewHeight);
|
|
84573
|
-
return renderer;
|
|
84574
|
-
}
|
|
84575
|
-
createComposer() {
|
|
84576
|
-
const composer = new EffectComposer(this.renderer);
|
|
84577
|
-
if (!this.options.composer.enabled) return composer;
|
|
84578
|
-
composer.setSize(this.viewWidth, this.viewHeight);
|
|
84579
|
-
composer.addPass(new RenderPass(this.scene, this.camera));
|
|
84580
|
-
return composer;
|
|
84581
|
-
}
|
|
84582
|
-
//</editor-fold>
|
|
84583
|
-
init() {
|
|
84584
|
-
if (typeof window["__THREE_DEVTOOLS__"] !== "undefined") {
|
|
84585
|
-
window["__THREE_DEVTOOLS__"].dispatchEvent(new CustomEvent("observe", { detail: this.scene }));
|
|
84586
|
-
}
|
|
84587
|
-
if (this.options.debug.grid) {
|
|
84588
|
-
const gridHelper = new GridHelper(128, 16);
|
|
84589
|
-
this.scene.add(gridHelper);
|
|
84590
|
-
const gridHelper2 = new GridHelper(128, 16);
|
|
84591
|
-
gridHelper2.rotation.x = 90 * (Math.PI / 180);
|
|
84592
|
-
this.scene.add(gridHelper2);
|
|
84593
|
-
const gridHelper3 = new GridHelper(128, 16);
|
|
84594
|
-
gridHelper3.rotation.z = 90 * (Math.PI / 180);
|
|
84595
|
-
this.scene.add(gridHelper3);
|
|
84596
|
-
}
|
|
84597
|
-
if (this.options.debug.axes) {
|
|
84598
|
-
const axesHelper = new AxesHelper(64);
|
|
84599
|
-
this.scene.add(axesHelper);
|
|
84600
|
-
}
|
|
84601
|
-
if (this.options.camera.position) {
|
|
84602
|
-
if (isVector3(this.options.camera.position)) {
|
|
84603
|
-
this.camera.position.set(this.options.camera.position.x, this.options.camera.position.y, this.options.camera.position.z);
|
|
84604
|
-
} else if (isTripleArray(this.options.camera.position)) {
|
|
84605
|
-
this.camera.position.set(this.options.camera.position[0], this.options.camera.position[1], this.options.camera.position[2]);
|
|
84606
|
-
}
|
|
84607
|
-
}
|
|
84608
|
-
if (this.options.camera.lookingAt) {
|
|
84609
|
-
if (isVector3(this.options.camera.lookingAt)) {
|
|
84610
|
-
this.camera.lookAt(this.options.camera.lookingAt);
|
|
84611
|
-
} else if (isTripleArray(this.options.camera.lookingAt)) {
|
|
84612
|
-
this.camera.lookAt(this.options.camera.lookingAt[0], this.options.camera.lookingAt[1], this.options.camera.lookingAt[2]);
|
|
84613
|
-
}
|
|
84614
|
-
}
|
|
84615
|
-
if (this.options.render.autoResize) {
|
|
84616
|
-
this._resizeListener = () => {
|
|
84617
|
-
this.resize(this.viewWidth, this.viewHeight);
|
|
84618
|
-
};
|
|
84619
|
-
window.addEventListener("resize", this._resizeListener);
|
|
84620
|
-
}
|
|
84621
|
-
}
|
|
84622
|
-
get element() {
|
|
84623
|
-
return this._element;
|
|
84624
|
-
}
|
|
84625
|
-
appendTo(element) {
|
|
84626
|
-
this._element = element;
|
|
84627
|
-
this._element.appendChild(this.renderer.domElement);
|
|
84628
|
-
if (this.viewWidth == 0) {
|
|
84629
|
-
console.warn("0 element width");
|
|
84630
|
-
}
|
|
84631
|
-
if (this.viewHeight == 0) {
|
|
84632
|
-
console.warn("0 element height");
|
|
84633
|
-
}
|
|
84634
|
-
this.resize(this.viewWidth, this.viewHeight);
|
|
84635
|
-
}
|
|
84636
|
-
/**
|
|
84637
|
-
* Register an EventDispatcher which may update the scene or renderer in order to redraw the scene
|
|
84638
|
-
*/
|
|
84639
|
-
registerEventDispatcher(dispatcher, changeEvent2 = "change") {
|
|
84640
|
-
dispatcher.addEventListener(changeEvent2, (event) => {
|
|
84641
|
-
this._dirty = true;
|
|
84642
|
-
});
|
|
84643
|
-
}
|
|
84644
|
-
resize(width, height) {
|
|
84645
|
-
if (isPerspectiveCamera(this.camera)) {
|
|
84646
|
-
this.camera.aspect = width / height;
|
|
84647
|
-
this.camera.updateProjectionMatrix();
|
|
84648
|
-
} else if (isOrthographicCamera(this.camera)) {
|
|
84649
|
-
this.camera.left = width / -2;
|
|
84650
|
-
this.camera.right = width / 2;
|
|
84651
|
-
this.camera.top = height / 2;
|
|
84652
|
-
this.camera.bottom = height / -2;
|
|
84653
|
-
this.camera.updateProjectionMatrix();
|
|
84654
|
-
}
|
|
84655
|
-
this.renderer.setSize(width, height);
|
|
84656
|
-
this.composer.setSize(width, height);
|
|
84657
|
-
}
|
|
84658
|
-
//<editor-fold desc="RENDER">
|
|
84659
|
-
get dirty() {
|
|
84660
|
-
return this._dirty || this.scene.dirty;
|
|
84661
|
-
}
|
|
84662
|
-
set dirty(dirty) {
|
|
84663
|
-
this._dirty = dirty;
|
|
84664
|
-
this.scene.dirty = dirty;
|
|
84665
|
-
}
|
|
84666
|
-
start() {
|
|
84667
|
-
stop();
|
|
84668
|
-
this.renderer.setAnimationLoop(this._animationLoop);
|
|
84669
|
-
}
|
|
84670
|
-
stop() {
|
|
84671
|
-
this.renderer.setAnimationLoop(null);
|
|
84672
|
-
if (this._animationTimer)
|
|
84673
|
-
clearTimeout(this._animationTimer);
|
|
84674
|
-
this._animationTimer = void 0;
|
|
84675
|
-
if (this._animationFrame)
|
|
84676
|
-
cancelAnimationFrame(this._animationFrame);
|
|
84677
|
-
this._animationFrame = void 0;
|
|
84678
|
-
}
|
|
84679
|
-
animate(t5) {
|
|
84680
|
-
if (this._stats) {
|
|
84681
|
-
this._stats.begin();
|
|
84682
|
-
}
|
|
84683
|
-
if (this.dirty || this.options.render.renderAlways) {
|
|
84684
|
-
if (this.options.composer.enabled) {
|
|
84685
|
-
this.composer.render();
|
|
84686
|
-
} else {
|
|
84687
|
-
this.renderer.render(this.scene, this.camera);
|
|
84688
|
-
}
|
|
84689
|
-
}
|
|
84690
|
-
this.dirty = false;
|
|
84691
|
-
if (this._stats) {
|
|
84692
|
-
this._stats.end();
|
|
84693
|
-
}
|
|
84694
|
-
}
|
|
84695
|
-
//</editor-fold>
|
|
84696
|
-
toImage() {
|
|
84697
|
-
return this.renderer.domElement.toDataURL();
|
|
84698
|
-
}
|
|
84699
|
-
///
|
|
84700
|
-
get attachedToBody() {
|
|
84701
|
-
return this.element === document.body;
|
|
84702
|
-
}
|
|
84703
|
-
get viewWidth() {
|
|
84704
|
-
return this.attachedToBody ? window.innerWidth : this.element?.offsetWidth || 0;
|
|
84705
|
-
}
|
|
84706
|
-
get viewHeight() {
|
|
84707
|
-
return this.attachedToBody ? window.innerHeight : this.element?.offsetHeight || 0;
|
|
84708
|
-
}
|
|
84709
|
-
get scene() {
|
|
84710
|
-
return this._scene;
|
|
84711
|
-
}
|
|
84712
|
-
get camera() {
|
|
84713
|
-
return this._camera;
|
|
84714
|
-
}
|
|
84715
|
-
get renderer() {
|
|
84716
|
-
return this._renderer;
|
|
84717
|
-
}
|
|
84718
|
-
get composer() {
|
|
84719
|
-
return this._composer;
|
|
84720
|
-
}
|
|
84721
|
-
///
|
|
84722
|
-
};
|
|
84723
|
-
_Renderer.DEFAULT_OPTIONS = (0, import_ts_deepmerge10.default)({}, {
|
|
84724
|
-
camera: {
|
|
84725
|
-
type: "perspective",
|
|
84726
|
-
near: 1,
|
|
84727
|
-
far: 5e3,
|
|
84728
|
-
perspective: {
|
|
84729
|
-
aspect: void 0,
|
|
84730
|
-
fov: 50
|
|
84731
|
-
},
|
|
84732
|
-
orthographic: {
|
|
84733
|
-
left: void 0,
|
|
84734
|
-
right: void 0,
|
|
84735
|
-
top: void 0,
|
|
84736
|
-
bottom: void 0
|
|
84737
|
-
},
|
|
84738
|
-
position: new Vector3(50, 50, 50),
|
|
84739
|
-
lookingAt: new Vector3(0, 0, 0)
|
|
84740
|
-
},
|
|
84741
|
-
render: {
|
|
84742
|
-
fpsLimit: 60,
|
|
84743
|
-
stats: false,
|
|
84744
|
-
antialias: true,
|
|
84745
|
-
shade: true,
|
|
84746
|
-
autoResize: true,
|
|
84747
|
-
renderAlways: false
|
|
84748
|
-
},
|
|
84749
|
-
composer: {
|
|
84750
|
-
enabled: true
|
|
84751
|
-
},
|
|
84752
|
-
debug: {
|
|
84753
|
-
grid: false,
|
|
84754
|
-
axes: false
|
|
84755
|
-
}
|
|
84756
|
-
});
|
|
84757
|
-
var Renderer = _Renderer;
|
|
84758
|
-
|
|
84759
|
-
// src/renderer/SceneObjectOptions.ts
|
|
84760
|
-
init_dirname();
|
|
84761
|
-
init_buffer2();
|
|
84762
|
-
init_process2();
|
|
84763
|
-
|
|
84764
|
-
// src/skin/index.ts
|
|
84765
|
-
init_dirname();
|
|
84766
|
-
init_buffer2();
|
|
84767
|
-
init_process2();
|
|
84768
|
-
|
|
84769
|
-
// src/skin/Skins.ts
|
|
84770
|
-
init_dirname();
|
|
84771
|
-
init_buffer2();
|
|
84772
|
-
init_process2();
|
|
84773
|
-
var Skins = class {
|
|
84774
|
-
//<editor-fold desc="Skins">
|
|
84775
|
-
static async fromUuidOrUsername(uuidOrUsername) {
|
|
84776
|
-
if (uuidOrUsername.length === 32 || uuidOrUsername.length === 36) {
|
|
84777
|
-
return this.fromUuid(uuidOrUsername);
|
|
84778
|
-
}
|
|
84779
|
-
return this.fromUsername(uuidOrUsername);
|
|
84780
|
-
}
|
|
84781
|
-
static async fromUuid(uuid) {
|
|
84782
|
-
return this.getSkinProxySkinUrl(uuid);
|
|
84783
|
-
}
|
|
84784
|
-
static async fromUsername(username) {
|
|
84785
|
-
return this.usernameToUuid(username).then((uuid) => {
|
|
84786
|
-
if (uuid) {
|
|
84787
|
-
return this.fromUuid(uuid);
|
|
84788
|
-
}
|
|
84789
|
-
return void 0;
|
|
84790
|
-
});
|
|
84791
|
-
}
|
|
84792
|
-
static async fromMineSkin(mineskinId) {
|
|
84793
|
-
return this.getMineSkin(mineskinId).then((mineskin) => {
|
|
84794
|
-
if (mineskin) {
|
|
84795
|
-
return mineskin["data"]["texture"]["value"]["urls"]["skins"];
|
|
84796
|
-
}
|
|
84797
|
-
return void 0;
|
|
84798
|
-
});
|
|
84799
|
-
}
|
|
84800
|
-
//</editor-fold>
|
|
84801
|
-
//<editor-fold desc="Capes">
|
|
84802
|
-
static async capeFromUuidOrUsername(uuidOrUsername) {
|
|
84803
|
-
if (uuidOrUsername.length === 32 || uuidOrUsername.length === 36) {
|
|
84804
|
-
return this.capeFromUuid(uuidOrUsername);
|
|
84805
|
-
}
|
|
84806
|
-
return this.capeFromUsername(uuidOrUsername);
|
|
84807
|
-
}
|
|
84808
|
-
static async capeFromUuid(uuid) {
|
|
84809
|
-
return this.getSkinProxyCapeUrl(uuid);
|
|
84810
|
-
}
|
|
84811
|
-
static async capeFromUsername(username) {
|
|
84812
|
-
return this.usernameToUuid(username).then((uuid) => {
|
|
84813
|
-
if (uuid) {
|
|
84814
|
-
return this.capeFromUuid(uuid);
|
|
84815
|
-
}
|
|
84816
|
-
return void 0;
|
|
84817
|
-
});
|
|
84818
|
-
}
|
|
84819
|
-
static async capeFromCapesDev(uuid, capeType = "minecraft") {
|
|
84820
|
-
return this.getCapesDev(uuid, capeType).then((cape) => {
|
|
84821
|
-
if (cape) {
|
|
84822
|
-
return cape?.stillImageUrl;
|
|
84823
|
-
}
|
|
84824
|
-
return void 0;
|
|
84825
|
-
});
|
|
84826
|
-
}
|
|
84827
|
-
//</editor-fold>
|
|
84828
|
-
//<editor-fold desc="Helpers">
|
|
84829
|
-
static async usernameToUuid(username) {
|
|
84830
|
-
return this.usernameToUuidSkinProxy(username);
|
|
84831
|
-
}
|
|
84832
|
-
static async usernameToUuidSkinProxy(username) {
|
|
84833
|
-
return Requests.genericRequest({
|
|
84834
|
-
baseURL: "https://minecraft-skin-proxy.inventive.workers.dev",
|
|
84835
|
-
url: "/uuid/" + username
|
|
84836
|
-
}).then((res) => {
|
|
84837
|
-
if (res.status === 200) {
|
|
84838
|
-
return res.data["id"];
|
|
84839
|
-
}
|
|
84840
|
-
return void 0;
|
|
84841
|
-
}).catch((err) => {
|
|
84842
|
-
console.warn(err);
|
|
84843
|
-
return void 0;
|
|
84844
|
-
});
|
|
84845
|
-
}
|
|
84846
|
-
static async usernameToUuidMineTools(username) {
|
|
84847
|
-
return Requests.genericRequest({
|
|
84848
|
-
baseURL: "https://api.minetools.eu",
|
|
84849
|
-
url: "/uuid/" + username
|
|
84850
|
-
}).then((res) => {
|
|
84851
|
-
if (res.status === 200) {
|
|
84852
|
-
return res.data["id"];
|
|
84853
|
-
}
|
|
84854
|
-
return void 0;
|
|
84855
|
-
}).catch((err) => {
|
|
84856
|
-
console.warn(err);
|
|
84857
|
-
return void 0;
|
|
84858
|
-
});
|
|
84859
|
-
}
|
|
84860
|
-
static async getProfileFromMinetools(uuid) {
|
|
84861
|
-
return Requests.genericRequest({
|
|
84862
|
-
baseURL: "https://api.minetools.eu",
|
|
84863
|
-
url: "/profile/" + uuid
|
|
84864
|
-
}).then((res) => {
|
|
84865
|
-
if (res.status === 200) {
|
|
84866
|
-
return res.data;
|
|
84867
|
-
}
|
|
84868
|
-
});
|
|
84869
|
-
}
|
|
84870
|
-
static async getMineSkin(mineskinId) {
|
|
84871
|
-
return Requests.genericRequest({
|
|
84872
|
-
baseURL: "https://api.mineskin.org",
|
|
84873
|
-
url: "/get/uuid/" + mineskinId
|
|
84874
|
-
}).then((res) => {
|
|
84875
|
-
if (res.status === 200) {
|
|
84876
|
-
return res.data;
|
|
84877
|
-
}
|
|
84878
|
-
return void 0;
|
|
84879
|
-
}).catch((err) => {
|
|
84880
|
-
console.warn(err);
|
|
84881
|
-
return void 0;
|
|
84882
|
-
});
|
|
84883
|
-
}
|
|
84884
|
-
static async getCapesDev(uuid, type = "all") {
|
|
84885
|
-
return Requests.genericRequest({
|
|
84886
|
-
baseURL: "https://api.capes.dev",
|
|
84887
|
-
url: "/load/" + uuid + "/" + type
|
|
84888
|
-
}).then((res) => {
|
|
84889
|
-
if (res.status === 200) {
|
|
84890
|
-
return res.data;
|
|
84891
|
-
}
|
|
84892
|
-
return void 0;
|
|
84893
|
-
}).catch((err) => {
|
|
84894
|
-
console.warn(err);
|
|
84895
|
-
return void 0;
|
|
84896
|
-
});
|
|
84897
|
-
}
|
|
84898
|
-
static getCrafatarSkinUrl(uuid) {
|
|
84899
|
-
return "https://crafatar.com/skins/" + uuid;
|
|
84900
|
-
}
|
|
84901
|
-
static getCrafatarCapeUrl(uuid) {
|
|
84902
|
-
return "https://crafatar.com/capes/" + uuid;
|
|
84903
|
-
}
|
|
84904
|
-
static getMcHeadsSkinUrl(uuid) {
|
|
84905
|
-
return "https://mc-heads.net/skin/" + uuid;
|
|
84906
|
-
}
|
|
84907
|
-
static getMineSkinPlayerSkinUrl(uuid) {
|
|
84908
|
-
return "https://mineskin.org/skin/player/" + uuid;
|
|
84909
|
-
}
|
|
84910
|
-
static getSkinProxySkinUrl(uuid) {
|
|
84911
|
-
return "https://minecraft-skin-proxy.inventive.workers.dev/skin/" + uuid;
|
|
84912
|
-
}
|
|
84913
|
-
static getSkinProxyCapeUrl(uuid) {
|
|
84914
|
-
return "https://minecraft-skin-proxy.inventive.workers.dev/cape/" + uuid;
|
|
84915
|
-
}
|
|
84916
|
-
//</editor-fold>
|
|
84917
|
-
};
|
|
84918
|
-
|
|
84919
|
-
// src/skin/scene/index.ts
|
|
84920
|
-
init_dirname();
|
|
84921
|
-
init_buffer2();
|
|
84922
|
-
init_process2();
|
|
84923
|
-
|
|
84924
|
-
// src/texture/index.ts
|
|
84925
|
-
init_dirname();
|
|
84926
|
-
init_buffer2();
|
|
84927
|
-
init_process2();
|
|
84928
|
-
|
|
84929
|
-
// src/three/index.ts
|
|
84930
|
-
init_dirname();
|
|
84931
|
-
init_buffer2();
|
|
84932
|
-
init_process2();
|
|
84933
|
-
|
|
84934
|
-
// src/three/OrbitControls.js
|
|
84546
|
+
// src/three/OrbitControls.js
|
|
84935
84547
|
init_dirname();
|
|
84936
84548
|
init_buffer2();
|
|
84937
84549
|
init_process2();
|
|
@@ -85575,6 +85187,516 @@ uniform float opacity;varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuf
|
|
|
85575
85187
|
}
|
|
85576
85188
|
};
|
|
85577
85189
|
|
|
85190
|
+
// src/renderer/Renderer.ts
|
|
85191
|
+
var _Renderer = class _Renderer {
|
|
85192
|
+
constructor(options) {
|
|
85193
|
+
this._dirty = true;
|
|
85194
|
+
this._resizeListener = void 0;
|
|
85195
|
+
this._disposed = false;
|
|
85196
|
+
this._debugHelpers = [];
|
|
85197
|
+
this._eventDispatchers = /* @__PURE__ */ new Map();
|
|
85198
|
+
this._changeListener = () => {
|
|
85199
|
+
this._dirty = true;
|
|
85200
|
+
};
|
|
85201
|
+
this.options = (0, import_ts_deepmerge10.default)({}, _Renderer.DEFAULT_OPTIONS, options ?? {});
|
|
85202
|
+
this._animationLoop = this.animate.bind(this);
|
|
85203
|
+
this._frameInterval = this.options.render.fpsLimit > 0 ? 1e3 / this.options.render.fpsLimit : void 0;
|
|
85204
|
+
this._scene = this.createScene();
|
|
85205
|
+
this._camera = this.createCamera();
|
|
85206
|
+
this._renderer = this.createRenderer();
|
|
85207
|
+
this._composer = this.createComposer();
|
|
85208
|
+
if (this.options.render.stats) {
|
|
85209
|
+
this._stats = new import_stats.default();
|
|
85210
|
+
document.body.appendChild(this._stats.dom);
|
|
85211
|
+
}
|
|
85212
|
+
this.init();
|
|
85213
|
+
this._controls = this.createControls();
|
|
85214
|
+
}
|
|
85215
|
+
//<editor-fold desc="INIT">
|
|
85216
|
+
createScene() {
|
|
85217
|
+
return new MineRenderScene();
|
|
85218
|
+
}
|
|
85219
|
+
createCamera() {
|
|
85220
|
+
switch (this.options.camera.type) {
|
|
85221
|
+
case "perspective":
|
|
85222
|
+
default:
|
|
85223
|
+
return new PerspectiveCamera(
|
|
85224
|
+
this.options.camera.perspective.fov,
|
|
85225
|
+
this.options.camera.perspective.aspect ?? this.viewWidth / this.viewHeight,
|
|
85226
|
+
this.options.camera.near,
|
|
85227
|
+
this.options.camera.far
|
|
85228
|
+
);
|
|
85229
|
+
case "orthographic":
|
|
85230
|
+
return new OrthographicCamera(
|
|
85231
|
+
this.options.camera.orthographic.left ?? this.viewWidth / -2,
|
|
85232
|
+
this.options.camera.orthographic.right ?? this.viewWidth / 2,
|
|
85233
|
+
this.options.camera.orthographic.top ?? this.viewHeight / 2,
|
|
85234
|
+
this.options.camera.orthographic.bottom ?? this.viewHeight / -2,
|
|
85235
|
+
this.options.camera.near,
|
|
85236
|
+
this.options.camera.far
|
|
85237
|
+
);
|
|
85238
|
+
}
|
|
85239
|
+
}
|
|
85240
|
+
createRenderer() {
|
|
85241
|
+
const renderer = new WebGLRenderer({
|
|
85242
|
+
antialias: this.options.render.antialias,
|
|
85243
|
+
alpha: true,
|
|
85244
|
+
powerPreference: "high-performance",
|
|
85245
|
+
depth: true
|
|
85246
|
+
});
|
|
85247
|
+
renderer.setClearColor(0, 0);
|
|
85248
|
+
renderer.shadowMap.enabled = true;
|
|
85249
|
+
renderer.shadowMap.type = PCFSoftShadowMap;
|
|
85250
|
+
renderer.outputEncoding = LinearEncoding;
|
|
85251
|
+
renderer.setSize(this.viewWidth, this.viewHeight);
|
|
85252
|
+
return renderer;
|
|
85253
|
+
}
|
|
85254
|
+
createComposer() {
|
|
85255
|
+
const composer = new EffectComposer(this.renderer);
|
|
85256
|
+
if (!this.options.composer.enabled) return composer;
|
|
85257
|
+
composer.setSize(this.viewWidth, this.viewHeight);
|
|
85258
|
+
composer.addPass(new RenderPass(this.scene, this.camera));
|
|
85259
|
+
return composer;
|
|
85260
|
+
}
|
|
85261
|
+
createControls() {
|
|
85262
|
+
if (!this.options.controls?.enabled) return void 0;
|
|
85263
|
+
const position = this.camera.position.clone();
|
|
85264
|
+
const controls = new OrbitControls(this.camera, this.renderer.domElement);
|
|
85265
|
+
this.camera.position.copy(position);
|
|
85266
|
+
const target = this.options.camera.lookingAt;
|
|
85267
|
+
if (isVector3(target)) {
|
|
85268
|
+
controls.target.copy(target);
|
|
85269
|
+
} else if (isTripleArray(target)) {
|
|
85270
|
+
controls.target.set(target[0], target[1], target[2]);
|
|
85271
|
+
}
|
|
85272
|
+
controls.update();
|
|
85273
|
+
controls.saveState();
|
|
85274
|
+
this.registerEventDispatcher(controls);
|
|
85275
|
+
return controls;
|
|
85276
|
+
}
|
|
85277
|
+
//</editor-fold>
|
|
85278
|
+
init() {
|
|
85279
|
+
if (this._disposed) return;
|
|
85280
|
+
if (typeof window["__THREE_DEVTOOLS__"] !== "undefined") {
|
|
85281
|
+
window["__THREE_DEVTOOLS__"].dispatchEvent(new CustomEvent("observe", { detail: this.scene }));
|
|
85282
|
+
}
|
|
85283
|
+
if (this.options.debug.grid) {
|
|
85284
|
+
const gridHelper = new GridHelper(128, 16);
|
|
85285
|
+
this._debugHelpers.push(gridHelper);
|
|
85286
|
+
this.scene.add(gridHelper);
|
|
85287
|
+
const gridHelper2 = new GridHelper(128, 16);
|
|
85288
|
+
this._debugHelpers.push(gridHelper2);
|
|
85289
|
+
gridHelper2.rotation.x = 90 * (Math.PI / 180);
|
|
85290
|
+
this.scene.add(gridHelper2);
|
|
85291
|
+
const gridHelper3 = new GridHelper(128, 16);
|
|
85292
|
+
this._debugHelpers.push(gridHelper3);
|
|
85293
|
+
gridHelper3.rotation.z = 90 * (Math.PI / 180);
|
|
85294
|
+
this.scene.add(gridHelper3);
|
|
85295
|
+
}
|
|
85296
|
+
if (this.options.debug.axes) {
|
|
85297
|
+
const axesHelper = new AxesHelper(64);
|
|
85298
|
+
this._debugHelpers.push(axesHelper);
|
|
85299
|
+
this.scene.add(axesHelper);
|
|
85300
|
+
}
|
|
85301
|
+
if (this.options.camera.position) {
|
|
85302
|
+
if (isVector3(this.options.camera.position)) {
|
|
85303
|
+
this.camera.position.set(this.options.camera.position.x, this.options.camera.position.y, this.options.camera.position.z);
|
|
85304
|
+
} else if (isTripleArray(this.options.camera.position)) {
|
|
85305
|
+
this.camera.position.set(this.options.camera.position[0], this.options.camera.position[1], this.options.camera.position[2]);
|
|
85306
|
+
}
|
|
85307
|
+
}
|
|
85308
|
+
if (this.options.camera.lookingAt) {
|
|
85309
|
+
if (isVector3(this.options.camera.lookingAt)) {
|
|
85310
|
+
this.camera.lookAt(this.options.camera.lookingAt);
|
|
85311
|
+
} else if (isTripleArray(this.options.camera.lookingAt)) {
|
|
85312
|
+
this.camera.lookAt(this.options.camera.lookingAt[0], this.options.camera.lookingAt[1], this.options.camera.lookingAt[2]);
|
|
85313
|
+
}
|
|
85314
|
+
}
|
|
85315
|
+
if (this.options.render.autoResize && !this._resizeListener) {
|
|
85316
|
+
this._resizeListener = () => {
|
|
85317
|
+
this.resize(this.viewWidth, this.viewHeight);
|
|
85318
|
+
};
|
|
85319
|
+
window.addEventListener("resize", this._resizeListener);
|
|
85320
|
+
}
|
|
85321
|
+
}
|
|
85322
|
+
get element() {
|
|
85323
|
+
return this._element;
|
|
85324
|
+
}
|
|
85325
|
+
appendTo(element) {
|
|
85326
|
+
if (this._disposed) return;
|
|
85327
|
+
this._element = element;
|
|
85328
|
+
this._element.appendChild(this.renderer.domElement);
|
|
85329
|
+
if (this.viewWidth == 0) {
|
|
85330
|
+
console.warn("0 element width");
|
|
85331
|
+
}
|
|
85332
|
+
if (this.viewHeight == 0) {
|
|
85333
|
+
console.warn("0 element height");
|
|
85334
|
+
}
|
|
85335
|
+
this.resize(this.viewWidth, this.viewHeight);
|
|
85336
|
+
}
|
|
85337
|
+
/**
|
|
85338
|
+
* Redraws when the dispatcher emits the selected event. Registering the same pair twice has no effect.
|
|
85339
|
+
* The renderer removes its listener on disposal; the caller retains ownership of the dispatcher.
|
|
85340
|
+
*/
|
|
85341
|
+
registerEventDispatcher(dispatcher, changeEvent2 = "change") {
|
|
85342
|
+
if (this._disposed) return;
|
|
85343
|
+
let events = this._eventDispatchers.get(dispatcher);
|
|
85344
|
+
if (!events) {
|
|
85345
|
+
events = /* @__PURE__ */ new Set();
|
|
85346
|
+
this._eventDispatchers.set(dispatcher, events);
|
|
85347
|
+
}
|
|
85348
|
+
if (events.has(changeEvent2)) return;
|
|
85349
|
+
events.add(changeEvent2);
|
|
85350
|
+
dispatcher.addEventListener(changeEvent2, this._changeListener);
|
|
85351
|
+
}
|
|
85352
|
+
resize(width, height) {
|
|
85353
|
+
if (this._disposed) return;
|
|
85354
|
+
if (isPerspectiveCamera(this.camera)) {
|
|
85355
|
+
this.camera.aspect = width / height;
|
|
85356
|
+
this.camera.updateProjectionMatrix();
|
|
85357
|
+
} else if (isOrthographicCamera(this.camera)) {
|
|
85358
|
+
this.camera.left = width / -2;
|
|
85359
|
+
this.camera.right = width / 2;
|
|
85360
|
+
this.camera.top = height / 2;
|
|
85361
|
+
this.camera.bottom = height / -2;
|
|
85362
|
+
this.camera.updateProjectionMatrix();
|
|
85363
|
+
}
|
|
85364
|
+
this.renderer.setSize(width, height);
|
|
85365
|
+
this.composer.setSize(width, height);
|
|
85366
|
+
this._dirty = true;
|
|
85367
|
+
}
|
|
85368
|
+
//<editor-fold desc="RENDER">
|
|
85369
|
+
get dirty() {
|
|
85370
|
+
return this._dirty || this.scene.dirty;
|
|
85371
|
+
}
|
|
85372
|
+
set dirty(dirty) {
|
|
85373
|
+
this._dirty = dirty;
|
|
85374
|
+
this.scene.dirty = dirty;
|
|
85375
|
+
}
|
|
85376
|
+
start() {
|
|
85377
|
+
if (this._disposed) return;
|
|
85378
|
+
this.stop();
|
|
85379
|
+
this.renderer.setAnimationLoop(this._animationLoop);
|
|
85380
|
+
}
|
|
85381
|
+
stop() {
|
|
85382
|
+
if (this._disposed) return;
|
|
85383
|
+
this.renderer.setAnimationLoop(null);
|
|
85384
|
+
this._nextFrameTime = void 0;
|
|
85385
|
+
}
|
|
85386
|
+
/**
|
|
85387
|
+
* Stops rendering and releases owned resources. Repeated calls have no effect, and a disposed
|
|
85388
|
+
* renderer cannot be restarted. Scene objects are detached; shared assets and caller-owned
|
|
85389
|
+
* controls must be managed by their owners.
|
|
85390
|
+
*/
|
|
85391
|
+
dispose() {
|
|
85392
|
+
if (this._disposed) return;
|
|
85393
|
+
this.stop();
|
|
85394
|
+
this._disposed = true;
|
|
85395
|
+
if (this._resizeListener) {
|
|
85396
|
+
window.removeEventListener("resize", this._resizeListener);
|
|
85397
|
+
this._resizeListener = void 0;
|
|
85398
|
+
}
|
|
85399
|
+
for (const [dispatcher, events] of this._eventDispatchers) {
|
|
85400
|
+
for (const event of events) {
|
|
85401
|
+
dispatcher.removeEventListener(event, this._changeListener);
|
|
85402
|
+
}
|
|
85403
|
+
}
|
|
85404
|
+
this._eventDispatchers.clear();
|
|
85405
|
+
this._stats?.dom.remove();
|
|
85406
|
+
this._stats = void 0;
|
|
85407
|
+
this.renderer.domElement.remove();
|
|
85408
|
+
this._element = void 0;
|
|
85409
|
+
if (this._controls) {
|
|
85410
|
+
const controls = this._controls;
|
|
85411
|
+
this._controls = void 0;
|
|
85412
|
+
controls.enabled = false;
|
|
85413
|
+
controls.dispose();
|
|
85414
|
+
}
|
|
85415
|
+
this.scene.clear();
|
|
85416
|
+
for (const helper of this._debugHelpers) {
|
|
85417
|
+
helper.geometry.dispose();
|
|
85418
|
+
const materials = Array.isArray(helper.material) ? helper.material : [helper.material];
|
|
85419
|
+
for (const material of materials) {
|
|
85420
|
+
material.dispose();
|
|
85421
|
+
}
|
|
85422
|
+
}
|
|
85423
|
+
this._debugHelpers.length = 0;
|
|
85424
|
+
this.composer.dispose();
|
|
85425
|
+
this.renderer.dispose();
|
|
85426
|
+
this.renderer.forceContextLoss();
|
|
85427
|
+
}
|
|
85428
|
+
animate(t5 = performance.now()) {
|
|
85429
|
+
if (this._disposed) return;
|
|
85430
|
+
if (this._controls?.enabled) {
|
|
85431
|
+
this._controls.update();
|
|
85432
|
+
}
|
|
85433
|
+
if (this._disposed) return;
|
|
85434
|
+
if (!this.dirty && !this.options.render.renderAlways) return;
|
|
85435
|
+
const interval = this._frameInterval;
|
|
85436
|
+
if (interval) {
|
|
85437
|
+
const next = this._nextFrameTime;
|
|
85438
|
+
if (next !== void 0 && t5 + 0.1 < next) return;
|
|
85439
|
+
this._nextFrameTime = next !== void 0 && t5 - next < interval ? next + interval : t5 + interval;
|
|
85440
|
+
}
|
|
85441
|
+
if (this._stats) {
|
|
85442
|
+
this._stats.begin();
|
|
85443
|
+
}
|
|
85444
|
+
if (this.options.composer.enabled) {
|
|
85445
|
+
this.composer.render();
|
|
85446
|
+
} else {
|
|
85447
|
+
this.renderer.render(this.scene, this.camera);
|
|
85448
|
+
}
|
|
85449
|
+
this.dirty = false;
|
|
85450
|
+
if (this._stats) {
|
|
85451
|
+
this._stats.end();
|
|
85452
|
+
}
|
|
85453
|
+
}
|
|
85454
|
+
//</editor-fold>
|
|
85455
|
+
toImage() {
|
|
85456
|
+
return this.renderer.domElement.toDataURL();
|
|
85457
|
+
}
|
|
85458
|
+
///
|
|
85459
|
+
get attachedToBody() {
|
|
85460
|
+
return this.element === document.body;
|
|
85461
|
+
}
|
|
85462
|
+
get viewWidth() {
|
|
85463
|
+
return this.attachedToBody ? window.innerWidth : this.element?.offsetWidth || 0;
|
|
85464
|
+
}
|
|
85465
|
+
get viewHeight() {
|
|
85466
|
+
return this.attachedToBody ? window.innerHeight : this.element?.offsetHeight || 0;
|
|
85467
|
+
}
|
|
85468
|
+
get scene() {
|
|
85469
|
+
return this._scene;
|
|
85470
|
+
}
|
|
85471
|
+
get camera() {
|
|
85472
|
+
return this._camera;
|
|
85473
|
+
}
|
|
85474
|
+
get renderer() {
|
|
85475
|
+
return this._renderer;
|
|
85476
|
+
}
|
|
85477
|
+
get composer() {
|
|
85478
|
+
return this._composer;
|
|
85479
|
+
}
|
|
85480
|
+
/** Renderer-owned controls, or undefined when disabled at construction or after disposal. */
|
|
85481
|
+
get controls() {
|
|
85482
|
+
return this._controls;
|
|
85483
|
+
}
|
|
85484
|
+
///
|
|
85485
|
+
};
|
|
85486
|
+
_Renderer.DEFAULT_OPTIONS = (0, import_ts_deepmerge10.default)({}, {
|
|
85487
|
+
camera: {
|
|
85488
|
+
type: "perspective",
|
|
85489
|
+
near: 1,
|
|
85490
|
+
far: 5e3,
|
|
85491
|
+
perspective: {
|
|
85492
|
+
aspect: void 0,
|
|
85493
|
+
fov: 50
|
|
85494
|
+
},
|
|
85495
|
+
orthographic: {
|
|
85496
|
+
left: void 0,
|
|
85497
|
+
right: void 0,
|
|
85498
|
+
top: void 0,
|
|
85499
|
+
bottom: void 0
|
|
85500
|
+
},
|
|
85501
|
+
position: new Vector3(50, 50, 50),
|
|
85502
|
+
lookingAt: new Vector3(0, 0, 0)
|
|
85503
|
+
},
|
|
85504
|
+
render: {
|
|
85505
|
+
fpsLimit: 60,
|
|
85506
|
+
stats: false,
|
|
85507
|
+
antialias: true,
|
|
85508
|
+
shade: true,
|
|
85509
|
+
autoResize: true,
|
|
85510
|
+
renderAlways: false
|
|
85511
|
+
},
|
|
85512
|
+
composer: {
|
|
85513
|
+
enabled: true
|
|
85514
|
+
},
|
|
85515
|
+
controls: {
|
|
85516
|
+
enabled: false
|
|
85517
|
+
},
|
|
85518
|
+
debug: {
|
|
85519
|
+
grid: false,
|
|
85520
|
+
axes: false
|
|
85521
|
+
}
|
|
85522
|
+
});
|
|
85523
|
+
var Renderer = _Renderer;
|
|
85524
|
+
|
|
85525
|
+
// src/renderer/SceneObjectOptions.ts
|
|
85526
|
+
init_dirname();
|
|
85527
|
+
init_buffer2();
|
|
85528
|
+
init_process2();
|
|
85529
|
+
|
|
85530
|
+
// src/skin/index.ts
|
|
85531
|
+
init_dirname();
|
|
85532
|
+
init_buffer2();
|
|
85533
|
+
init_process2();
|
|
85534
|
+
|
|
85535
|
+
// src/skin/Skins.ts
|
|
85536
|
+
init_dirname();
|
|
85537
|
+
init_buffer2();
|
|
85538
|
+
init_process2();
|
|
85539
|
+
var Skins = class {
|
|
85540
|
+
//<editor-fold desc="Skins">
|
|
85541
|
+
static async fromUuidOrUsername(uuidOrUsername) {
|
|
85542
|
+
if (uuidOrUsername.length === 32 || uuidOrUsername.length === 36) {
|
|
85543
|
+
return this.fromUuid(uuidOrUsername);
|
|
85544
|
+
}
|
|
85545
|
+
return this.fromUsername(uuidOrUsername);
|
|
85546
|
+
}
|
|
85547
|
+
static async fromUuid(uuid) {
|
|
85548
|
+
return this.getSkinProxySkinUrl(uuid);
|
|
85549
|
+
}
|
|
85550
|
+
static async fromUsername(username) {
|
|
85551
|
+
return this.usernameToUuid(username).then((uuid) => {
|
|
85552
|
+
if (uuid) {
|
|
85553
|
+
return this.fromUuid(uuid);
|
|
85554
|
+
}
|
|
85555
|
+
return void 0;
|
|
85556
|
+
});
|
|
85557
|
+
}
|
|
85558
|
+
static async fromMineSkin(mineskinId) {
|
|
85559
|
+
return this.getMineSkin(mineskinId).then((mineskin) => {
|
|
85560
|
+
if (mineskin) {
|
|
85561
|
+
return mineskin["data"]["texture"]["value"]["urls"]["skins"];
|
|
85562
|
+
}
|
|
85563
|
+
return void 0;
|
|
85564
|
+
});
|
|
85565
|
+
}
|
|
85566
|
+
//</editor-fold>
|
|
85567
|
+
//<editor-fold desc="Capes">
|
|
85568
|
+
static async capeFromUuidOrUsername(uuidOrUsername) {
|
|
85569
|
+
if (uuidOrUsername.length === 32 || uuidOrUsername.length === 36) {
|
|
85570
|
+
return this.capeFromUuid(uuidOrUsername);
|
|
85571
|
+
}
|
|
85572
|
+
return this.capeFromUsername(uuidOrUsername);
|
|
85573
|
+
}
|
|
85574
|
+
static async capeFromUuid(uuid) {
|
|
85575
|
+
return this.getSkinProxyCapeUrl(uuid);
|
|
85576
|
+
}
|
|
85577
|
+
static async capeFromUsername(username) {
|
|
85578
|
+
return this.usernameToUuid(username).then((uuid) => {
|
|
85579
|
+
if (uuid) {
|
|
85580
|
+
return this.capeFromUuid(uuid);
|
|
85581
|
+
}
|
|
85582
|
+
return void 0;
|
|
85583
|
+
});
|
|
85584
|
+
}
|
|
85585
|
+
static async capeFromCapesDev(uuid, capeType = "minecraft") {
|
|
85586
|
+
return this.getCapesDev(uuid, capeType).then((cape) => {
|
|
85587
|
+
if (cape) {
|
|
85588
|
+
return cape?.stillImageUrl;
|
|
85589
|
+
}
|
|
85590
|
+
return void 0;
|
|
85591
|
+
});
|
|
85592
|
+
}
|
|
85593
|
+
//</editor-fold>
|
|
85594
|
+
//<editor-fold desc="Helpers">
|
|
85595
|
+
static async usernameToUuid(username) {
|
|
85596
|
+
return this.usernameToUuidSkinProxy(username);
|
|
85597
|
+
}
|
|
85598
|
+
static async usernameToUuidSkinProxy(username) {
|
|
85599
|
+
return Requests.genericRequest({
|
|
85600
|
+
baseURL: "https://minecraft-skin-proxy.inventive.workers.dev",
|
|
85601
|
+
url: "/uuid/" + username
|
|
85602
|
+
}).then((res) => {
|
|
85603
|
+
if (res.status === 200) {
|
|
85604
|
+
return res.data["id"];
|
|
85605
|
+
}
|
|
85606
|
+
return void 0;
|
|
85607
|
+
}).catch((err) => {
|
|
85608
|
+
console.warn(err);
|
|
85609
|
+
return void 0;
|
|
85610
|
+
});
|
|
85611
|
+
}
|
|
85612
|
+
static async usernameToUuidMineTools(username) {
|
|
85613
|
+
return Requests.genericRequest({
|
|
85614
|
+
baseURL: "https://api.minetools.eu",
|
|
85615
|
+
url: "/uuid/" + username
|
|
85616
|
+
}).then((res) => {
|
|
85617
|
+
if (res.status === 200) {
|
|
85618
|
+
return res.data["id"];
|
|
85619
|
+
}
|
|
85620
|
+
return void 0;
|
|
85621
|
+
}).catch((err) => {
|
|
85622
|
+
console.warn(err);
|
|
85623
|
+
return void 0;
|
|
85624
|
+
});
|
|
85625
|
+
}
|
|
85626
|
+
static async getProfileFromMinetools(uuid) {
|
|
85627
|
+
return Requests.genericRequest({
|
|
85628
|
+
baseURL: "https://api.minetools.eu",
|
|
85629
|
+
url: "/profile/" + uuid
|
|
85630
|
+
}).then((res) => {
|
|
85631
|
+
if (res.status === 200) {
|
|
85632
|
+
return res.data;
|
|
85633
|
+
}
|
|
85634
|
+
});
|
|
85635
|
+
}
|
|
85636
|
+
static async getMineSkin(mineskinId) {
|
|
85637
|
+
return Requests.genericRequest({
|
|
85638
|
+
baseURL: "https://api.mineskin.org",
|
|
85639
|
+
url: "/get/uuid/" + mineskinId
|
|
85640
|
+
}).then((res) => {
|
|
85641
|
+
if (res.status === 200) {
|
|
85642
|
+
return res.data;
|
|
85643
|
+
}
|
|
85644
|
+
return void 0;
|
|
85645
|
+
}).catch((err) => {
|
|
85646
|
+
console.warn(err);
|
|
85647
|
+
return void 0;
|
|
85648
|
+
});
|
|
85649
|
+
}
|
|
85650
|
+
static async getCapesDev(uuid, type = "all") {
|
|
85651
|
+
return Requests.genericRequest({
|
|
85652
|
+
baseURL: "https://api.capes.dev",
|
|
85653
|
+
url: "/load/" + uuid + "/" + type
|
|
85654
|
+
}).then((res) => {
|
|
85655
|
+
if (res.status === 200) {
|
|
85656
|
+
return res.data;
|
|
85657
|
+
}
|
|
85658
|
+
return void 0;
|
|
85659
|
+
}).catch((err) => {
|
|
85660
|
+
console.warn(err);
|
|
85661
|
+
return void 0;
|
|
85662
|
+
});
|
|
85663
|
+
}
|
|
85664
|
+
static getCrafatarSkinUrl(uuid) {
|
|
85665
|
+
return "https://crafatar.com/skins/" + uuid;
|
|
85666
|
+
}
|
|
85667
|
+
static getCrafatarCapeUrl(uuid) {
|
|
85668
|
+
return "https://crafatar.com/capes/" + uuid;
|
|
85669
|
+
}
|
|
85670
|
+
static getMcHeadsSkinUrl(uuid) {
|
|
85671
|
+
return "https://mc-heads.net/skin/" + uuid;
|
|
85672
|
+
}
|
|
85673
|
+
static getMineSkinPlayerSkinUrl(uuid) {
|
|
85674
|
+
return "https://mineskin.org/skin/player/" + uuid;
|
|
85675
|
+
}
|
|
85676
|
+
static getSkinProxySkinUrl(uuid) {
|
|
85677
|
+
return "https://minecraft-skin-proxy.inventive.workers.dev/skin/" + uuid;
|
|
85678
|
+
}
|
|
85679
|
+
static getSkinProxyCapeUrl(uuid) {
|
|
85680
|
+
return "https://minecraft-skin-proxy.inventive.workers.dev/cape/" + uuid;
|
|
85681
|
+
}
|
|
85682
|
+
//</editor-fold>
|
|
85683
|
+
};
|
|
85684
|
+
|
|
85685
|
+
// src/skin/scene/index.ts
|
|
85686
|
+
init_dirname();
|
|
85687
|
+
init_buffer2();
|
|
85688
|
+
init_process2();
|
|
85689
|
+
|
|
85690
|
+
// src/texture/index.ts
|
|
85691
|
+
init_dirname();
|
|
85692
|
+
init_buffer2();
|
|
85693
|
+
init_process2();
|
|
85694
|
+
|
|
85695
|
+
// src/three/index.ts
|
|
85696
|
+
init_dirname();
|
|
85697
|
+
init_buffer2();
|
|
85698
|
+
init_process2();
|
|
85699
|
+
|
|
85578
85700
|
// src/world/index.ts
|
|
85579
85701
|
init_dirname();
|
|
85580
85702
|
init_buffer2();
|