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.
@@ -726,6 +726,7 @@ interface EntityModelFile extends MinecraftAsset {
726
726
  }
727
727
  interface EntityModelLayer {
728
728
  texture: [number, number];
729
+ textureLocation?: string;
729
730
  root: EntityModelPart;
730
731
  }
731
732
  interface EntityModelPart {
@@ -900,7 +901,6 @@ declare class SkinObject extends SceneObject {
900
901
  readonly options: SkinObjectOptions;
901
902
  private slim;
902
903
  private legacy;
903
- private skinTextureSrc?;
904
904
  private skinTextureWidth;
905
905
  private skinTextureHeight;
906
906
  private capeTextureSrc?;
@@ -726,6 +726,7 @@ interface EntityModelFile extends MinecraftAsset {
726
726
  }
727
727
  interface EntityModelLayer {
728
728
  texture: [number, number];
729
+ textureLocation?: string;
729
730
  root: EntityModelPart;
730
731
  }
731
732
  interface EntityModelPart {
@@ -900,7 +901,6 @@ declare class SkinObject extends SceneObject {
900
901
  readonly options: SkinObjectOptions;
901
902
  private slim;
902
903
  private legacy;
903
- private skinTextureSrc?;
904
904
  private skinTextureWidth;
905
905
  private skinTextureHeight;
906
906
  private capeTextureSrc?;
@@ -2890,6 +2890,8 @@ var Entities = class {
2890
2890
  if (textureKey) {
2891
2891
  const path2 = isAssetKey(textureKey) ? textureKey.getFullPath() : textureKey.path;
2892
2892
  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);
2893
+ } else if (layer.textureLocation !== void 0) {
2894
+ texture = AssetKey.parse("textures", layer.textureLocation.replace(/^([^:]+:)?textures\//, "$1"));
2893
2895
  } else {
2894
2896
  texture = await this.resolveTexture(modelKey);
2895
2897
  }
@@ -5648,7 +5650,41 @@ var baseSkinCoordinates = {
5648
5650
  var classicSkinTextureCoordinates = {
5649
5651
  ...baseSkinCoordinates
5650
5652
  };
5651
- var slimSkinTextureCoordinates = { ...baseSkinCoordinates };
5653
+ var slimSkinTextureCoordinates = {
5654
+ ...baseSkinCoordinates,
5655
+ leftArm: {
5656
+ ...baseSkinCoordinates.leftArm,
5657
+ west: { uv: [39, 52, 43, 64] },
5658
+ north: { uv: [36, 52, 39, 64] },
5659
+ south: { uv: [43, 52, 46, 64] },
5660
+ up: { uv: [39, 52, 36, 48] },
5661
+ down: { uv: [42, 48, 39, 52] }
5662
+ },
5663
+ rightArm: {
5664
+ ...baseSkinCoordinates.rightArm,
5665
+ west: { uv: [47, 20, 51, 32] },
5666
+ north: { uv: [44, 20, 47, 32] },
5667
+ south: { uv: [51, 20, 54, 32] },
5668
+ up: { uv: [47, 20, 44, 16] },
5669
+ down: { uv: [50, 16, 47, 20] }
5670
+ },
5671
+ leftSleeve: {
5672
+ ...baseSkinCoordinates.leftSleeve,
5673
+ west: { uv: [55, 52, 59, 64] },
5674
+ north: { uv: [52, 52, 55, 64] },
5675
+ south: { uv: [59, 52, 62, 64] },
5676
+ up: { uv: [55, 52, 52, 48] },
5677
+ down: { uv: [58, 48, 55, 52], rotation: 180 }
5678
+ },
5679
+ rightSleeve: {
5680
+ ...baseSkinCoordinates.rightSleeve,
5681
+ west: { uv: [47, 36, 51, 48] },
5682
+ north: { uv: [44, 36, 47, 48] },
5683
+ south: { uv: [51, 36, 54, 48] },
5684
+ up: { uv: [47, 36, 44, 32] },
5685
+ down: { uv: [50, 32, 47, 36], rotation: 180 }
5686
+ }
5687
+ };
5652
5688
 
5653
5689
  // src/skin/SkinGeometries.ts
5654
5690
  var box8inner = [8, 8, 8];
@@ -5758,7 +5794,6 @@ var SkinObject = class extends SceneObject {
5758
5794
  }
5759
5795
  setSkinTexture(src) {
5760
5796
  if (typeof src === "undefined") return;
5761
- this.skinTextureSrc = src;
5762
5797
  const mat = Materials.getImage({
5763
5798
  texture: { src },
5764
5799
  transparent: true
@@ -5772,18 +5807,18 @@ var SkinObject = class extends SceneObject {
5772
5807
  }
5773
5808
  //TODO: cape
5774
5809
  setSlim(slim) {
5775
- console.log("#setSlim");
5776
- const changed = slim !== this.slim;
5810
+ if (slim === this.slim) return;
5777
5811
  this.slim = slim;
5778
- if (changed) {
5779
- this.createMeshes();
5780
- }
5781
- if (changed) {
5782
- if (this.skinTextureSrc) {
5783
- this.setSkinTexture(this.skinTextureSrc);
5784
- }
5785
- }
5786
- console.log("#setSlim done");
5812
+ for (const part of ["leftArm" /* LEFT_ARM */, "leftSleeve" /* LEFT_SLEEVE */, "rightArm" /* RIGHT_ARM */, "rightSleeve" /* RIGHT_SLEEVE */]) {
5813
+ const mesh = this.getMeshByName(part);
5814
+ if (mesh) mesh.geometry = this.getBoxGeometry(part);
5815
+ }
5816
+ const offset = slim ? 0.5 : -0.5;
5817
+ const leftArm = this.getGroupByName("leftArm" /* LEFT_ARM */);
5818
+ const rightArm = this.getGroupByName("rightArm" /* RIGHT_ARM */);
5819
+ if (leftArm) leftArm.position.x += offset;
5820
+ if (rightArm) rightArm.position.x -= offset;
5821
+ this.notifyDirty();
5787
5822
  }
5788
5823
  setLegacy(legacy) {
5789
5824
  if (legacy !== this.legacy) {