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

Featurerequest: Manual offset reset #7

Open
stitchinger opened this issue Dec 23, 2023 · 3 comments
Open

Featurerequest: Manual offset reset #7

stitchinger opened this issue Dec 23, 2023 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@stitchinger
Copy link

Hi, love your plugin^^
Would it be possible to create some kind of API, so that I can manually reset the offset whenever I want?

@joshuaprince joshuaprince added enhancement New feature or request help wanted Extra attention is needed labels Dec 28, 2023
@joshuaprince
Copy link
Owner

Hi! Glad to hear you're enjoying it 😄

I offer an API that allows plugins to apply offsets as they see fit. However, it does not currently expose a way to trigger an offset change immediately - the API only "reacts" to when the player's offset can change.

I've looked into manual offset changes and would like to make it work, but I ran into technical challenges. Whenever a player's offset changes, the client needs to receive chunks at those "new" client-side coordinates. However, if we trigger a direct offset change but keep the player where they are, the player's server-side (real) coordinates stay the same, so the server will not re-send chunks at that location and the client just shows void. Furthermore, the client needs to receive a fake teleport packet so that it can move the player to the new client-side coordinates.

As the plugin is now, the easiest solution is to teleport the player to a different world (or a far distance away, if resetOnDistantTeleport is an option) and then back to where they were, so that an API consumer can catch the change and update the player's offset. In theory, though, this can be done smoothly with just the fake teleport packet and chunk re-send - I'm open to merging a PR if someone manages to get it working.

@stitchinger
Copy link
Author

Thank you very much for that detailed reply.
After reading up on "resetOnDistantTeleport", I think, that that option might be sufficient for what I'm trying to do.
Just need to make sure, that my teleports are at least 2 x Viewdistance.

@RealTriassic
Copy link

Would be nice if there was a command to forcibly reset the offset for a player

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants