Jump to content

[1.20.4] NetworkConstants doesn't exist?


Banana Bane

Recommended Posts

I am trying to update my clientside mod to 1.20.4, however there seems to be some issue with the sides aspect.

ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class, () -> new IExtensionPoint.DisplayTest(() -> NetworkConstants.IGNORESERVERONLY, (a, b) -> true));

According to the documentation, this code is correct, however it does not compile.

Multiple markers at this line
-NetworkConstants cannot be resolved to a variable
-The constructor IExtensionPoint.DisplayTest(() -> {}, (<no type> a, <no type> b) => {}) is undefined
The import net.minecraftforge.network.NetworkConstants cannot be resolved

How do I make a 1.20.4 mod clientside only?

Link to comment
Share on other sites

In 1.20.2 the DisplayTest constants were moved inside the DisplayTest record itself for discoverability.

In 1.20.4 you can simply set clientSideOnly=true in your mods.toml (just below the modLoader) and Forge should do everything for you as long as you don't manually set a DisplayTest. Refer to 1.20.4's MDK for further details.

The clientSideOnly feature prevents your mod file from being loaded on servers and sets a different default DisplayTest when loading your mod on clients.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.