Fix ClientCommandSourceStack crashing or returning improper values for certain method calls #1928
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ClientCommandSourceStack#suggestRegistryElements
for advancements based on the list of visible advancements on the client (fixes a regression/addresses a TODO from the port to 1.21.2. The other part for recipes, I didn't fix as I don't think there is any way to suggest recipe names on the client as it no longer receives them)ClientCommandSourceStack#enabledFeatures
to provide the enabled features instead of throwing a NPE due to server being null.ClientCommandSourceStack#sendSuccess
properly make use of theCommandSource
's settings and if the command source stack is set to silent. Now it just calls super, but explicitly marks that the success should not be sent to admins. This way we won't have to worry about divergence in our copy if vanilla makes any changes.Minecraft#getInstance
's copy of various fields (for example levels), and hiding the fact that it technically can be nullable to reduce overall warnings when viewing the code.