Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: A checklist for all the things to check on a new minecraft version #465

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"editor.formatOnType": false,
"editor.formatOnPaste": false,
"editor.codeActionsOnSave": {
"source.organizeImports": true
"source.organizeImports": "explicit"
},
"editor.defaultFormatter": "ms-python.black-formatter"
}
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,11 @@ $ poetry run black --check beet tests

---

The documentation is build with [mudkip](https://github.com/vberlier/mudkip).

```bash
poetry run mudkip develop

```

License - [MIT](https://github.com/mcbeet/beet/blob/main/LICENSE)
33 changes: 33 additions & 0 deletions beet/contrib/worldgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@
"WorldgenTemplatePool",
"WorldgenWorldPreset",
"WorldgenFlatLevelGeneratorPreset",
"WorldgenMultiNoiseBiomeSourceParameterList",
"WorldgenBiomeTag",
"WorldgenStructureSetTag",
"WorldgenStructureTag",
"WorldgenConfiguredCarverTag",
"WorldgenPlacedFeatureTag",
"WorldgenFlatLevelGeneratorPresetTag",
"WorldgenWorldPresetTag",
]


Expand Down Expand Up @@ -56,11 +59,14 @@ def worldgen(pack: Union[Context, DataPack]):
WorldgenTemplatePool,
WorldgenWorldPreset,
WorldgenFlatLevelGeneratorPreset,
WorldgenMultiNoiseBiomeSourceParameterList,
WorldgenBiomeTag,
WorldgenStructureSetTag,
WorldgenStructureTag,
WorldgenConfiguredCarverTag,
WorldgenPlacedFeatureTag,
WorldgenFlatLevelGeneratorPresetTag,
WorldgenWorldPresetTag,
]


Expand Down Expand Up @@ -176,6 +182,16 @@ class WorldgenFlatLevelGeneratorPreset(JsonFile):
extension: ClassVar[str] = ".json"


class WorldgenMultiNoiseBiomeSourceParameterList(JsonFile):
"""Class representing a worldgen multi noise biome source parameter list."""

scope: ClassVar[NamespaceFileScope] = (
"worldgen",
"multi_noise_biome_source_parameter_list",
)
extension: ClassVar[str] = ".json"


class WorldgenBiomeTag(TagFile):
"""Class representing a biome tag."""

Expand Down Expand Up @@ -204,3 +220,20 @@ class WorldgenPlacedFeatureTag(TagFile):
"""Class representing a worldgen placed feature tag."""

scope: ClassVar[NamespaceFileScope] = ("tags", "worldgen", "placed_feature")


class WorldgenFlatLevelGeneratorPresetTag(TagFile):
"""Class representing a worldgen flat level generator preset tag."""

scope: ClassVar[NamespaceFileScope] = (
"tags",
"worldgen",
"flat_level_generator_preset",
)


# world_preset
class WorldgenWorldPresetTag(TagFile):
"""Class representing a worldgen world preset tag."""

scope: ClassVar[NamespaceFileScope] = ("tags", "worldgen", "world_preset")
9 changes: 9 additions & 0 deletions beet/library/resource_pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,13 @@ class Text(TextFile):
extension: ClassVar[str] = ".txt"


class TextJson(JsonFile):
"""Class representing a json file in the texts folder (only used for credits.json)."""

scope: ClassVar[NamespaceFileScope] = ("texts",)
extension: ClassVar[str] = ".json"


class TextureMcmeta(JsonFile):
"""Class representing a texture mcmeta."""

Expand Down Expand Up @@ -337,6 +344,7 @@ class ResourcePackNamespace(Namespace):
vertex_shaders: NamespacePin[VertexShader] = NamespacePin(VertexShader)
glsl_shaders: NamespacePin[GlslShader] = NamespacePin(GlslShader)
texts: NamespacePin[Text] = NamespacePin(Text)
texts_json: NamespacePin[TextJson] = NamespacePin(TextJson)
textures_mcmeta: NamespacePin[TextureMcmeta] = NamespacePin(TextureMcmeta)
textures: NamespacePin[Texture] = NamespacePin(Texture)
sounds: NamespacePin[Sound] = NamespacePin(Sound)
Expand Down Expand Up @@ -392,6 +400,7 @@ class ResourcePack(Pack[ResourcePackNamespace]):
vertex_shaders: NamespaceProxyDescriptor[VertexShader] = NamespaceProxyDescriptor(VertexShader)
glsl_shaders: NamespaceProxyDescriptor[GlslShader] = NamespaceProxyDescriptor(GlslShader)
texts: NamespaceProxyDescriptor[Text] = NamespaceProxyDescriptor(Text)
texts_json: NamespaceProxyDescriptor[TextJson] = NamespaceProxyDescriptor(TextJson)
textures_mcmeta: NamespaceProxyDescriptor[TextureMcmeta] = NamespaceProxyDescriptor(TextureMcmeta)
textures: NamespaceProxyDescriptor[Texture] = NamespaceProxyDescriptor(Texture)
sounds: NamespaceProxyDescriptor[Sound] = NamespaceProxyDescriptor(Sound)
Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ You can follow the development of the project, discuss ideas, get help, and hang
:maxdepth: 2

getting_started/index
update_guide
rationale
overview
changelog
Expand Down
37 changes: 37 additions & 0 deletions docs/update_guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Update guide

```{admonition} Warning
:class: warning
This part is intended for maintainers.
```

This little guide documents checklist to update beet when a new minecraft version came out.

## Update `LATEST_MINECRAFT_VERSION`

In `beet/library/base.py` you need to update the variable at every minor update (going from 1.21.1 to 1.21.2).



## Changing the pack format

Both in `beet/library/data_pack.py` and `beet/library/resource_pack.py` require the pack format to be changed in the `pack_format_registry` variable.

- If the new version is a patch (going from 1.21.1 to 1.21.2), you need to update the `(1, 21)` entry
- If it's a minor version (1.21.4 to 1.22), you need to add the `(1, 22)` entry


## Adding new registries

Reading the changelog, you need to add the new registries in both `beet/library/data_pack.py` and `beet/library/resource_pack.py`.

To be sure that you don't miss something, you can run :
```bash
poetry run python tests/test_scopes.py <minecraft_version>
```


## Follow Contributing rules in the Readme
Running the test suite, code formatter and type checker.


63 changes: 63 additions & 0 deletions tests/test_scopes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
from beet.contrib.vanilla import Vanilla
from beet.contrib.unknown_files import UnknownAsset, UnknownData
import tempfile

from beet.core.cache import Cache
from beet.library.base import LATEST_MINECRAFT_VERSION
from beet.toolchain.helpers import run_beet
from zipfile import ZipFile
import sys


def main(version: str = LATEST_MINECRAFT_VERSION):
# Test that all namespaces are known
# It loads the vanilla jar and checks
# that there are no unknown namespaces
with tempfile.TemporaryDirectory() as dir:
cache = Cache(dir)
vanilla = Vanilla(cache=cache, minecraft_version=version)
client_jar = vanilla.mount()
with run_beet(
{
"require": ["beet.contrib.unknown_files"],
"output": "build",
},
) as ctx:
# We loads directly from the jar file
ctx.data.load(ZipFile(client_jar.path))
ctx.assets.load(ZipFile(client_jar.path))

known_assets: set[str] = {
"minecraft:gpu_warnlist.json",
"minecraft:regional_compliancies.json",
}
unknown_assets: list[str] = []
for x in ctx.assets[UnknownAsset].keys():
if x in known_assets:
continue
unknown_assets.append(x)
if unknown_assets:
raise ValueError(
f"An unknown asset has no NamespaceFileType: {unknown_assets}"
)

known_data: set[str] = set()
unknown_data: list[str] = []
for x in ctx.data[UnknownData].keys():
if x in known_data:
continue
if x.startswith("minecraft:datapacks/"):
# We ignore datapacks
continue
unknown_data.append(x)
if unknown_data:
raise ValueError(
f"An unknown data has no NamespaceFileType: {unknown_data}"
)


if __name__ == "__main__":
if len(sys.argv) == 2:
main(sys.argv[1])
else:
print("Usage : `python tests/test_scopes.py 1.21.4`")