Skip to content

Commit 26e27eb

Browse files
committed
feat(web): hover tooltips for identifiers
1 parent ef12566 commit 26e27eb

File tree

7 files changed

+107
-1
lines changed

7 files changed

+107
-1
lines changed

web/.vitepress/config.mts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ import { defineConfig } from 'vitepress'
44
export default defineConfig({
55
title: "Firmament",
66
description: "Reaching for the sky on HyPixel SkyBlock",
7+
cleanUrls: true,
8+
markdown: {
9+
config: (md) => {
10+
// md.use(minecraftHoverPlugin)
11+
}
12+
},
713
themeConfig: {
814
// https://vitepress.dev/reference/default-theme-config
915
nav: [

web/.vitepress/theme/index.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import DefaultTheme from 'vitepress/theme'
2+
import './minecraft-hover.css'
3+
import type { Theme } from 'vitepress/client';
4+
import tippy from 'tippy.js';
5+
import { onMounted } from 'vue'
6+
const theme: Theme = {
7+
extends: DefaultTheme,
8+
setup() {
9+
onMounted(() => {
10+
document.querySelectorAll("code[fqfi]").forEach(entry => {
11+
const [ns, path] = parseIdent(entry.textContent)
12+
tippy(entry, {
13+
content: `This is a fully-qualified file identifier. You would edit the file <code>assets/${ns}/${path}</code>.`,
14+
allowHTML: true,
15+
theme: 'translucent'
16+
})
17+
})
18+
})
19+
},
20+
}
21+
function parseIdent(str: string): [string, string] {
22+
const parts = str.split(":")
23+
if (parts.length == 1)
24+
return ["minecraft", parts[0]]
25+
if (parts.length == 2)
26+
return [parts[0], parts[1]]
27+
throw `${str} is not a valid identifier`
28+
}
29+
export default theme;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
@import 'tippy.js/dist/tippy.css';
2+
@import 'tippy.js/themes/translucent.css';
3+
4+
:root {
5+
--firm-ident-color: rgb(24, 121, 78);
6+
}
7+
.dark{
8+
--firm-ident-color: #b3f6c0;
9+
}
10+
code[fqfi], code[ident] {
11+
--vp-code-color: var(--firm-ident-color);
12+
}
13+
code[fqfi]::after {
14+
content: "📄";
15+
margin-left: 0.25em;
16+
font-size: 0.85em;
17+
opacity: 0.7;
18+
}
19+

web/developers/texture-packs.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
11

22
# Custom SkyBlock Items Texture Pack Format
33

4+
Firmament generally tries to emulate the vanilla structure of resourcepacks whenever possible. Because of that it is extremely helpful to know the general structure of vanilla resource packs. The [minecraft wiki](https://minecraft.wiki/w/Resource_pack) is a good starting place to learn, but some basic terms will be explained here as well.
5+
6+
## Identifiers
7+
8+
Identifiers (also sometimes called resource locations) are a special notation for referring to namespaced files. A basic identifier looks like so: `firmskyblock:models/item/aspect_of_the_end.json`{ident}. Here `firmskyblock` (everything before the colon) is called the namespace and `models/item/aspect_of_the_end.json` (everything after the colon) is called the path. What an identifier means depends on the context in which it is used.
9+
10+
In this document identifiers are coloured green like so: `minecraft:carrot`{ident} (this would be namespace `minecraft`, path `carrot`).
11+
12+
If an identifier does not specify a namespace it defaults to `minecraft`, so `carrot`{ident} would be equivalent to `minecraft:carrot`{ident}.
13+
14+
### Fully-qualified file identifiers
15+
16+
Sooner or later when referring to a resource, it will be resolved to a file. The last step (and the essentially canonical form) of an identifier is what i call the fully-qualified file identifier.
17+
18+
It fully represents the filepath of where an identifier resolves to inside of a resource pack.
19+
20+
To resolve an FQFI to a file location inside of your resource pack, simply turn an identifier like `<namespace>:<path>` into `assets/<namespace>/<path>`.
21+
22+
Given an FQFI like `firmskyblock:models/item/aspect_of_the_end.json`{fqfi}, the corresponding file is simply `assets/firmskyblock/models/item/aspect_of_the_end.json`.
23+
424
## Items by internal id (ExtraAttributes)
525

626
Find the internal id of the item. This is usually stored in the ExtraAttributes tag (Check the Power User Config for
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Editing item models
2+
3+
Firmament allows you to replace the models of items in a couple of ways.
4+
5+
## By SkyBlock ID
6+
7+
Firmament allows you to remodel
8+
9+

web/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,9 @@
77
"build": "vitepress build",
88
"preview": "vitepress preview"
99
},
10-
"packageManager": "[email protected]+sha512.fce8a3dd29a4ed2ec566fb53efbb04d8c44a0f05bc6f24a73046910fb9c3ce7afa35a0980500668fa3573345bd644644fa98338fa168235c80f4aa17aa17fbef"
10+
"packageManager": "[email protected]+sha512.fce8a3dd29a4ed2ec566fb53efbb04d8c44a0f05bc6f24a73046910fb9c3ce7afa35a0980500668fa3573345bd644644fa98338fa168235c80f4aa17aa17fbef",
11+
"dependencies": {
12+
"tippy.js": "^6.3.7",
13+
"vue": "^3.5.25"
14+
}
1115
}

web/pnpm-lock.yaml

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)