Go to file
2024-04-25 17:18:44 +03:00
.vscode code stash 2024-02-18 12:42:09 +02:00
inputs code stash 2024-02-18 12:42:09 +02:00
outputs code stash 2024-02-18 12:42:09 +02:00
src cleanup, gltf output, readme 2024-04-25 17:18:44 +03:00
.gitignore code stash 2024-02-18 12:42:09 +02:00
.prettierrc code stash 2024-02-18 12:42:09 +02:00
LICENSE.txt cleanup, gltf output, readme 2024-04-25 17:18:44 +03:00
package-lock.json cleanup, gltf output, readme 2024-04-25 17:18:44 +03:00
package.json cleanup, gltf output, readme 2024-04-25 17:18:44 +03:00
README.md cleanup, gltf output, readme 2024-04-25 17:18:44 +03:00
tsconfig.json cleanup, gltf output, readme 2024-04-25 17:18:44 +03:00

Mson -> THREE

Convert Mson models to THREE.js object JSON or GLTF.

Setup

  1. Clone and npm install. Optional dependencies are required when using this on Node.js (see implementation notes below).
  2. copy the folder at https://github.com/MineLittlePony/Mson/tree/1.20.2/src/main/resources/assets/mson/models/entity as inputs/mson
  3. build npm run build
  4. run node lib/cli.js export <model name>

Output will be placed in outputs. For more options run node lib/cli.js export -h.

Implementation notes

  1. Mson models seem to have the X and Y coordinates inverse of what THREE.js uses (and Minecraft for that matter, lol).
  2. Many Mson example models do not work. They seem to be all either outdated or just outright broken. Mine Little Pony works fine, though.
  3. Most of the code here makes a lot of assumptions. This project is a reverse engineering of the format, not a Java to JavaScript port of Mson's rendering engine. It should not be used in any serious capacity, as it was only made as an experiment.
  4. THREE.js GLTF exporter does not support Node.js by default, so some extra junk was included to support it. You can omit pretty much the entire optionalDependencies array of items (and src/cli.ts + src/node) to use this library on the browser.
  5. The parser and object generator by themselves have no dependencies except for THREE.js, of course.
  6. Output could be further optimized by merging composite objects into a single geometry, but this is not yet done.