mc-assets 0.2.2 → 0.2.4

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/README.MD CHANGED
@@ -21,6 +21,8 @@ npm i mc-assets
21
21
 
22
22
  This module was originally designed as standalone package for [https://mcraft.fun](mcraft.fun) (repo) project so it is easier to maintain, but now it became a library that I think can cover any use case where you need to work with minecraft assets. This library means block states, models data and texture contents, it doesn't cover minecraft-data use cases. With the best block model parser you can build your own renderers, editors, etc.
23
23
 
24
+ For contributing & building instructions see [building](#building) section.
25
+
24
26
  > Bundled modules & block states are version-accurate starting from 1.13.0 (post-flattening) version.
25
27
  > Tested on Node.js 18 and above.
26
28
 
@@ -30,8 +32,9 @@ All blockstates + models + all atlas textures for all versions bundled with rsbu
30
32
  This packages includes versions for: 1.7.10, 1.8, 1.8.1, 1.8.2, 1.8.3, 1.8.4, 1.8.5, 1.8.6, 1.8.7, 1.8.8, 1.8.9, 1.9, 1.9.1, 1.9.2, 1.9.3, 1.9.4, 1.10, 1.10.1, 1.10.2, 1.11, 1.11.1, 1.11.2, 1.12, 1.12.1, 1.12.2, 1.13, 1.13.1, 1.13.2, 1.14, 1.14.1, 1.14.2, 1.14.3, 1.14.4, 1.15, 1.15.1, 1.15.2, 1.16, 1.16.1, 1.16.2, 1.16.3, 1.16.4, 1.16.5, 1.17, 1.17.1, 1.18, 1.18.1, 1.18.2, 1.19, 1.19.1, 1.19.2, 1.19.3, 1.19.4, 1.20, 1.20.1, 1.20.2, 1.20.3, 1.20.4, 1.20.5, 1.20.6, 1.21.
31
33
 
32
34
  <details>
33
- <summary>Included Block Entities (Additional Block Models) (130):</summary>
35
+ <summary>Included Block Entities (Additional Block Models) (132):</summary>
34
36
 
37
+ - ✅ item_frame
35
38
  - ✅ sign
36
39
  - ✅ wall_sign
37
40
  - ✅ acacia_sign
@@ -50,6 +53,7 @@ This packages includes versions for: 1.7.10, 1.8, 1.8.1, 1.8.2, 1.8.3, 1.8.4, 1.
50
53
  - ✅ crimson_wall_sign
51
54
  - ✅ warped_sign
52
55
  - ✅ warped_wall_sign
56
+ - ✅ glow_item_frame
53
57
  - ✅ mangrove_sign
54
58
  - ✅ mangrove_wall_sign
55
59
  - ✅ decorated_pot
@@ -322,3 +326,17 @@ const ButtonHighlighted = styled(Button)`
322
326
  ```
323
327
 
324
328
  Please, don't use json / image files directly as their format is not stable and can change in the future, use the parsers instead.
329
+
330
+ ## Building
331
+
332
+ ```bash
333
+ pnpm i
334
+ # recommended but not required (will speed up build by fetching cache from gh-pages branch)
335
+ pnpm use-cached-datapaths
336
+ pnpm build
337
+ ```
338
+
339
+ Then if you only changing block entities, you can run `pnpm regen-blockentities` to regenerate block entities.
340
+ If you only change consumer code you can run `pnpm watch-dist` to watch for changes and rebuild.
341
+
342
+ To use in `minecraft-web-client` or your own project just run `pnpm link mc-assets` once or use `file:../mc-assets` in your `package.json` file if you are using other package manager.
@@ -87,17 +87,18 @@ export class AtlasParser {
87
87
  getLoadedImage: (name) => {
88
88
  const texture = newTextures[name];
89
89
  const image = texture.img;
90
- const imgSize = image.width;
90
+ const imgWidth = image.width;
91
+ const imgHeight = image.height;
91
92
  //@ts-ignore we no longer need the image, remove from atlas
92
93
  delete texture.img;
93
94
  return {
94
95
  image,
95
- renderWidth: texture.su * imgSize,
96
- renderHeight: texture.sv * imgSize,
97
- renderSourceStartX: texture.u * imgSize,
98
- renderSourceStartY: texture.v * imgSize,
99
- renderSourceWidth: texture.su * imgSize,
100
- renderSourceHeight: texture.sv * imgSize,
96
+ renderWidth: texture.su * imgWidth,
97
+ renderHeight: texture.sv * imgHeight,
98
+ renderSourceStartX: texture.u * imgWidth,
99
+ renderSourceStartY: texture.v * imgHeight,
100
+ renderSourceWidth: texture.su * imgWidth,
101
+ renderSourceHeight: texture.sv * imgHeight,
101
102
  };
102
103
  },
103
104
  tileSize: this.atlas.latest.tileSize,