.vscode | ||
bin | ||
inputs | ||
outputs | ||
src | ||
.gitignore | ||
.npmignore | ||
.prettierrc | ||
LICENSE.txt | ||
package-lock.json | ||
package.json | ||
README.md | ||
tsconfig.json |
Mson -> THREE
Convert Mson models to THREE.js object JSON or GLTF.
Setup
- Clone and
npm install
. Optional dependencies are required when using this on Node.js (see implementation notes below). - copy the folder at https://github.com/MineLittlePony/Mson/tree/1.20.2/src/main/resources/assets/mson/models/entity as
inputs/mson
- build
npm run build
- 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
- Mson models seem to have the X and Y coordinates inverse of what THREE.js uses (and Minecraft for that matter, lol).
- Many Mson example models do not work. They seem to be all either outdated or just outright broken. Mine Little Pony works fine, though.
- 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.
- 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 (andsrc/cli.ts
+src/node
) to use this library on the browser. - The parser and object generator by themselves have no dependencies except for THREE.js, of course.
- Output could be further optimized by merging composite objects into a single geometry, but this is not yet done.