Package net.minestom.server.instance
Class Explosion
java.lang.Object
net.minestom.server.instance.Explosion
Abstract explosion.
Instance can provide a supplier through
Instance.setExplosionSupplier(net.minestom.server.instance.ExplosionSupplier)
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Performs the explosion and send the corresponding packetfloat
float
float
float
protected void
postExplosion
(Instance instance, List<Point> blocks, ExplosionPacket packet) Called after removing blocks and preparing the packet, but before sending it.protected void
Called after sending the explosion packet.Prepares the list of blocks that will be broken.
-
Constructor Details
-
Explosion
public Explosion(float centerX, float centerY, float centerZ, float strength)
-
-
Method Details
-
getStrength
public float getStrength() -
getCenterX
public float getCenterX() -
getCenterY
public float getCenterY() -
getCenterZ
public float getCenterZ() -
prepare
Prepares the list of blocks that will be broken. Also pushes and damage entities affected by this explosion- Parameters:
instance
- instance to perform this explosion in- Returns:
- list of blocks that will be broken.
-
apply
Performs the explosion and send the corresponding packet- Parameters:
instance
- instance to perform this explosion in
-
postExplosion
Called after removing blocks and preparing the packet, but before sending it.- Parameters:
instance
- the instance in which the explosion occursblocks
- the block positions returned by preparepacket
- the explosion packet to sent to the client. Be careful with what you're doing. It is initialized with the center and radius of the explosion. The positions in 'blocks' are also stored in the packet before this call, but you are free to modify 'records' to modify the blocks sent to the client. Just be careful, you might just crash the server or the client. Or you're lucky, both at the same time.
-
postSend
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.- Parameters:
instance
- the instance in which the explosion occursblocks
- the block positions returned by prepare
-