oωo (owo-lib)

oωo (owo-lib)

29M Downloads

[NeoForge] TranslatableContents can't take ResourceLocation as a param.

Sxtkl123 opened this issue · 3 comments

commented

This patch from NeoForge make TranslatableContents can't take ResourceLocation as a param.

Sadly, this make a conflict with command: /owo-configure-hot-reload, here is the src code and why conflict:

// ConfigureHotReloadScreen:38 owo
rootComponent.childById(LabelComponent.class, "ui-model-label").text(Component.translatable("text.owo.configure_hot_reload.model", this.modelId));

and:

static MutableComponent translatable(String key, Object... args) {
    return MutableComponent.create(new TranslatableContents(key, (String)null, args));
}

public TranslatableContents(String key, @Nullable String fallback, Object[] args) {
    this.key = key;
    this.fallback = fallback;
    this.args = args;
    if (!FMLEnvironment.production) {
        for(Object arg : this.args) {
            if (!(arg instanceof Component) && !isAllowedPrimitiveArgument(arg)) {
                String var10002 = String.valueOf(arg);
                throw new IllegalArgumentException("TranslatableContents' arguments must be either a Component, Number, Boolean, or a String. Was given " + var10002 + " for " + this.key);
            }
        }
    }

}

public static boolean isAllowedPrimitiveArgument(@Nullable Object input) {
    return input instanceof Number || input instanceof Boolean || input instanceof String;
}

After that, when u not in production env, an exception will occupy because of the type ResourceLocation instead of String.
To solve this, I can use production env as temporary, but... waiting for your fix! XD.

commented

You can just change the this.modelId to this.modelId.toString() to fix this.

commented

#445 Deals with such I believe

commented

#445 Deals with such I believe

Seems yes. Thx!