From 8afc0fe672a8bdcd5605649a62a6db1e875af4fc Mon Sep 17 00:00:00 2001 From: Pyrofab Date: Thu, 21 Mar 2024 03:37:03 +0100 Subject: [PATCH] Use resource roots to locate recipes --- jekyll_plugins/RecipeTag.rb | 12 +++++++++--- public/wiki/blast/index.md | 21 ++++++++++----------- public/wiki/rats-mischief/index.md | 7 +++---- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/jekyll_plugins/RecipeTag.rb b/jekyll_plugins/RecipeTag.rb index 4f027737..3d33635f 100644 --- a/jekyll_plugins/RecipeTag.rb +++ b/jekyll_plugins/RecipeTag.rb @@ -135,10 +135,16 @@ def cache self.class.cache end + def initialize(tag_name, markup, tokens) + super + @recipe_id = Liquid::Expression.parse(markup.strip) + end + def render(context) - recipe_root = context.registers[:page]["recipe_root"] - recipe_path = @markup.strip - url = recipe_root + recipe_path + site = context.registers[:site] + recipe_namespace, recipe_path = context.evaluate(@recipe_id).split(':') + recipe_root = site.data["mods"]["resource_roots"][recipe_namespace] + url = "#{recipe_root}/data/#{recipe_namespace}/recipes/#{recipe_path}.json" recipe = cache.getset(url) do begin diff --git a/public/wiki/blast/index.md b/public/wiki/blast/index.md index fc3bd2d9..7ecaa6ee 100644 --- a/public/wiki/blast/index.md +++ b/public/wiki/blast/index.md @@ -4,7 +4,6 @@ title: BLAST slug: blast curse_project: 349938 modrinth: true -recipe_root: https://raw.githubusercontent.com/Ladysnake/BLAST/1.13/src/main/resources/data/blast/recipes/ --- BLAST is a Minecraft fabric mod adding multiple explosives for use in survival or for messing around in creative. @@ -39,7 +38,7 @@ BLAST mainly focuses on various types of bombs with some common attributes:

Is defused and drops when coming into contact with water.

-{% recipe bomb.json %} +{% recipe "blast:bomb" %}
@@ -50,7 +49,7 @@ BLAST mainly focuses on various types of bombs with some common attributes:

Explodes underwater, but will not destroy any blocks.

-{% recipe trigger_bomb.json %} +{% recipe "blast:trigger_bomb" %}

Gold Tier

@@ -62,7 +61,7 @@ BLAST mainly focuses on various types of bombs with some common attributes:

Like other gold items, Piglins love this bomb!

-{% recipe golden_bomb.json %} +{% recipe "blast:golden_bomb" %}
@@ -71,7 +70,7 @@ BLAST mainly focuses on various types of bombs with some common attributes:

A version of the golden bomb with a trigger instead of a fuse.

It also explodes underwater without causing block destruction.

-{% recipe golden_trigger_bomb.json %} +{% recipe "blast:golden_trigger_bomb" %}

Diamond Tier

@@ -81,7 +80,7 @@ BLAST mainly focuses on various types of bombs with some common attributes:

Exceptions are bedrock, barriers, end portal frames, and other admin-exclusive blocks.

-{% recipe diamond_bomb.json %} +{% recipe "blast:diamond_bomb" %}
@@ -90,7 +89,7 @@ BLAST mainly focuses on various types of bombs with some common attributes:

A version of the diamond bomb with a trigger instead of a fuse.

It also explodes underwater without causing block destruction.

-{% recipe diamond_trigger_bomb.json %} +{% recipe "blast:diamond_trigger_bomb" %} @@ -100,8 +99,8 @@ Dirt Bombs can be crafted by surrounding normal bombs with 8 Dirt Blocks. Instea
-{% recipe dirt_bomb.json %} -{% recipe dirt_trigger_bomb.json %} +{% recipe "blast:dirt_bomb" %} +{% recipe "blast:dirt_trigger_bomb" %}
Dirt Bombs
@@ -112,8 +111,8 @@ Crafted like normal bombs with an Enderpearl as base material, this bomb has a *
-{% recipe pearl_bomb.json %} -{% recipe pearl_trigger_bomb.json %} +{% recipe "blast:pearl_bomb" %} +{% recipe "blast:pearl_trigger_bomb" %}
Pearl Bomb Explosion
diff --git a/public/wiki/rats-mischief/index.md b/public/wiki/rats-mischief/index.md index a40459b7..aed8ebe5 100644 --- a/public/wiki/rats-mischief/index.md +++ b/public/wiki/rats-mischief/index.md @@ -4,7 +4,6 @@ title: Rat's Mischief slug: rats-mischief curse_project: 431787 modrinth: true -recipe_root: https://raw.githubusercontent.com/Ladysnake/RATs-Mischief/2.0/src/main/resources/data/ratsmischief/recipes/ --- @@ -188,9 +187,9 @@ Pouches can be crafted like bundles with leather, twisted vines and popped choru Rats stored in Pouches won't age, meaning they will keep status effects, health, their variant and names.
-{% recipe leather_rat_pouch.json %} -{% recipe twisted_rat_pouch.json %} -{% recipe purpur_rat_pouch.json %} +{% recipe "ratsmischief:leather_rat_pouch" %} +{% recipe "ratsmischief:twisted_rat_pouch" %} +{% recipe "ratsmischief:purpur_rat_pouch" %}
#### Mask of Rat