Skip to content

Commit

Permalink
Merge branch 'master' of github.com:enjarai/trickster
Browse files Browse the repository at this point in the history
  • Loading branch information
StellarWitch7 committed Sep 22, 2024
2 parents 2691f84 + 497c18b commit 5c781bc
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 17 deletions.
2 changes: 2 additions & 0 deletions src/client/java/dev/enjarai/trickster/TricksterClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import dev.enjarai.trickster.screen.ScrollAndQuillScreen;
import dev.enjarai.trickster.screen.SignScrollScreen;
import dev.enjarai.trickster.screen.owo.GlyphComponent;
import dev.enjarai.trickster.screen.owo.ItemTagComponent;
import dev.enjarai.trickster.screen.owo.SpellPreviewComponent;
import io.wispforest.accessories.api.client.AccessoriesRendererRegistry;
import io.wispforest.owo.ui.parsing.UIParsing;
Expand Down Expand Up @@ -50,6 +51,7 @@ public void onInitializeClient() {
UIParsing.registerFactory(Trickster.id("glyph"), GlyphComponent::parseTrick);
UIParsing.registerFactory(Trickster.id("pattern"), GlyphComponent::parseList);
UIParsing.registerFactory(Trickster.id("spell-preview"), SpellPreviewComponent::parse);
UIParsing.registerFactory(Trickster.id("item-tag"), ItemTagComponent::parse);

ParticleFactoryRegistry.getInstance().register(ModParticles.PROTECTED_BLOCK, ProtectedBlockParticle.Factory::new);
ParticleFactoryRegistry.getInstance().register(ModParticles.SPELL, SpellParticle.Factory::new);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package dev.enjarai.trickster.screen.owo;

import io.wispforest.owo.ui.component.Components;
import io.wispforest.owo.ui.container.FlowLayout;
import io.wispforest.owo.ui.core.HorizontalAlignment;
import io.wispforest.owo.ui.core.Sizing;
import io.wispforest.owo.ui.core.VerticalAlignment;
import io.wispforest.owo.ui.parsing.UIParsing;
import net.minecraft.item.Item;
import net.minecraft.registry.Registries;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.tag.TagKey;
import org.w3c.dom.Element;

public class ItemTagComponent extends FlowLayout {
protected TagKey<Item> tagKey;

public ItemTagComponent(TagKey<Item> tagKey) {
super(Sizing.fill(100), Sizing.content(), Algorithm.LTR_TEXT);
this.tagKey = tagKey;

alignment(HorizontalAlignment.CENTER, VerticalAlignment.CENTER);

Registries.ITEM.getOrCreateEntryList(tagKey).forEach(entry -> {
var stack = entry.value().getDefaultStack();
child(Components.item(stack)
.showOverlay(true)
.setTooltipFromStack(true));
});
}

public static ItemTagComponent parse(Element element) {
UIParsing.expectAttributes(element, "tag-id");

var tagId = UIParsing.parseIdentifier(element.getAttributeNode("tag-id"));
var tagKey = TagKey.of(RegistryKeys.ITEM, tagId);

return new ItemTagComponent(tagKey);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,23 @@ It is also possible to write to a scroll programmatically using [Notulist's Ploy

<recipe;trickster:scroll_and_quill>

A Scroll and Quill can be signed by shift-right-clicking it.
;;;;;

Scrolls can be dyed by combining them with any dye in a crafting table:

<|item-tag@trickster:templates|tag-id=trickster:dyed_scroll_and_quill|>

A Scroll and Quill can also be signed by shift-right-clicking it.
This lets you give it a custom name for free, but it cannot be written to anymore by any means.

;;;;;

Signed scrolls are immutable. They cannot be written to by any means. However, they can be charged with one to eight vials of spell ink,
a special concoction that imbues scrolls with a single-use pool of mana.
Scrolls that have been imbued with mana can have their contained spell cast at no risk to the user, however, doing so consumes the scroll.
However, signed scrolls can be charged with one to eight vials of spell ink,
a special concoction that imbues scrolls with a single-use pool of mana.


Scrolls that have been imbued with mana can have their contained spell cast at no risk to the user,
however, doing so consumes the scroll.

;;;;;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,41 @@
```json
{
"title": "Top Hat",
"title": "Hats",
"icon": "trickster:top_hat",
"category": "trickster:basics"
}
```

The Top Hat is quite an ingenious piece of a caster's toolkit.
By equipping it on their head, a caster can press the <keybind;key.trickster.take_hat>
button to hold the hat in their offhand.
The caster's hat is quite an ingenious piece of kit.
After equipping it on their head, a caster can press the <keybind;key.trickster.take_hat>
button to take the hat into their offhand quickly.


When a Top Hat is held in your offhand, you can right-click to open the ui, and insert up to 27 scrolls.
When a hat is held in your offhand, you can right-click to open the ui, and insert up to 27 scrolls.
These scrolls can then be selected by shift-scrolling while holding the hat.

;;;;;

These scrolls can be selected by scrolling while holding the Top Hat, which will cycle through them.
Now, when a spell cast from your main hand tries to access the spell in your other hand via [Notulist's Delusion](^trickster:ploys/basic#3),
it will read the spell from the selected scroll in the held hat instead.


When a spell cast from your main hand tries to access the spell in your other hand via [Notulist's Delusion](^trickster:ploys/basic#3),
it will instead read the spell from the selected scroll in the held hat.
You can also access the spell in any slot of your hat directly using [Cranium Stratagem](^trickster:delusions_ingresses/imports#3),
or read the selected slot using [Cranium Delusion](^trickster:delusions_ingresses/inventory#7).

;;;;;

You can also access the spell in any slot of your Top Hat directly using [Cranium Stratagem](^trickster:delusions_ingresses/imports#3),
or read the selected slot using [Cranium Delusion](^trickster:delusions_ingresses/inventory#7).
A few different types of hat are available depending on your likes and preferences!
They all function the exact same though.


The classic Top Hat:
<recipe;trickster:top_hat>

;;;;;

A mysterious Witch Hat:
<recipe;trickster:witch_hat>

And even the humble (but very cool) Fez:
<recipe;trickster:fez>
4 changes: 4 additions & 0 deletions src/main/resources/assets/trickster/owo_ui/templates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,9 @@
</sizing>
</flow-layout>
</template>
<template name="item-tag">
<trickster.item-tag tag-id="{{tag-id}}">
</trickster.item-tag>
</template>
</templates>
</owo-ui>
2 changes: 1 addition & 1 deletion src/main/resources/data/trickster/recipe/fez.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"item": "minecraft:yellow_wool"
},
"s": {
"item": "trickster:scroll_and_quill"
"tag": "trickster:scrolls"
}
},
"pattern": [
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/data/trickster/recipe/top_hat.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"item": "minecraft:white_wool"
},
"s": {
"item": "trickster:scroll_and_quill"
"tag": "trickster:scrolls"
}
},
"pattern": [
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/data/trickster/recipe/witch_hat.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"item": "minecraft:purple_wool"
},
"s": {
"item": "trickster:scroll_and_quill"
"tag": "trickster:scrolls"
}
},
"pattern": [
Expand Down

0 comments on commit 5c781bc

Please sign in to comment.