mc-assets 0.2.3 → 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
 
@@ -33,7 +35,6 @@ This packages includes versions for: 1.7.10, 1.8, 1.8.1, 1.8.2, 1.8.3, 1.8.4, 1.
33
35
  <summary>Included Block Entities (Additional Block Models) (132):</summary>
34
36
 
35
37
  - ✅ item_frame
36
- - ✅ glow_item_frame
37
38
  - ✅ sign
38
39
  - ✅ wall_sign
39
40
  - ✅ acacia_sign
@@ -52,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.
52
53
  - ✅ crimson_wall_sign
53
54
  - ✅ warped_sign
54
55
  - ✅ warped_wall_sign
56
+ - ✅ glow_item_frame
55
57
  - ✅ mangrove_sign
56
58
  - ✅ mangrove_wall_sign
57
59
  - ✅ decorated_pot
@@ -324,3 +326,17 @@ const ButtonHighlighted = styled(Button)`
324
326
  ```
325
327
 
326
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,