[SPIGOT-2620] MultiBlockChange API Created: 21/Aug/16  Updated: 24/Sep/22  Resolved: 24/Sep/22

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Minor
Reporter: Rossi Lorenzo Assignee: Parker Hawke
Resolution: Fixed Votes: 0
Labels: Spigot


 Description   

An API that helps to send MultiBlockChange packets to the client (instead of single block changes) I have the code but it works with reflection thanks to the private fields in the packet :/
If someone asks I can share it but it's not super clean



 Comments   
Comment by Parker Hawke [ 07/Sep/22 ]

Reviving this 6 year old issue as it seems there's still interest in a multi block change API. `Player#sendChunkChange()` has since been removed (as of 1.16), so I've introduced an alternative `Player#sendBlockChanges(boolean, Consumer<BlockChangeDelegate>)`. The PRs are awaiting review and approval under bukkit#789 and craftbukkit#1108

Comment by Hex [ 26/Aug/16 ]

You could always consider making a PR for this if you're aware of how to do it in a sane manner.

Comment by pokechu22 [ 24/Aug/16 ]

Pretty sure that it's out of scope for the bukkit API then (though I might be wrong) - it's not supposed to be used for manual packet handling/sending and low-level things like that, for better or worse. While there are existing methods that are like what you describe, both of them (Player.sendBlockChange and Player.sendChunkChange) are deprecated and sendChunkChange flat-out doesn't work anymore.

If you want to handle packets, you should consider using ProtocolLib, which (while it still uses reflection internally) wraps everything into a far cleaner API.

Comment by Rossi Lorenzo [ 24/Aug/16 ]

Yes but you can't send false packet with it and, if you want to create something a little bit low-level (like placing block differently) then you can't send the packet because there's no api for it and you need to use reflection

Comment by pokechu22 [ 23/Aug/16 ]

The block change packet to send is selected automatically by the server - no special handling is needed. It automatically uses MultiBlockChange when needed. (See PlayerChunkMap.flagDirty)

Generated at Sun Mar 30 17:57:28 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.