-
Notifications
You must be signed in to change notification settings - Fork 0
docs(astro): 📝 updated deprecated API usage in code examples #802
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
Conversation
Co-authored-by: caunt <5324218+caunt@users.noreply.github.com>
Co-authored-by: caunt <5324218+caunt@users.noreply.github.com>
Co-authored-by: caunt <5324218+caunt@users.noreply.github.com>
Co-authored-by: caunt <5324218+caunt@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Updates the Astro documentation to reflect current Void/ExamplePlugin networking APIs, replacing deprecated calls and aligning examples with the preferred packet ID/transformations registration patterns.
Changes:
- Updated packet-sending examples to use
player.Linkinstead of the deprecatedplayer.GetLink(). - Added a recommended
PacketIdDefinitions.ClientboundSetHeldItemregistration example. - Updated transformations docs to use the channel-aware
RegisterTransformations(@event.Channel, ...)overload and added the missing 1.21.9 packet ID mapping.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| docs/astro/src/content/docs/docs/developing-plugins/network/transformations.md | Updates transformations registration example to use the channel-aware overload and adds the 1.21.9 mapping. |
| docs/astro/src/content/docs/docs/developing-plugins/network/packets.md | Updates packet registration/sending examples to match current API usage and recommended predefined mappings. |
Comments suppressed due to low confidence (1)
docs/astro/src/content/docs/docs/developing-plugins/network/packets.md:151
- Docs style guideline in
AGENTS.mdsays to avoid inline code/backticks inside link captions (AGENTS.md:111-113). Here the link text includes backticks aroundILink; consider using plain/bold link text (e.g., “ILink”) and keep any code formatting outside the link label.
### Sending Packets to the [**`ILink`**](/docs/developing-plugins/network/links)
You can send packets to the link with `ILink.SendPacketAsync` method.
[**`ILink`**](/docs/developing-plugins/network/links) will automatically determine the destination of the packet based on the packet interface.
| You can send packets to the server with `ILink.ServerChannel` instance. | ||
| ```csharp | ||
| await player.GetLink().ServerChannel.SendPacketAsync(new SetHeldItemClientboundPacket { Slot = slot }, cancellationToken); | ||
| await player.Link.ServerChannel.SendPacketAsync(new SetHeldItemClientboundPacket { Slot = slot }, cancellationToken); |
Copilot
AI
Feb 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IPlayer.Link is nullable (it returns ILink?), so dereferencing it directly in the example can produce a NullReferenceException and also shows a pattern that won’t compile cleanly with nullable reference types enabled. Consider using the non-null link instance from the relevant event (when available) or explicitly guarding (e.g., assign player.Link to a local variable and throw a clear exception if it’s null) before calling into ServerChannel.
| await player.Link.SendPacketAsync(new SetHeldItemClientboundPacket { Slot = slot }, cancellationToken); | ||
| ``` | ||
|
|
||
| When you want to explicitly send a packet to the server or client, `SendPacketAsync` has an overload that specifies the destination side. | ||
| ```csharp | ||
| await player.GetLink().SendPacketAsync(Side.Client, new SetHeldItemClientboundPacket { Slot = slot }, cancellationToken); | ||
| await player.Link.SendPacketAsync(Side.Client, new SetHeldItemClientboundPacket { Slot = slot }, cancellationToken); |
Copilot
AI
Feb 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These examples dereference player.Link directly, but Link is nullable (ILink?). To avoid teaching a null-dereference pattern (and to keep the snippet compatible with nullable reference types), guard player.Link (or use the link provided by an event) before calling SendPacketAsync.
Summary
Documentation contained deprecated method calls that don't match current API patterns in ExamplePlugin.
Changes
packets.md
player.GetLink()→player.Linkproperty (3 instances)PacketIdDefinitions.ClientboundSetHeldItempatterntransformations.md
RegisterTransformations(params)→RegisterTransformations(@event.Channel, params)Before/After
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
telemetry.astro.build/home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/Void/Void/docs/astro/node_modules/.bin/astro build(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.