Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,22 @@ if hasattr(mc_data, 'items'):
## Supported Versions

Currently supported for detailed testing:
- `1.20.6`
- `1.20.5`
- `1.21.6`

Other versions in the [minecraft-data](https://github.com/PrismarineJS/minecraft-data) repository are accessible but may have incomplete data.

### Upstream data availability: full vs. stub versions

The [PrismarineJS minecraft-data](https://github.com/PrismarineJS/minecraft-data) repository does not ship full gameplay data for every Minecraft version. Some patch releases are published as **stubs** — directories containing only `version.json` (and occasionally `dataPaths.json`) — because their game data is unchanged from the previous full-data release. The stub still exists so that `version.json` can carry the correct protocol version number, but `items.json`, `blocks.json`, `recipes.json`, etc. are absent.

For the 1.20 and 1.21 series, the versions that ship **full data** (item/block/recipe/language/etc. JSON files) are:

- **1.20 series:** `1.20`, `1.20.2`, `1.20.3`, `1.20.5`
- **1.21 series:** `1.21.1`, `1.21.3`, `1.21.4`, `1.21.5`, `1.21.6`, `1.21.8`, `1.21.9`, `1.21.11`

**Stub-only versions** (e.g. `1.20.1`, `1.20.4`, `1.20.6`, `1.21`) are still accessible via `get_data_path()` but only expose `version.json`. If you need full gameplay data for one of those versions, use the nearest preceding full-data version from the list above.

## Data Source

This library provides Python access to the [PrismarineJS minecraft-data](https://github.com/PrismarineJS/minecraft-data) project, which contains comprehensive Minecraft game data in JSON format.
Expand Down
6 changes: 3 additions & 3 deletions minecraft_data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import sys

from minecraft_data.tools import convert, commondata
from minecraft_data.data import get_data_path
from minecraft_data.data import SUPPORTED_VERSIONS, get_data_path


class mod(sys.modules[__name__].__class__):
Expand All @@ -17,8 +17,8 @@ def __call__(self, version, edition="pc"):
return type(version, (object,), convert(_dir, version, edition))

def common(self, edition="pc"):
# For common data, use bundled data
_dir = os.path.join(os.path.dirname(__file__), "data/data/")
# Common data is version-independent; reuse any supported version's data root
_dir = get_data_path(SUPPORTED_VERSIONS[0])
return type("common", (object,), commondata(_dir, edition))


Expand Down
4 changes: 2 additions & 2 deletions minecraft_data/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pooch

# Supported Minecraft versions
SUPPORTED_VERSIONS = ["1.20.6", "1.21.6"]
SUPPORTED_VERSIONS = ["1.20.5", "1.21.6"]

# SHA256 hash for the 3.110.1 release tarball from GitHub
# This is a stable, immutable release that includes all supported Minecraft versions
Expand Down Expand Up @@ -49,7 +49,7 @@ def get_data_path(version: str) -> str:
"""Get the path to the minecraft-data directory for a given version.

Args:
version: Minecraft version (e.g., '1.20.6')
version: Minecraft version (e.g., '1.21.6')

Returns:
Path to the data directory for use with tools.convert()
Expand Down
2 changes: 1 addition & 1 deletion minecraft_data/tests/test_data_loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_get_data_path_error_message(self):
data.get_data_path("99.99.99")
pytest.fail("Should raise ValueError")
except ValueError as e:
assert "1.20.6" in str(e)
assert "1.20.5" in str(e)
assert "1.21.6" in str(e)

def test_pooch_base_url_configured(self):
Expand Down
12 changes: 4 additions & 8 deletions minecraft_data/tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,10 @@ def test_version_has_datapaths(self, version):
assert version_data is not None

def test_common_data(self):
"""Test loading common data if available."""
try:
common = minecraft_data.common()
assert common is not None
assert isinstance(common, type)
except FileNotFoundError:
# Common data may not be available in bundled data
pytest.skip("Common data not available in bundled data")
"""Test loading common data."""
common = minecraft_data.common()
assert common is not None
assert isinstance(common, type)

def test_unsupported_version_fallback(self):
"""Test that unsupported versions attempt fallback to bundled data."""
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "minecraft-data"
version = "3.20.2"
version = "3.20.3"
description = "Provide easy access to minecraft data in python"
authors = ["Vito Gamberini <vito@gamberini.email>"]
maintainers = ["Reuben Brasher <rkbrasher@gmail.com>"]
Expand Down
Loading