Search in sources :

Example 1 with ExplodePacket

use of org.dragonet.protocol.packets.ExplodePacket in project DragonProxy by DragonetMC.

the class PCExplosionTranslator method translate.

@Override
public PEPacket[] translate(UpstreamSession session, ServerExplosionPacket packet) {
    ExplodePacket pk = new ExplodePacket();
    pk.position = new Vector3F(packet.getX(), packet.getY(), packet.getZ());
    pk.radius = packet.getRadius();
    pk.destroyedBlocks = new ArrayList<>(packet.getExploded().size());
    for (ExplodedBlockRecord record : packet.getExploded()) pk.destroyedBlocks.add(new BlockPosition(record.getX(), record.getY(), record.getZ()));
    return new PEPacket[] { pk };
}
Also used : ExplodedBlockRecord(com.github.steveice10.mc.protocol.data.game.world.block.ExplodedBlockRecord) Vector3F(org.dragonet.common.maths.Vector3F) BlockPosition(org.dragonet.common.maths.BlockPosition) PEPacket(org.dragonet.protocol.PEPacket) ExplodePacket(org.dragonet.protocol.packets.ExplodePacket)

Aggregations

ExplodedBlockRecord (com.github.steveice10.mc.protocol.data.game.world.block.ExplodedBlockRecord)1 BlockPosition (org.dragonet.common.maths.BlockPosition)1 Vector3F (org.dragonet.common.maths.Vector3F)1 PEPacket (org.dragonet.protocol.PEPacket)1 ExplodePacket (org.dragonet.protocol.packets.ExplodePacket)1