Slim skins
This commit is contained in:
@@ -79,6 +79,29 @@ const PARTS: ModelPart[] = [
|
||||
},
|
||||
];
|
||||
|
||||
// slim (alex) skins have 3 pixel wide arms, half a pixel lower, like minecraft's PlayerModel with slim set
|
||||
const SLIM_ARMS: ModelPart[] = [
|
||||
{
|
||||
name: "right_arm",
|
||||
size: [3, 12, 4],
|
||||
pivot: [5, 21.5, 0],
|
||||
from: [-1, -10, -2],
|
||||
texture: [40, 16],
|
||||
overlay: [40, 32],
|
||||
inflate: 0.25,
|
||||
},
|
||||
{
|
||||
name: "left_arm",
|
||||
size: [3, 12, 4],
|
||||
pivot: [-5, 21.5, 0],
|
||||
from: [-2, -10, -2],
|
||||
texture: [32, 48],
|
||||
overlay: [48, 48],
|
||||
inflate: 0.25,
|
||||
},
|
||||
];
|
||||
const SLIM_PARTS = PARTS.map((part) => SLIM_ARMS.find((arm) => arm.name === part.name) ?? part);
|
||||
|
||||
// a box's faces, like minecraft's ModelPart.Cube. `rect` is where the face is in the box's texture, which is laid
|
||||
// out as in a skin: the top and bottom above the sides (right, front, left, back). corners go counter clockwise from
|
||||
// outside as [x, y, z, u, v], 0 for the low end and 1 for the high one
|
||||
@@ -139,7 +162,7 @@ export function render_player(player: Player, skin: Texture, partial_tick: numbe
|
||||
left_leg: -swing * 1.4,
|
||||
};
|
||||
|
||||
for (const part of PARTS) {
|
||||
for (const part of player.slim ? SLIM_PARTS : PARTS) {
|
||||
const sin = Math.sin(angles[part.name]);
|
||||
const cos = Math.cos(angles[part.name]);
|
||||
const [pivot_x, pivot_y, pivot_z] = part.pivot;
|
||||
|
||||
Reference in New Issue
Block a user