Exception throw on dedicated server when running out of block (+ subtle localization issues)
JamiesWhiteShirt opened this issue ยท 1 comments
See stack trace here: https://pastebin.com/aLkjAFJg
It seems you might have a slight misunderstanding on how @SideOnly
works. I urge you to read what the official MinecraftForge documentation has to say about sides. If you use IntelliJ there is a plugin that will show warnings when you do this.
You are calling a method marked with @SideOnly(Side.CLIENT)
(which removes the method definition on a dedicated server) in a logical server context. Removing the annotation will obviously not resolve the issue because the localization methods reference other client only methods. You will need some fundamental changes.
Localization is something you should (almost) never do on the server. The server will always localize in en_US, which means a client set to a different language setting will unexpectedly see english text. (Sorry if you already know this, I'm just writing this for future reference)
To resolve this, you have to use TextComponentTranslation
, which will be localized on the client. In order to style messages you have to set the styling via code on the ITextComponent
, and in order to nest them you have to use language keys like exchangers.tooltip.holdShift=Hold %s for Details
(using the %s
)
Simply Jetpacks 2 has a similar issue you can use for reference.