Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClientHelper.isServerContext returns false in singleplayer worlds #4

Closed
jlortiz0 opened this issue Mar 9, 2024 · 2 comments
Closed

Comments

@jlortiz0
Copy link

jlortiz0 commented Mar 9, 2024

Version

Confirmed on 1.19.x/forge aece46e, buildscript 1.19.x/forge e4f58032
Not yet confirmed Does not occur on 1.20.x/forge.

Problem

When in singleplayer, the RegistryAccess used by the internal server appears to be obtained from RegistryAccess.BUILTIN. The code in ClientHelper.isServerContext assumes that this is not the case, and thus always returns false. This can cause datapack reloads in singleplayer to unexpectedly fail as the server will attempt to send the client's registries to the client.

Potential Solutions

Aside from one instance in origins-architectury:PartialOrigin.Builder.powers, the access argument is always null. As such, it may be possible to remove the comparison to RegistryAccess.BUILTIN and just use the null check. This may have some regressions, and I suspect that a better solution exists.

@jlortiz0
Copy link
Author

Confirmed that this does not occur on 1.20.1. Seems this is limited to 1.19 (or even that specific version of Forge). Leaving this open for now in case you want to take another look at it anyway.

MerchantPug added a commit to EdwinMindcraft/origins-architectury that referenced this issue Mar 13, 2024
MerchantPug added a commit that referenced this issue Mar 13, 2024
@MerchantPug
Copy link
Collaborator

MerchantPug commented Mar 13, 2024

The commits above aren't the true fix I feel, I'm going to keep the original logic, but also include a check for !ServerLifecycleHooks.getCurrentServer().isDedicatedServer()

MerchantPug added a commit that referenced this issue Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants