Skip to main content

vanilla-mcdoc

Pydantic models for every file in Minecraft: Java Edition's data packs and resource packs: recipes, advancements, loot tables, worldgen, item models, and the rest. They're generated from vanilla-mcdoc, the schemas that Spyglass uses to validate packs, so they follow every Minecraft release and snapshot.

from vanilla_mcdoc.data import Smelting

recipe = Smelting.model_validate({
    "type": "minecraft:smelting",
    "ingredient": "minecraft:iron_ore",
    "result": {"id": "minecraft:iron_ingot"},
    "experience": 0.7,
    "cookingtime": 200,
})
recipe.experience  # 0.7
recipe.model_dump(mode="json", exclude_none=True)  # Back to the JSON that goes in the pack

You can also build resources in pure Python, with no JSON at all. Every field is a real keyword argument, so your editor autocompletes field names and known IDs, shows each field's description, and a type checker flags a wrong field or type before you ever load the pack. Because they're plain Python objects, you can build a piece once and reuse it across several resources:

from vanilla_mcdoc.data import LootPool, LootTable
from vanilla_mcdoc.data.loot.function.LootFunction import LootFunctionSetCount
from vanilla_mcdoc.data.loot.LootPoolEntry import LootPoolEntryItem
from vanilla_mcdoc.data.recipe.Recipe import RecipeSmelting
from vanilla_mcdoc.world.item.ItemStack import ItemStack

ingot = ItemStack(id="minecraft:iron_ingot", count=2)

recipe = RecipeSmelting(
    ingredient="minecraft:raw_iron",
    result=ingot,
    experience=0.7,
    cookingtime=200,
)

loot_table = LootTable(
    pools=[
        LootPool(
            rolls=1,
            entries=[
                LootPoolEntryItem(name=ingot.id, modifier=LootFunctionSetCount(count=2)),
            ],
        ),
    ],
)

Installing

Requires Python 3.14 or later.

pip install vanilla-mcdoc

Each Minecraft version is its own package version, so you can install the one your pack targets:

You want Install
The newest release of Minecraft pip install vanilla-mcdoc
The newest snapshot, pre-release or RC pip install --pre vanilla-mcdoc
A particular version, e.g. 26.1.2 pip install "vanilla-mcdoc==26.1.2.*"

The package's version is the Minecraft version, padded to three numbers: 26.3 is 26.3.0, and the snapshot 26.4-snapshot-3 is 26.4.0a3 (pre-releases are b, release candidates rc). When the schemas are fixed or the generator improves, that Minecraft version gets a new build: 26.3.0.post1, 26.3.0.post2, and so on. ==26.3.0.* always gets the newest build of 26.3. To check which one you have:

import vanilla_mcdoc

vanilla_mcdoc.__minecraft_version__  # "26.3"
vanilla_mcdoc.__mcdoc_commit__       # The vanilla-mcdoc commit it was generated from

Using it

Every schema is importable from a module that mirrors where vanilla-mcdoc defines it, e.g. vanilla_mcdoc.data.recipe.Smelting, vanilla_mcdoc.assets.item_definition.ItemModel, or vanilla_mcdoc.world.item.ItemStackTemplate. Names that only one module uses can also be imported straight from vanilla_mcdoc.data or vanilla_mcdoc.assets, as in the example above.

Models (classes) validate with Model.model_validate(data), or Model(...) with keyword arguments, like any pydantic model. Invalid data raises pydantic's ValidationError, saying where and why:

1 validation error for Smelting
cookingtime
  Input should be a valid integer, unable to parse string as an integer [type=int_parsing, input_value='slow', input_type=str]

Unions are type aliases rather than classes, e.g. a loot function can be any one of dozens of kinds, so they're validated with a TypeAdapter, which gives you back the right model:

from pydantic import TypeAdapter
from vanilla_mcdoc.data.loot.function.LootFunction import LootFunction

function = TypeAdapter(LootFunction).validate_python({"type": "minecraft:set_count", "count": 3})
type(function).__name__  # "LootFunctionSetCount"

Root resources, the ones that are files of their own in a pack, know which folder they go in, e.g. Smelting.__resource_dir__ == "recipe". vanilla_mcdoc.root_resource_registry lists all of them, in ROOT_DATAPACK_CLASSES and ROOT_RESOURCE_PACK_CLASSES.

A few more things worth knowing:

  • Unknown keys are kept, not dropped, so data the schemas don't cover yet survives a round trip.
  • Fields renamed to be valid Python (e.g. from becomes from_) still read and write the real JSON key.
  • Resource locations accept both forms: "minecraft:stone" and "stone". Where vanilla-mcdoc lists a registry's entries, they're in its type too (e.g. KnownItemId), so your editor can autocomplete them.
  • Importing it takes about 2 seconds, as it imports every model (so they can all refer to each other). After that, each model's validator is built the first time it's used, which is quick, and validating is fast.

Vanilla's own files

Vanilla's data pack and resource pack files are in vanilla_mcdoc.vanilla, already made into their models, in the same folders as in the game (minus the minecraft namespace folder):

from vanilla_mcdoc.vanilla.data.recipe import TNT_MINECART

TNT_MINECART.result.id  # "minecraft:tnt_minecart"
TNT_MINECART.model_dump(mode="json", exclude_unset=True)  # Exactly what's in vanilla's tnt_minecart.json

Each one is named after its file, in capitals, so data/minecraft/loot_table/entities/sheep.json is SHEEP in vanilla_mcdoc.vanilla.data.loot_table.entities. Ones that start with a number get a _ first, e.g. the jukebox song 11.json is _11.

Where it comes from

The generator, and how the package gets published, live at UP929312/vanilla_mcdoc_to_python. It reads vanilla-mcdoc's symbols.json (with the list of Minecraft versions from misode/mcmeta), and checks for updates every hour, so a new snapshot is usually on PyPI shortly after Spyglass has updated its schemas.

If something doesn't match what Minecraft accepts, it's either a gap in vanilla-mcdoc or a bug in the generator. Issues are welcome at the generator's repository.

This project isn't affiliated with Mojang, Microsoft or the Spyglass team.

Metadata

Release files for vanilla-mcdoc 26.1.2.post3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vanilla-mcdoc 26.1.2.post3
File Size Uploaded Provenance Actions
vanilla_mcdoc-26.1.2.post3.tar.gz 813.0 kB With provenance Details for vanilla_mcdoc-26.1.2.post3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for vanilla-mcdoc 26.1.2.post3
File Interpreter ABI Platform Actions
vanilla_mcdoc-26.1.2.post3-py3-none-any.whl Python 3 none any Details for vanilla_mcdoc-26.1.2.post3-py3-none-any.whl

Total release size: 2.6 MB

Release files / vanilla_mcdoc-26.1.2.post3.tar.gz

Download URL vanilla_mcdoc-26.1.2.post3.tar.gz
Size 813.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ac9d7d42f0074c21c9051381d3b7ef421ee0594b066cb9411c1e26470eff365b
BLAKE2b-256 checksum
How to use checksums
bfc74a884291869ebfc46028782344e9052d6248f1dad4dbc5c8c9ed08789e17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

Release files / vanilla_mcdoc-26.1.2.post3-py3-none-any.whl

Download URL vanilla_mcdoc-26.1.2.post3-py3-none-any.whl
Size 1.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
beed7a1a77467043c89453004f603bcbb0692208e9af9fda1dd1ee0563b45b4a
BLAKE2b-256 checksum
How to use checksums
fd8fb973ce63dfe7177645912df2b3fb5b3ebe1e02c6839b4ceea3161b76cfdf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

Security for vanilla-mcdoc 26.1.2.post3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for vanilla_mcdoc-26.1.2.post3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page