Skip to content

Implement ForwardingViewer & Viewer cleanup#4054

Closed
MrHell228 wants to merge 8 commits intoSpongePowered:api-12from
MrHell228:api-12-more-viewers
Closed

Implement ForwardingViewer & Viewer cleanup#4054
MrHell228 wants to merge 8 commits intoSpongePowered:api-12from
MrHell228:api-12-more-viewers

Conversation

@MrHell228
Copy link
Contributor

@MrHell228 MrHell228 commented Jun 23, 2024

SpongeAPI | Sponge

This PR should be merged after these PRs (so I could resolve here all the merge conflicts with this PR that will likely appear):

Some general points:

  • ViewerPacketUtil was made to collect all viewer-related packets and some auidience-related packets in one place and simplify work with them instead of having a lot of the same code in different Viewer impls.
  • SpongeViewer is default Viewer impl, SpongeForwardingViewer is default ForwardingViewer impl.
  • All viewer methods just send some packet to someone. So ViewerBridge comes into play here with send(Packet) methods. This allows to move most Viewer impl to SpongeViewer.
  • ViewerBridge has different impls for ServerPlayer and LocalPlayer (to mostly support both sided Viewer calls) and ForwardingViewer
  • SpongeForwardingViewer has some audience methods overriden with SpongeViewer.super.someMethod() to make single packet and broadcast it instead of making new packet for each viewer

@MrHell228 MrHell228 force-pushed the api-12-more-viewers branch from 75188ce to b58442a Compare June 23, 2024 04:22
@MrHell228
Copy link
Contributor Author

Resolved conflicts with sub PRs.

Currently block progress methods work only on server.
If we want them to work with client side plugins too (which is one of the goals of this whole PR), we might move blockDescructionId methods from SpongeServer to SpongeEngine.
Collisions between client-sent and server-sent ids in theory could be minimized by having different id counters: On server from 0 going down and on client from Integer.MIN_VALUE going up.
Does this sound fine?

@MrHell228 MrHell228 force-pushed the api-12-more-viewers branch from 8d5e3c5 to 711847b Compare June 23, 2024 17:49
Faithcaio pushed a commit that referenced this pull request Jun 26, 2024
@Faithcaio Faithcaio closed this Jun 26, 2024
@MrHell228 MrHell228 deleted the api-12-more-viewers branch June 28, 2024 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants