Search in sources :

Example 1 with AddBoundingBoxReceived

use of com.irtimaled.bbor.client.events.AddBoundingBoxReceived in project BoundingBoxOutlineReloaded by irtimaled.

the class AddBoundingBox method getEvent.

public static AddBoundingBoxReceived getEvent(PayloadReader reader, String name) {
    DimensionId dimensionId = getDimensionId(reader, name);
    AbstractBoundingBox key = BoundingBoxDeserializer.deserialize(reader);
    if (key == null)
        return null;
    Set<AbstractBoundingBox> boundingBoxes = new HashSet<>();
    while (reader.isReadable()) {
        AbstractBoundingBox boundingBox = BoundingBoxDeserializer.deserialize(reader);
        boundingBoxes.add(boundingBox);
    }
    if (boundingBoxes.size() == 0)
        boundingBoxes.add(key);
    return new AddBoundingBoxReceived(dimensionId, key, boundingBoxes);
}
Also used : AddBoundingBoxReceived(com.irtimaled.bbor.client.events.AddBoundingBoxReceived) DimensionId(com.irtimaled.bbor.common.models.DimensionId) AbstractBoundingBox(com.irtimaled.bbor.common.models.AbstractBoundingBox) HashSet(java.util.HashSet)

Aggregations

AddBoundingBoxReceived (com.irtimaled.bbor.client.events.AddBoundingBoxReceived)1 AbstractBoundingBox (com.irtimaled.bbor.common.models.AbstractBoundingBox)1 DimensionId (com.irtimaled.bbor.common.models.DimensionId)1 HashSet (java.util.HashSet)1