Search in sources :

Example 1 with MovingObjectPositionBlock

use of com.comphenix.protocol.wrappers.MovingObjectPositionBlock in project CombatLogX by SirBlobman.

the class ForceFieldAdapter method getLocation1.

@Nullable
private Location getLocation1(World world, PacketContainer packetContainer) {
    try {
        StructureModifier<MovingObjectPositionBlock> movingBlockPositionModifier = packetContainer.getMovingBlockPositions();
        MovingObjectPositionBlock movingObjectPositionBlock = movingBlockPositionModifier.readSafely(0);
        if (movingObjectPositionBlock == null) {
            return null;
        }
        BlockPosition blockPosition = movingObjectPositionBlock.getBlockPosition();
        return (blockPosition == null ? null : blockPosition.toLocation(world));
    } catch (FieldAccessException ex) {
        return null;
    }
}
Also used : BlockPosition(com.comphenix.protocol.wrappers.BlockPosition) MovingObjectPositionBlock(com.comphenix.protocol.wrappers.MovingObjectPositionBlock) FieldAccessException(com.comphenix.protocol.reflect.FieldAccessException) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

FieldAccessException (com.comphenix.protocol.reflect.FieldAccessException)1 BlockPosition (com.comphenix.protocol.wrappers.BlockPosition)1 MovingObjectPositionBlock (com.comphenix.protocol.wrappers.MovingObjectPositionBlock)1 Nullable (org.jetbrains.annotations.Nullable)1