Skip to content

Commit

Permalink
Use resource roots to locate recipes
Browse files Browse the repository at this point in the history
  • Loading branch information
Pyrofab committed Mar 21, 2024
1 parent dab1fb2 commit 8afc0fe
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 18 deletions.
12 changes: 9 additions & 3 deletions jekyll_plugins/RecipeTag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 10 additions & 11 deletions public/wiki/blast/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -39,7 +38,7 @@ BLAST mainly focuses on various types of bombs with some common attributes:
<p>Is defused and drops when coming into contact with water.</p>
</div>

{% recipe bomb.json %}
{% recipe "blast:bomb" %}

</div>
<div class="bomb-type">
Expand All @@ -50,7 +49,7 @@ BLAST mainly focuses on various types of bombs with some common attributes:
<p>Explodes underwater, but will not destroy any blocks.</p>
</div>

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

</div>
<h4>Gold Tier</h4>
Expand All @@ -62,7 +61,7 @@ BLAST mainly focuses on various types of bombs with some common attributes:
<p>Like other gold items, Piglins love this bomb!</p>
</div>

{% recipe golden_bomb.json %}
{% recipe "blast:golden_bomb" %}

</div>
<div class="bomb-type">
Expand All @@ -71,7 +70,7 @@ BLAST mainly focuses on various types of bombs with some common attributes:
<p>A version of the golden bomb with a trigger instead of a fuse.</p>
<p>It also explodes underwater without causing block destruction.</p>
</div>
{% recipe golden_trigger_bomb.json %}
{% recipe "blast:golden_trigger_bomb" %}
</div>
<h4>Diamond Tier</h4>
<div class="bomb-type">
Expand All @@ -81,7 +80,7 @@ BLAST mainly focuses on various types of bombs with some common attributes:
<p>Exceptions are bedrock, barriers, end portal frames, and other admin-exclusive blocks.</p>
</div>

{% recipe diamond_bomb.json %}
{% recipe "blast:diamond_bomb" %}
</div>
<!--<span class="bomb-trigger-type">Trigger</span>-->
<div class="bomb-type">
Expand All @@ -90,7 +89,7 @@ BLAST mainly focuses on various types of bombs with some common attributes:
<p>A version of the diamond bomb with a trigger instead of a fuse.</p>
<p>It also explodes underwater without causing block destruction.</p>
</div>
{% recipe diamond_trigger_bomb.json %}
{% recipe "blast:diamond_trigger_bomb" %}
</div>
</section>

Expand All @@ -100,8 +99,8 @@ Dirt Bombs can be crafted by surrounding normal bombs with 8 Dirt Blocks. Instea

<figure class="bomb-showcase">
<div style="top:1.4em; left:0">
{% recipe dirt_bomb.json %}
{% recipe dirt_trigger_bomb.json %}
{% recipe "blast:dirt_bomb" %}
{% recipe "blast:dirt_trigger_bomb" %}
</div>
<img src="./DirtBombs.png" alt="Dirt Bombs"/>
</figure>
Expand All @@ -112,8 +111,8 @@ Crafted like normal bombs with an Enderpearl as base material, this bomb has a *

<figure class="bomb-showcase">
<div style="bottom:1.7em; right:0; gap: 1em; font-size: 20px">
{% recipe pearl_bomb.json %}
{% recipe pearl_trigger_bomb.json %}
{% recipe "blast:pearl_bomb" %}
{% recipe "blast:pearl_trigger_bomb" %}
</div>
<img src="./PearlBombs.png" alt="Pearl Bomb Explosion" width="493" height="368" class="rounded" style="width: 90%; height: auto"/>
</figure>
Expand Down
7 changes: 3 additions & 4 deletions public/wiki/rats-mischief/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/
---
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

Expand Down Expand Up @@ -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.

<figure class="recipes">
{% 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" %}
</figure>

#### Mask of Rat
Expand Down

0 comments on commit 8afc0fe

Please sign in to comment.