OrangeUtan / vscode-mcmodel-viewer

A VSCode extension for viewing Minecraft model files
MIT License
13 stars 0 forks source link

Minecraft Model Viewer

Visual Studio Marketplace Version GitHub semantic-release

Features

Open model in 3D viewer

There are 2 ways to open your models in the 3D viewer:

  1. Json files that are recognized as model files (must be located in an assets root) will have a menu item that opens them in the viewer
  2. Executing the command MCModelViewer: Open model in viewer will open the model currently selected in the editor in the viewer

Animated textures

Automatically detects if a texture is animated and plays the animation with 1 tick per frame.

Automatically resolves assets

Models reference textures and sometimes a parent model. The extension automatically searches for these assets in all assets roots contained in your workspace.

E.g. a model references the texture block/cake_bottom:

"textures": {
    "bottom": "block/cake_bottom"
}

The extension might resolve this reference to the texture assets_root/minecraft/textures/minecraft/block/cake_bottom.png.

External assets

Some models use assets outside of your workspace, e.g. if they use Vanilla Minecraft textures or depend on another resourcepack.
In this case you can add external assets roots, that the extension will include when trying to resolve a referenced asset:

E.g. this model references the Vanilla Minecraft texture for arrow entities:

"textures": {
    "particle": "entity/projectiles/arrow",
    "arrow": "entity/projectiles/arrow"
}

We could extracted all Vanilla Minecraft assets from the version JAR into the folder %APPDATA%/.minecraft/versions/1.16.5/assets/ and then add it as an assets root. The texture will then be resolved to %APPDATA%/.minecraft/versions/1.16.5/assets/minecraft/textures/entity/projectiles/arrow.png

Hot reload parents

If any ancestor of the currently opened model changes, the model will be automatically reloaded.

Assets roots

Asset roots are directories that contain assets for minecraft. Resourcepacks use them to overwrite or add custom assets. They containing a .mcassetsroot file and follow a certain directory structure:

assets_root
├╴.mcassetsroot
└╴<namespace>
   ├╴models
   │ ├╴block
   │ └╴item
   ├╴textures
   │ ├╴block
   │ └╴item
   ⠇