fix: bonemeal api in multiplayer#249
Open
Lemmmy wants to merge 1 commit intoModificationStation:developfrom
Open
fix: bonemeal api in multiplayer#249Lemmmy wants to merge 1 commit intoModificationStation:developfrom
Lemmmy wants to merge 1 commit intoModificationStation:developfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR addresses a bug in the Bonemeal API where the reimplementation of the vanilla behaviour (use on grass, etc.) leads to client/server desyncs in multiplayer. Specifically, the new code in the Bonemeal API currently doesn't implement the same
world.isRemotechecks that DyeItem.java originally does. In multiplayer, this means that a player with Station API installed will see different plants grown than on the server, and in the case of grass, they may even see dead bushes (due to a block meta desync). This issue happens regardless of whether Station API is installed on the server.For the implementation, I chose to delegate the responsibility of checking world.isRemote to the implementors of the
generatefunction, leaving modders the flexibility to fine-tune which behaviour is ran on the client, and protect the return values so that the item animations are preserved properly. As such, I only wrapped the world-modifying calls in the replacement implementations for the vanilla generators, as well as the item stack consumption. This does mean that this PR won't fix the desync for mods using the Bonemeal API; those mods will need to make similar patches themselves.I've tested that this works correctly in singleplayer and multiplayer.