Search in sources :

Example 1 with PersistedDataMap

use of org.terasology.persistence.typeHandling.PersistedDataMap in project Terasology by MovingBlocks.

the class Rect2fTypeHandler method deserialize.

@Override
public Rect2f deserialize(PersistedData data, DeserializationContext context) {
    if (!data.isNull() && data.isValueMap()) {
        PersistedDataMap map = data.getAsValueMap();
        Vector2f min = context.deserializeAs(map.get(MIN_FIELD), Vector2f.class);
        Vector2f size = context.deserializeAs(map.get(SIZE_FIELD), Vector2f.class);
        return Rect2f.createFromMinAndSize(min, size);
    }
    return null;
}
Also used : PersistedDataMap(org.terasology.persistence.typeHandling.PersistedDataMap) Vector2f(org.terasology.math.geom.Vector2f)

Example 2 with PersistedDataMap

use of org.terasology.persistence.typeHandling.PersistedDataMap in project Terasology by MovingBlocks.

the class Rect2iTypeHandler method deserialize.

@Override
public Rect2i deserialize(PersistedData data, DeserializationContext context) {
    if (!data.isNull() && data.isValueMap()) {
        PersistedDataMap map = data.getAsValueMap();
        Vector2i min = context.deserializeAs(map.get(MIN_FIELD), Vector2i.class);
        Vector2i size = context.deserializeAs(map.get(SIZE_FIELD), Vector2i.class);
        return Rect2i.createFromMinAndSize(min, size);
    }
    return null;
}
Also used : PersistedDataMap(org.terasology.persistence.typeHandling.PersistedDataMap) Vector2i(org.terasology.math.geom.Vector2i)

Example 3 with PersistedDataMap

use of org.terasology.persistence.typeHandling.PersistedDataMap in project Terasology by MovingBlocks.

the class Region3iTypeHandler method deserialize.

@Override
public Region3i deserialize(PersistedData data, DeserializationContext context) {
    if (!data.isNull() && data.isValueMap()) {
        PersistedDataMap map = data.getAsValueMap();
        Vector3i min = context.deserializeAs(map.get(MIN_FIELD), Vector3i.class);
        Vector3i size = context.deserializeAs(map.get(SIZE_FIELD), Vector3i.class);
        return Region3i.createFromMinAndSize(min, size);
    }
    return null;
}
Also used : PersistedDataMap(org.terasology.persistence.typeHandling.PersistedDataMap) Vector3i(org.terasology.math.geom.Vector3i)

Aggregations

PersistedDataMap (org.terasology.persistence.typeHandling.PersistedDataMap)3 Vector2f (org.terasology.math.geom.Vector2f)1 Vector2i (org.terasology.math.geom.Vector2i)1 Vector3i (org.terasology.math.geom.Vector3i)1