minerender 2.1.0-alpha.25 → 2.1.0-alpha.27

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.
@@ -725,6 +725,7 @@ interface EntityModelFile extends MinecraftAsset {
725
725
  }
726
726
  interface EntityModelLayer {
727
727
  texture: [number, number];
728
+ textureLocation?: string;
728
729
  root: EntityModelPart;
729
730
  }
730
731
  interface EntityModelPart {
@@ -899,7 +900,6 @@ declare class SkinObject extends SceneObject {
899
900
  readonly options: SkinObjectOptions;
900
901
  private slim;
901
902
  private legacy;
902
- private skinTextureSrc?;
903
903
  private skinTextureWidth;
904
904
  private skinTextureHeight;
905
905
  private capeTextureSrc?;
@@ -725,6 +725,7 @@ interface EntityModelFile extends MinecraftAsset {
725
725
  }
726
726
  interface EntityModelLayer {
727
727
  texture: [number, number];
728
+ textureLocation?: string;
728
729
  root: EntityModelPart;
729
730
  }
730
731
  interface EntityModelPart {
@@ -899,7 +900,6 @@ declare class SkinObject extends SceneObject {
899
900
  readonly options: SkinObjectOptions;
900
901
  private slim;
901
902
  private legacy;
902
- private skinTextureSrc?;
903
903
  private skinTextureWidth;
904
904
  private skinTextureHeight;
905
905
  private capeTextureSrc?;
@@ -2849,6 +2849,8 @@ var Entities = class {
2849
2849
  if (textureKey) {
2850
2850
  const path2 = isAssetKey(textureKey) ? textureKey.getFullPath() : textureKey.path;
2851
2851
  texture = isAssetKey(textureKey) && textureKey.assetType === "textures" && path2.startsWith("entity/") ? textureKey : new AssetKey(textureKey.namespace, path2, "textures", "entity", "assets", ".png", isAssetKey(textureKey) ? textureKey.root : void 0);
2852
+ } else if (layer.textureLocation !== void 0) {
2853
+ texture = AssetKey.parse("textures", layer.textureLocation.replace(/^([^:]+:)?textures\//, "$1"));
2852
2854
  } else {
2853
2855
  texture = await this.resolveTexture(modelKey);
2854
2856
  }
@@ -5603,7 +5605,41 @@ var baseSkinCoordinates = {
5603
5605
  var classicSkinTextureCoordinates = {
5604
5606
  ...baseSkinCoordinates
5605
5607
  };
5606
- var slimSkinTextureCoordinates = { ...baseSkinCoordinates };
5608
+ var slimSkinTextureCoordinates = {
5609
+ ...baseSkinCoordinates,
5610
+ leftArm: {
5611
+ ...baseSkinCoordinates.leftArm,
5612
+ west: { uv: [39, 52, 43, 64] },
5613
+ north: { uv: [36, 52, 39, 64] },
5614
+ south: { uv: [43, 52, 46, 64] },
5615
+ up: { uv: [39, 52, 36, 48] },
5616
+ down: { uv: [42, 48, 39, 52] }
5617
+ },
5618
+ rightArm: {
5619
+ ...baseSkinCoordinates.rightArm,
5620
+ west: { uv: [47, 20, 51, 32] },
5621
+ north: { uv: [44, 20, 47, 32] },
5622
+ south: { uv: [51, 20, 54, 32] },
5623
+ up: { uv: [47, 20, 44, 16] },
5624
+ down: { uv: [50, 16, 47, 20] }
5625
+ },
5626
+ leftSleeve: {
5627
+ ...baseSkinCoordinates.leftSleeve,
5628
+ west: { uv: [55, 52, 59, 64] },
5629
+ north: { uv: [52, 52, 55, 64] },
5630
+ south: { uv: [59, 52, 62, 64] },
5631
+ up: { uv: [55, 52, 52, 48] },
5632
+ down: { uv: [58, 48, 55, 52], rotation: 180 }
5633
+ },
5634
+ rightSleeve: {
5635
+ ...baseSkinCoordinates.rightSleeve,
5636
+ west: { uv: [47, 36, 51, 48] },
5637
+ north: { uv: [44, 36, 47, 48] },
5638
+ south: { uv: [51, 36, 54, 48] },
5639
+ up: { uv: [47, 36, 44, 32] },
5640
+ down: { uv: [50, 32, 47, 36], rotation: 180 }
5641
+ }
5642
+ };
5607
5643
 
5608
5644
  // src/skin/SkinGeometries.ts
5609
5645
  var box8inner = [8, 8, 8];
@@ -5713,7 +5749,6 @@ var SkinObject = class extends SceneObject {
5713
5749
  }
5714
5750
  setSkinTexture(src) {
5715
5751
  if (typeof src === "undefined") return;
5716
- this.skinTextureSrc = src;
5717
5752
  const mat = Materials.getImage({
5718
5753
  texture: { src },
5719
5754
  transparent: true
@@ -5727,18 +5762,18 @@ var SkinObject = class extends SceneObject {
5727
5762
  }
5728
5763
  //TODO: cape
5729
5764
  setSlim(slim) {
5730
- console.log("#setSlim");
5731
- const changed = slim !== this.slim;
5765
+ if (slim === this.slim) return;
5732
5766
  this.slim = slim;
5733
- if (changed) {
5734
- this.createMeshes();
5735
- }
5736
- if (changed) {
5737
- if (this.skinTextureSrc) {
5738
- this.setSkinTexture(this.skinTextureSrc);
5739
- }
5740
- }
5741
- console.log("#setSlim done");
5767
+ for (const part of ["leftArm" /* LEFT_ARM */, "leftSleeve" /* LEFT_SLEEVE */, "rightArm" /* RIGHT_ARM */, "rightSleeve" /* RIGHT_SLEEVE */]) {
5768
+ const mesh = this.getMeshByName(part);
5769
+ if (mesh) mesh.geometry = this.getBoxGeometry(part);
5770
+ }
5771
+ const offset = slim ? 0.5 : -0.5;
5772
+ const leftArm = this.getGroupByName("leftArm" /* LEFT_ARM */);
5773
+ const rightArm = this.getGroupByName("rightArm" /* RIGHT_ARM */);
5774
+ if (leftArm) leftArm.position.x += offset;
5775
+ if (rightArm) rightArm.position.x -= offset;
5776
+ this.notifyDirty();
5742
5777
  }
5743
5778
  setLegacy(legacy) {
5744
5779
  if (legacy !== this.legacy) {