Skip to content
Open
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
1 change: 1 addition & 0 deletions docs/libraries/beet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ data_pack:
- "@smithed_libraries/packs/damage"
- "@smithed_libraries/packs/item"
- "@smithed_libraries/packs/prevent-aggression"
- "@smithed_libraries/packs/title"

pipeline:
- smithed_libraries.plugins.documentation
Expand Down
12 changes: 12 additions & 0 deletions docs/libraries/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,17 @@ Item ・ {{ item_version }}
*TODO*
:::

:::{grid-item-card}
:link: title
:link-type: doc
:img-bottom: https://raw.githubusercontent.com/Smithed-MC/Libraries/main/smithed_libraries/packs/title/pack.png

Title ・ v{{ title_version }}
^^^

**Required** for packs that use the title & subtitle as it coordinates title & subtitle usage across data packs.
:::

::::

---
Expand Down Expand Up @@ -214,4 +225,5 @@ custom-block
damage
prevent-aggression
item
title
```
30 changes: 30 additions & 0 deletions docs/libraries/title.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Title (v{{ title_version }})
> A small library that helps to coordinate title & subtitles usage across various data packs

::::{grid} 2

:::{grid-item}
```{button-link} https://api.smithed.dev/v2/download?pack=title
:color: primary
:outline:
:expand:
{octicon}`download;1em` Download
```
:::

:::{grid-item}
```{button-link} https://github.com/Smithed-MC/Libraries/tree/main/smithed_libraries/packs/title/
:color: primary
:outline:
:expand:
{octicon}`mark-github;1em` Source
```
:::

::::

### `#smithed.title:message`

```{include} title/message.md
```

63 changes: 63 additions & 0 deletions docs/libraries/title/message.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
| Input Name | Input Type | Input Source | Input Objective/Path |
| --- | --- | --- | --- |
| 'Raw Title' | storage | message.title_raw | smithed.title:input |
| 'JSON Title' | storage | message.title_json | smithed.title:input |
| 'Raw Subtitle' | storage | message.subtitle_raw | smithed.title:input |
| 'JSON Subtitle' | storage | message.subtitle_json | smithed.title:input |
| 'Priority Level' | storage | message.priority | smithed.title:input |
| 'Message Duration' | storage | message.freeze | smithed.title:input |



Instead of using `/title` to display the message, set up the input storage and run the following command:
```mcfunction
function #smithed.title:message
```
## Message
Messages can be set as strings or as json objects. To set a string, use `raw`, and to
set a JSON object, use `json`. Below are examples for both types of messages.
If both fields are set, the json object is shown.

Be sure to override the data in the storage to not have a subtitle from an other datapack.

### **Example of Raw Message**
```mcfunction
data modify storage smithed.title:input message set value {
title_raw: 'hello world',
subtitle_raw: 'this is a subtitle',
priority: 'persistent'
}
```
### **Example of JSON Message**
```mcfunction
data modify storage smithed.title:input message set value {
title_json: '{"text": "Warning!", "color": "red"}',
subtitle_json: '{"text": "You cannot complete this action!", "color": "red"}',
priority: 'notification'
}
```
## Priority
Priorities are set via specific strings. The list below shows the priority in descending order,
so for example notifications will show over conditional messages.
* `override`: This is the highest priority and will always override the current message, no matter what.
* `notification`: This is for brief, non-repeating, notification type messages,
such as the vanilla "You can't sleep now" message.
* `conditional`: This should be used for any message which will display constantly on a condition.
A good example is displaying a compass HUD while you hold a compass or showcasing the amount of XP
in a nearby tank. This doesn't include any persistent messages which toggle via a config option!
* `persistent`: This is the lowest priority message and is designated for messages which always displays
(or displays continously if a config value is set). You can think of this as a custom ui display
such as in Manic or even the Vanilla Tweaks coordinate HUD which always displays.
## Message Duration
Additionally, you can also set a `freeze` field in the storage space.
This will deteremine how many ticks your message should be protected against other messages with the same priority.
By default, this field is set to 20, which corresponds to 1 second.
```mcfunction
data modify storage smithed.title:message input set value {
title_raw: 'Random Event!',
subtitle_raw: '',
priority: 'notification',
freeze: 30
}
```
The freeze value has a minimum value of 0 and a maximum value of 50.
9 changes: 9 additions & 0 deletions docs/libraries/title/reset.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Reset

This function resets the current freeze and priority allowing you to display another message

```{admonition} ⚠️ Caution ⚠️
:class: warning
This api **will** disrupt other packs as it blatently resets the actionbar state.
Do not use this in any normal circumstances, as it will break compatibility in most cases.
```
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ damage_version = "0.2.0"
enchanter_version = "0.1.0"
item_version = "0.2.1"
prevent_aggression_version = "0.2.0"
title_version = "0.0.1"

convention_header = """
::::{grid} 2 2 2 2
Expand Down