ProbeJS

ProbeJS

972k Downloads

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

Martmists-GH opened this issue ยท 7 comments

commented

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

commented

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)[]
}
commented

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).

commented

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

commented

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

commented

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.

commented

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.

commented

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.