minerender 2.1.0-alpha.29 → 2.1.0-alpha.30
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 +9 -5
- package/dist/browser/index.d.ts +9 -5
- package/dist/browser/index.js +27 -23
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +27 -23
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +30 -23
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +9 -5
- package/dist/node/index.d.ts +9 -5
- package/dist/node/index.js +28 -23
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +27 -23
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/bundle.js
CHANGED
|
@@ -45429,6 +45429,7 @@ return ${compiler2.callType("value", tagType)}
|
|
|
45429
45429
|
axisToVec3: () => axisToVec3,
|
|
45430
45430
|
base64decode: () => base64decode,
|
|
45431
45431
|
base64encode: () => base64encode,
|
|
45432
|
+
capeTextureSizes: () => capeTextureSizes,
|
|
45432
45433
|
captureException: () => captureException,
|
|
45433
45434
|
changeEvent: () => changeEvent,
|
|
45434
45435
|
clampRotationDegrees: () => clampRotationDegrees,
|
|
@@ -81366,10 +81367,10 @@ ${key}` : key;
|
|
|
81366
81367
|
});
|
|
81367
81368
|
return { material, slim, legacy: isLegacy };
|
|
81368
81369
|
}
|
|
81369
|
-
static async getCape(src) {
|
|
81370
|
+
static async getCape(src, layout = "minecraft") {
|
|
81370
81371
|
const image = await ImageLoader.getData(src);
|
|
81371
81372
|
const scale = image.width / 64;
|
|
81372
|
-
if (!Number.isInteger(scale) || scale < 1 || image.height !== image.width / 2) {
|
|
81373
|
+
if (layout === "minecraft" && (!Number.isInteger(scale) || scale < 1 || image.height !== image.width / 2)) {
|
|
81373
81374
|
throw new MineRenderError(`Invalid cape dimensions ${image.width}x${image.height}; expected 64x32 or an integer-scaled equivalent`);
|
|
81374
81375
|
}
|
|
81375
81376
|
return Caching.materialCache.get(`cape:${serializeImageKey({ src })}`, () => {
|
|
@@ -81438,6 +81439,16 @@ ${key}` : key;
|
|
|
81438
81439
|
}
|
|
81439
81440
|
};
|
|
81440
81441
|
|
|
81442
|
+
// src/skin/CapeLayout.ts
|
|
81443
|
+
init_dirname();
|
|
81444
|
+
init_buffer2();
|
|
81445
|
+
init_process2();
|
|
81446
|
+
var capeTextureSizes = {
|
|
81447
|
+
minecraft: [64, 32],
|
|
81448
|
+
optifine: [46, 22],
|
|
81449
|
+
labymod: [22, 17]
|
|
81450
|
+
};
|
|
81451
|
+
|
|
81441
81452
|
// src/skin/scene/SkinObject.ts
|
|
81442
81453
|
var SkinObject = class extends SceneObject {
|
|
81443
81454
|
constructor(options) {
|
|
@@ -81523,8 +81534,8 @@ ${key}` : key;
|
|
|
81523
81534
|
}
|
|
81524
81535
|
this.notifyDirty();
|
|
81525
81536
|
}
|
|
81526
|
-
/** Load a
|
|
81527
|
-
async setCapeTexture(src) {
|
|
81537
|
+
/** Load a cape texture in the selected layout, or pass undefined to remove the cape. */
|
|
81538
|
+
async setCapeTexture(src, layout = "minecraft") {
|
|
81528
81539
|
const load = ++this.capeLoad;
|
|
81529
81540
|
if (src === void 0) {
|
|
81530
81541
|
const group = this.getGroupByName("cape" /* CAPE */);
|
|
@@ -81532,20 +81543,22 @@ ${key}` : key;
|
|
|
81532
81543
|
this.notifyDirty();
|
|
81533
81544
|
return;
|
|
81534
81545
|
}
|
|
81535
|
-
const material = await SkinTextures.getCape(src);
|
|
81546
|
+
const material = await SkinTextures.getCape(src, layout);
|
|
81536
81547
|
if (load !== this.capeLoad) return;
|
|
81548
|
+
const size = capeTextureSizes[layout];
|
|
81549
|
+
const geometry = this._getBoxGeometryFromDimensions(
|
|
81550
|
+
classicSkinGeometries.cape,
|
|
81551
|
+
classicSkinTextureCoordinates.cape,
|
|
81552
|
+
size,
|
|
81553
|
+
size
|
|
81554
|
+
);
|
|
81537
81555
|
const mesh = this.getMeshByName("cape" /* CAPE */);
|
|
81538
81556
|
if (mesh) {
|
|
81539
81557
|
mesh.material = material;
|
|
81558
|
+
mesh.geometry = geometry;
|
|
81540
81559
|
} else {
|
|
81541
81560
|
const group = this.createAndAddGroup("cape" /* CAPE */, 0, 24, 2);
|
|
81542
81561
|
group.rotation.set(toRadians(-6), Math.PI, 0);
|
|
81543
|
-
const geometry = this._getBoxGeometryFromDimensions(
|
|
81544
|
-
classicSkinGeometries.cape,
|
|
81545
|
-
classicSkinTextureCoordinates.cape,
|
|
81546
|
-
[64, 32],
|
|
81547
|
-
[64, 32]
|
|
81548
|
-
);
|
|
81549
81562
|
const cape = this.createAndAddMesh("cape" /* CAPE */, group, geometry, material);
|
|
81550
81563
|
cape.position.set(0, -8, -0.5);
|
|
81551
81564
|
}
|
|
@@ -84522,13 +84535,10 @@ uniform float opacity;varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuf
|
|
|
84522
84535
|
return void 0;
|
|
84523
84536
|
});
|
|
84524
84537
|
}
|
|
84525
|
-
static
|
|
84526
|
-
|
|
84527
|
-
|
|
84528
|
-
|
|
84529
|
-
}
|
|
84530
|
-
return void 0;
|
|
84531
|
-
});
|
|
84538
|
+
/** Returns a full static cape texture for a username or UUID. */
|
|
84539
|
+
static async capeFromCapesDev(player, capeType = "minecraft") {
|
|
84540
|
+
const cape = await this.getCapesDev(player, capeType);
|
|
84541
|
+
return cape?.exists ? cape.imageUrls?.still?.full : void 0;
|
|
84532
84542
|
}
|
|
84533
84543
|
//</editor-fold>
|
|
84534
84544
|
//<editor-fold desc="Helpers">
|
|
@@ -84602,18 +84612,15 @@ uniform float opacity;varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuf
|
|
|
84602
84612
|
return void 0;
|
|
84603
84613
|
});
|
|
84604
84614
|
}
|
|
84605
|
-
static async getCapesDev(
|
|
84615
|
+
static async getCapesDev(player, type = "all") {
|
|
84606
84616
|
return Requests.genericRequest({
|
|
84607
84617
|
baseURL: "https://api.capes.dev",
|
|
84608
|
-
url: "/load/" +
|
|
84618
|
+
url: "/load/" + encodeURIComponent(player) + "/" + encodeURIComponent(type)
|
|
84609
84619
|
}).then((res) => {
|
|
84610
84620
|
if (res.status === 200) {
|
|
84611
84621
|
return res.data;
|
|
84612
84622
|
}
|
|
84613
84623
|
return void 0;
|
|
84614
|
-
}).catch((err) => {
|
|
84615
|
-
console.warn(err);
|
|
84616
|
-
return void 0;
|
|
84617
84624
|
});
|
|
84618
84625
|
}
|
|
84619
84626
|
static getCrafatarSkinUrl(uuid) {
|