Slim skins

This commit is contained in:
2026-09-27 13:55:46 -03:00
parent d822267bd3
commit d0cbec1846
8 changed files with 89 additions and 13 deletions
+4 -1
View File
@@ -8,6 +8,8 @@ export abstract class Player extends Entity {
name: string;
// undefined draws the default skin
skin: Texture | undefined;
// 3 pixel wide arms, for skins made for them
slim = false;
#skin_version = 0;
// how far the limbs have swung and how hard they swing (0 to 1), like minecraft's WalkAnimationState
@@ -21,7 +23,7 @@ export abstract class Player extends Entity {
}
// a base64 png from the server, or undefined for the default. the old skin stays until the new one is decoded
async set_skin(skin: string | undefined) {
async set_skin(skin: string | undefined, slim = false) {
const version = ++this.#skin_version;
const texture = skin ? await decode_skin(skin) : undefined;
if (version !== this.#skin_version) {
@@ -31,6 +33,7 @@ export abstract class Player extends Entity {
}
this.skin?.tex.destroy();
this.skin = texture;
this.slim = slim;
}
// after moving each tick. full speed is 5 blocks per second, a bit faster than walking
+1 -1
View File
@@ -21,7 +21,7 @@ export class RemotePlayer extends Player {
this.yaw = info.yaw;
this.pitch = info.pitch;
if (info.skin) {
this.set_skin(info.skin);
this.set_skin(info.skin, info.slim);
}
}