mirror of
https://github.com/Minestom/Minestom.git
synced 2025-02-05 15:01:46 +01:00
Explosion hook after sending the packet to allow world modifications after the explosion (can prevent desyncs)
This commit is contained in:
parent
2c74589599
commit
7485919805
@ -79,6 +79,8 @@ public abstract class Explosion {
|
||||
instance.getPlayers().forEach(player -> {
|
||||
player.sendPacketToViewersAndSelf(packet);
|
||||
});
|
||||
|
||||
postSend(instance, blocks);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -91,4 +93,12 @@ public abstract class Explosion {
|
||||
* Just be careful, you might just crash the server or the client. Or you're lucky, both at the same time.
|
||||
*/
|
||||
protected void postExplosion(Instance instance, List<BlockPosition> blocks, ExplosionPacket packet) {}
|
||||
|
||||
/**
|
||||
* Called after sending the explosion packet. Can be used to (re)set blocks that have been destroyed.
|
||||
* This is necessary to do after the packet being sent, because the client sets the positions received to air.
|
||||
* @param instance the instance in which the explosion occurs
|
||||
* @param blocks the block positions returned by prepare
|
||||
*/
|
||||
protected void postSend(Instance instance, List<BlockPosition> blocks) {}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user