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

fix(network): stop disconnect when adding custom recipe book types and connecting to vanilla servers #9994

Open
wants to merge 1 commit into
base: 1.20.x
Choose a base branch
from

Conversation

danorris709
Copy link
Contributor

@danorris709 danorris709 commented May 31, 2024

The reason I made this is because when a mod adds a custom RecipeBookType, and then attempts to connect to a vanilla server they get disconnected as it's attempting to read more from the buffer than is being sent by the server.

Again, not sure if this solution is perfect but I have also tested this with a mixin and it works. I'm specifically uncertain about getting the connection like I have? I'm not sure where you're supposed to access the connection from at that point of the process (decoding a packet)

Depends on #9993

@autoforge autoforge bot added Triage This request requires the active attention of the Triage Team. Requires labelling or reviews. 1.20 labels May 31, 2024
@autoforge autoforge bot requested a review from a team May 31, 2024 11:34
@LexManos
Copy link
Member

LexManos commented May 31, 2024

Well.. shit.
This is actually a far more complex issue then you think.
Reading/Writing the values is dependent on the order in which the enums are created.
Which depends on the mods loaded, and the order they loaded.
Which means all this syncing of settings is really really fragile and would probably misalign between servers who have different mods installed.

To do it properly would involve sending our own custom 'extra' packet every time a recipe book packet was sent. That synced this data in a Map<RecipeBookType, Pair<Boolean, Boolean>> Right now it adds extra data to the vanilla packet which is a network protocol break.

Luckily the packet is only sent in two places which are easy to hook.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.20 Triage This request requires the active attention of the Triage Team. Requires labelling or reviews.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants