Skip to content

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

@Sxtkl123

Description

@Sxtkl123

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.

Metadata

Metadata

Assignees

Labels

platform: neothis issue is about the neoforge version of owo-libpriority: lowthis issue only has minor effects - adressing it is not immediately requiredstatus: confirmedthis issue is reproducible or otherwise confirmed to existtype: bugthis issue breaks or otherwise adversely affects functionality

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions