Search in sources :

Example 1 with ExplosionMessage

use of net.glowstone.net.message.play.game.ExplosionMessage in project Glowstone by GlowstoneMC.

the class Explosion method playOutExplosion.

private void playOutExplosion(GlowPlayer player, Iterable<BlockVector> blocks) {
    Collection<Record> records = new ArrayList<>();
    for (BlockVector block : blocks) {
        byte x = (byte) (block.getBlockX() - location.getBlockX());
        byte y = (byte) (block.getBlockY() - location.getBlockY());
        byte z = (byte) (block.getBlockZ() - location.getBlockZ());
        records.add(new Record(x, y, z));
    }
    Vector velocity = player.getVelocity();
    ExplosionMessage message = new ExplosionMessage((float) location.getX(), (float) location.getY(), (float) location.getZ(), power, (float) velocity.getX(), (float) velocity.getY(), (float) velocity.getZ(), records);
    player.getSession().send(message);
}
Also used : Record(net.glowstone.net.message.play.game.ExplosionMessage.Record) BlockVector(org.bukkit.util.BlockVector) BlockVector(org.bukkit.util.BlockVector) Vector(org.bukkit.util.Vector) ExplosionMessage(net.glowstone.net.message.play.game.ExplosionMessage)

Aggregations

ExplosionMessage (net.glowstone.net.message.play.game.ExplosionMessage)1 Record (net.glowstone.net.message.play.game.ExplosionMessage.Record)1 BlockVector (org.bukkit.util.BlockVector)1 Vector (org.bukkit.util.Vector)1