Skip to content
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
97 changes: 82 additions & 15 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ name: Build the web book

on:
push:
branches: main
branches:
- main
- '1.21'
workflow_dispatch:
inputs:
release:
Expand All @@ -18,31 +20,96 @@ on:

env:
PYPI_PACKAGE: hexdoc-hexcasting
DEPLOY: |
${{
github.event_name != 'pull_request'
&& contains(fromJson('["main","1.21"]'), github.ref_name)
}}
RELEASE: |
${{
github.event_name != 'push' && inputs.release
|| github.event_name == 'push' && startsWith(github.event.head_commit.message, '[Release]')
}}

permissions:
contents: read

jobs:
hexdoc:
uses: hexdoc-dev/actions/.github/workflows/hexdoc.yml@v1
build-hexdoc:
runs-on: ubuntu-latest
permissions:
contents: write
contents: read
pages: read
secrets:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
python-version: "3.11"
release: |-
${{
github.event_name != 'push' && inputs.release
|| github.event_name == 'push' && startsWith(github.event.head_commit.message, '[Release]')
}}
outputs:
pages-url: ${{ steps.build.outputs.pages-url }}
deploy: ${{ env.DEPLOY }}
release: ${{ env.RELEASE }}
steps:
- uses: actions/checkout@v6

- uses: actions/setup-python@v6
with:
python-version-file: .python-version

- uses: astral-sh/setup-uv@v6
with:
activate-environment: true
enable-cache: true

- name: Sync dependencies
run: uv sync --locked --no-dev

- id: build
uses: hexdoc-dev/actions/build@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release: ${{ env.RELEASE }}

deploy-pages:
needs:
- build-hexdoc
if: needs.build-hexdoc.outputs.deploy == 'true'
runs-on: ubuntu-latest
concurrency:
group: hexdoc-deploy-pages
cancel-in-progress: false
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v6
with:
python-version-file: .python-version

- uses: astral-sh/setup-uv@v6
with:
activate-environment: true
enable-cache: true

- name: Sync dependencies
run: uv sync --locked --no-dev

- name: Merge new hexdoc build into existing book
uses: hexdoc-dev/actions/merge@v1
with:
release: ${{ env.RELEASE }}
site-url: ${{ needs.build-hexdoc.outputs.pages-url }}

- name: Deploy to Pages
uses: hexdoc-dev/actions/deploy-pages@v1
with:
merge: false
release: ${{ env.RELEASE }}

publish-pypi:
runs-on: ubuntu-latest
needs: hexdoc
needs:
- build-hexdoc
- deploy-pages
if: |-
needs.hexdoc.outputs.release == 'true' &&
needs.build-hexdoc.outputs.release == 'true' &&
(github.event_name == 'push' || inputs.publish == 'PyPI')
environment:
name: pypi
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ jobs:
secrets:
GH_TOKEN: ""
with:
python-version: "3.11"
python-version: "3.12"
release: false
deploy-pages: false
site-url: https://hexcasting.hexxy.media
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12.10
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"editor.rulers": [120],
},
"ruff.organizeImports": true,
"ruff.lint.args": [
"--extend-ignore=I", // format on save is enabled, so don't show the squiggles
"ruff.lint.ignore": [
"I", // format on save is enabled, so don't show the squiggles
],
"python.languageServer": "Pylance",
"python.analysis.diagnosticMode": "workspace",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"neoforge:conditions": [
{
"type": "neoforge:not",
"value": {
"type": "neoforge:tag_empty",
"tag": "hexcasting:pans"
}
}
],
"type": "minecraft:crafting_shaped",
"category": "misc",
"key": {
"C": {
"tag": "hexcasting:pans"
},
"D": {
"item": "hexcasting:amethyst_dust"
}
},
"pattern": [
" D ",
"DCD",
" D "
],
"result": {
"count": 1,
"id": "hexcasting:pride_colorizer_pansexual"
}
}
21 changes: 0 additions & 21 deletions doc/LICENSE.txt

This file was deleted.

11 changes: 3 additions & 8 deletions doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,9 @@ For example:
## Setup

```sh
python3.11 -m venv venv

.\venv\Scripts\activate # Windows
. venv/bin/activate.fish # fish
source venv/bin/activate # everything else

# run from the repo root, not doc/
pip install -e .[dev]
uv sync
# required to generate __gradle_version__.py
uv pip install -e .
```

## Usage
Expand Down
36 changes: 25 additions & 11 deletions doc/hexdoc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,37 @@ default_branch = "main"

resource_dirs = [ # top takes priority
"resources",
"{_common.src}/main/resources",
"{_common.src}/generated/resources",
"{_fabric.src}/main/resources",
"{_fabric.src}/generated/resources",
"{_forge.src}/main/resources",
"{_forge.src}/generated/resources",
"{$_common.src}/main/resources",
"{$_common.src}/generated/resources",
"{$_fabric.src}/main/resources",
"{$_fabric.src}/generated/resources",
"{$_neoforge.src}/main/resources",
"{$_neoforge.src}/generated/resources",
{ modid="minecraft" },
{ modid="hexdoc" },
]
export_dir = "src/hexdoc_hexcasting/_export/generated"

[extra.hexcasting]
# NOTE: "!Raw" means "don't apply variable interpolation to this value"
_pattern_regex = { "!Raw"='make\(\s*"(?P<name>[a-zA-Z0-9_\/]+)",\s*(?:new )?(?:ActionRegistryEntry|OperationAction)\(\s*HexPattern\.fromAngles\(\s*"(?P<signature>[aqweds]+)",\s*HexDir.(?P<startdir>\w+)\)' }
_pattern_regex."!Raw" = '''(?x)
(?:make|registerHolder)\(
\s*
"(?P<name>[a-zA-Z0-9_\/]+)",
\s*
(?: \( \) \s -> \s*)?
(?:new\s)?(?:ActionRegistryEntry|OperationAction)\(
\s*
HexPattern\.fromAngles\(
\s*
"(?P<signature>[aqweds]+)",
\s*
HexDir.(?P<startdir>\w+)
\)
'''

[[extra.hexcasting.pattern_stubs]]
path = "{^^^_common.package}/common/lib/hex/HexActions.java"
path = "{$_common.package}/common/lib/hex/HexActions.java"
regex = "{^_pattern_regex}"

[textures]
Expand Down Expand Up @@ -52,6 +66,6 @@ package = "{src}/main/java/at/petrak/hexcasting"
src = "../Fabric/src"
package = "{src}/main/java/at/petrak/hexcasting/fabric"

[_forge]
src = "../Forge/src"
package = "{src}/main/java/at/petrak/hexcasting/forge"
[_neoforge]
src = "../Neoforge/src"
package = "{src}/main/java/at/petrak/hexcasting/neoforge"
2 changes: 1 addition & 1 deletion doc/src/hexdoc_hexcasting/_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from hexdoc.core.loader import ModResourceLoader
from hexdoc.core.properties import Properties
from hexdoc.minecraft import I18n
from hexdoc.patchouli import BookContext, FormatTree
from hexdoc.patchouli import FormatTree
from hexdoc.patchouli.text import STYLE_REGEX, SpecialStyleType, Style, resolve_macros
from hexdoc.plugin import (
HookReturn,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{% import "macros/textures.html.jinja" as texture_macros with context -%}
{% import "macros/images.html.jinja" as Images with context -%}

{{ texture_macros.render_texture(
name=brainsweepee.name,
texture=brainsweepee.texture,
class_names=["flay-recipe-entity"],
) }}
{{
Images.image(
name=brainsweepee.name,
image=brainsweepee.image,
class_names=["flay-recipe-entity"],
)
}}
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
{% import "macros/textures.html.jinja" as texture_macros with context -%}
{% import "macros/images.html.jinja" as Images with context -%}

{{ texture_macros.render_texture(
name=brainsweepee.level_name~" "~brainsweepee.profession_name,
texture=brainsweepee.texture,
class_names=["flay-recipe-entity"],
) }}
{{
Images.image(
name=brainsweepee.level_name~" "~brainsweepee.profession_name,
image=brainsweepee.image,
class_names=["flay-recipe-entity"],
)
}}

<div class="flay-recipe-villager-details">
<img
class="flay-recipe-villager-detail-icon"
alt="{{ _('effect.minecraft.hero_of_the_village') }}"
src="{{ 'minecraft:textures/mob_effect/hero_of_the_village.png'|hexdoc_texture }}"
src="{{ 'minecraft:textures/mob_effect/hero_of_the_village.png'|hexdoc_texture_image }}"
style="width: 16px; height:16px"
>
{% if brainsweepee.profession|string != "minecraft:none" %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% import "macros/textures.html.jinja" as texture_macros with context -%}
{% import "macros/images.html.jinja" as Images with context -%}

<details class="details-collapsible flay-recipe-details">
{% block collapse %}
Expand All @@ -9,44 +9,44 @@
{% endblock collapse %}

<div>
{% block title %}<h5>{{ recipe.result.name.name }}</h5>{% endblock %}
{% block title %}<h5>{{ recipe.result.Name.name }}</h5>{% endblock %}

<div class="flay-recipe">
{% block background %}
<img
class="flay-recipe-background"
alt="Flay Mind Recipe GUI"
src="{% block background_image %}{{
'hexcasting:textures/gui/hexdoc/brainsweep.png'|hexdoc_texture
'hexcasting:textures/gui/hexdoc/brainsweep.png'|hexdoc_texture_image
}}{% endblock %}"
>
{% endblock background %}

{% block brainsweepee %}
{% with brainsweepee=recipe.brainsweepee %}
{% include recipe.brainsweepee.template~".html.jinja" %}
{% with brainsweepee=recipe.entity_in %}
{% include recipe.entity_in.template~".html.jinja" %}
{% endwith %}
{% endblock brainsweepee %}

{% block ingredient %}
<div class="flay-recipe-block-ingredient">
{{ texture_macros.render_item(recipe.blockIn.block) }}
{{ Images.item(recipe.block_in.block) }}
</div>
{% endblock ingredient %}

{% block cost %}
<div class="flay-recipe-cost texture item-texture multi-textures cycle-textures">
{% for item in recipe.cost_items %}
<div class="texture item-texture {{ 'multi-texture-active' if loop.first }}">
{{ texture_macros.render_item(item|hexdoc_item, count=item.count, is_first=true) }}
{{ Images.item(item|hexdoc_item_image, count=item.count, is_first=true) }}
</div>
{% endfor %}
</div>
{% endblock cost %}

{% block result %}
<div class="flay-recipe-result">
{{ texture_macros.render_item(recipe.result.name) }}
{{ Images.item(recipe.result.Name) }}
</div>
{% endblock result %}
</div>
Expand Down
3 changes: 1 addition & 2 deletions doc/src/hexdoc_hexcasting/book/page/abstract_pages.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from types import NoneType
from typing import Any

from hexdoc.core import ResourceLocation
from hexdoc.core import I18n, ResourceLocation
from hexdoc.minecraft import LocalizedStr
from hexdoc.minecraft.i18n import I18n
from hexdoc.patchouli.page import PageWithText
from pydantic import ValidationInfo, field_validator, model_validator

Expand Down
Loading
Loading