idk
This commit is contained in:
parent
6a5addb383
commit
ac3802e8fb
11 changed files with 1542 additions and 59 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import { PFFS } from "../components"
|
||||
import { PFFS } from "./components"
|
||||
import fs from "fs/promises"
|
||||
import "../custom"
|
||||
import "./custom"
|
||||
|
||||
const schema = PFFS.readFileJSON("ui.schema.json").definitions
|
||||
|
||||
29
scripts/items.ts
Normal file
29
scripts/items.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import fs from "fs"
|
||||
|
||||
interface Item {
|
||||
id: number
|
||||
id_aux: number
|
||||
name: string
|
||||
}
|
||||
|
||||
interface ItemAPI {
|
||||
version: string
|
||||
length: number
|
||||
items: Item[]
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const itemlist: string[] = ["export enum ItemAuxID {"]
|
||||
|
||||
const { items }: ItemAPI = await fetch("https://www.asakiyuki.com/api/minecraft/items/id").then(v => v.json())
|
||||
for (const { name: fullname, id, id_aux } of items) {
|
||||
const [namespace, name] = fullname.split(":")
|
||||
const enumName = name.toUpperCase()
|
||||
itemlist.push(` ${enumName} = ${id_aux},`)
|
||||
}
|
||||
|
||||
itemlist.push("}")
|
||||
fs.writeFileSync("src/types/enums/Items.ts", itemlist.join("\n"))
|
||||
}
|
||||
|
||||
main()
|
||||
Reference in a new issue