Prunoideae / ProbeJS

Supercharging your modpack experience.
GNU General Public License v3.0
47 stars 15 forks source link

[Fabric 1.20.1] BuilderBase.displayName and ItemBuilder.tooltip support string arguments, but are not typed as such #75

Closed Martmists-GH closed 4 months ago

Martmists-GH commented 4 months ago

According to their typings, a net.minecraft.network.chat.Component is required.

Prunoideae commented 4 months ago

A Component is also typed as string following the conversion doc. It's similar to where you can type item names at places accepting ItemStack and get completions.

ProbeJS will try to keep the type name as original to retain as much info from type names as possible. For example, you might don't know that Component can also be a:

type ComponentObject = {
    "text"?: string,
    "translate"?: Special.LangKey,
    "with"?: (any)[],
    "color"?: $Color$$Type,
    "bold"?: boolean,
    "italic"?: boolean,
    "underlined"?: boolean,
    "strikethrough"?: boolean,
    "obfuscated"?: boolean,
    "insertion"?: string,
    "font"?: string,
    "click"?: $ClickEvent$$Type,
    "hover"?: $MutableComponent$$Type,
    "extra"?: ($MutableComponent$$Type)[]
}
Martmists-GH commented 4 months ago

The completion feature you're mentioning does not seem to exist in 6.0.0, unless this is part of the vscode plugin (which obviously does not work on Jetbrains products, nor does tsc accept it).

Prunoideae commented 4 months ago

Yes, because the object is not typed until v7.0.0.

Martmists-GH commented 4 months ago

Unfortunately 7.0.0 does not seem to support my usecase, being Fabric 1.20.1

Prunoideae commented 4 months ago

Fabric is not supported because v7.0.0 on 1.20.1 is a preliminary version for the ProbeJS on 1.21, and KubeJS on 1.20.4+ only supports NeoForge.

Prunoideae commented 4 months ago

Due to the weakly typed nature of JavaScript, the IDE should be able to accept string for the Component type without throwing an error, if your IDE does not support that, think about switching to VSCode.

Prunoideae commented 4 months ago

And I won't plan to fix or update anything that is not 1.21; the old codebase is too cursed to continue working on.