-
Notifications
You must be signed in to change notification settings - Fork 43
Fix reach ring #95
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
base: master
Are you sure you want to change the base?
Fix reach ring #95
Conversation
Fixes the ring of far reach. In SP we had the problem of toRemoveItems being shared between server and client. Issue here is that we can have a ticks after unequip. Instead of anticipating (and requiring) them we just ignore them now.
The code looks fine by me. (But im not gonna review cause im not part of the org) |
@Shadow1590 i can add you to the org if you can review PRs . |
I don't think this is the way you should fix it. You're essentially fixing the issue, but not the root cause. The underlying issue is that the function setReach() gets called twice on the client when equipping the ring (and only once when unequipping). |
There is a |
Sure, but i think that should be part of baubles and not here. |
We have a mod Radom baubles for more stuff |
Yeah I understand.
Not really. The first underlying issue is that onEquipped isn't called after logging in
Could be an option, I just worked on what we have already. Should we move this to baubles? Should probably not call onEquipped directly though, since other baubles might not expect it twice. |
Honestly, I'd leave it as-is and just implement the event into Botania's code directly. This removes the worn tick after taking it off problem, and it doesn't require Baubles API to get modified. If you really want, you could probably add an interface & an event to Baubles, but that would require another PR while most mods wouldn't need it. |
I could use |
I used FMLNetworkEvent.ClientDisconnectionFromServerEvent for disconnecting. There should be something for connecting |
Thanks, I pushed a new approach that seems to work for me.
|
I found a problem. |
7a710de
to
a743eda
Compare
Thanks for the report, since syncing should be done by baubles I decided to finally put in a PR to baubles itself: GTNewHorizons/Baubles-Expanded#14 Of course, this doesn't compile now since it references old baubles, but it should be enough for review and testing, I hope. |
Regarding 5e82cb0, after dying we might have a different player object (a copy?) so we need to compare UUIDs rather than the object itself. Otherwise we will get the unequip for the death (due to server synchronization), but don't apply it because the player is "different" now, keeping out extended reach. |
Fixes GTNewHorizons/GT-New-Horizons-Modpack#20484
Built on top of #67, hopefully this time fixed for good..
To summarize, the ring has a few issue:
Primarily, it didn't get applied after a relog, that's why it got handled in
onWorkTick
as well.Problem is, after unequip we might get another tick, which might reapply the effect erroneously.
The current code deal with that by expecting that tick and handling it.
Additional issue is the shared state of client/server in SP (
toRemoveItems
)Since expecting (and needing) the ticks is a pain to deal with, I replaced it with a short delay - those weird ticks after unequip are now ignored and don't execute any logic. Should make it easier to understand and hopefully fix this issue.
@Shadow1590 Since you are the original author, mind taking a look as well?