Search in sources :

Example 86 with Vector3ic

use of org.joml.Vector3ic in project Terasology by MovingBlocks.

the class SparseObjectFacet3D method getWorldEntries.

/**
 * @return a <b>new</b> map with world-based position entries
 */
public Map<Vector3ic, T> getWorldEntries() {
    Map<Vector3ic, T> result = Maps.newLinkedHashMap();
    for (Entry<Vector3ic, T> entry : relData.entrySet()) {
        Vector3ic relPos = entry.getKey();
        Vector3ic worldPos = relativeToWorld(relPos.x(), relPos.y(), relPos.z());
        result.put(worldPos, entry.getValue());
    }
    return result;
}
Also used : Vector3ic(org.joml.Vector3ic)

Example 87 with Vector3ic

use of org.joml.Vector3ic in project Terasology by MovingBlocks.

the class SparseFieldFacet3D method getWorldEntries.

/**
 * @return a <b>new</b> map with world-based position entries
 */
public Map<Vector3i, Number> getWorldEntries() {
    Map<Vector3i, Number> result = Maps.newLinkedHashMap();
    for (Entry<Vector3ic, Number> entry : relData.entrySet()) {
        Vector3ic relPos = entry.getKey();
        Vector3i worldPos = relativeToWorld(relPos.x(), relPos.y(), relPos.z());
        result.put(worldPos, entry.getValue());
    }
    return result;
}
Also used : Vector3ic(org.joml.Vector3ic) Vector3i(org.joml.Vector3i)

Aggregations

Vector3ic (org.joml.Vector3ic)87 Vector3i (org.joml.Vector3i)52 Test (org.junit.jupiter.api.Test)35 BlockRegion (org.terasology.engine.world.block.BlockRegion)28 Chunk (org.terasology.engine.world.chunks.Chunk)28 ChunkImpl (org.terasology.engine.world.chunks.internal.ChunkImpl)16 Block (org.terasology.engine.world.block.Block)12 ReceiveEvent (org.terasology.engine.entitySystem.event.ReceiveEvent)11 Map (java.util.Map)8 Lists (com.google.common.collect.Lists)5 List (java.util.List)5 EntityRef (org.terasology.engine.entitySystem.entity.EntityRef)5 LocationComponent (org.terasology.engine.logic.location.LocationComponent)5 BlockRegionComponent (org.terasology.engine.world.block.regions.BlockRegionComponent)5 Maps (com.google.common.collect.Maps)4 Sets (com.google.common.collect.Sets)4 ArrayList (java.util.ArrayList)4 Collections (java.util.Collections)4 Set (java.util.Set)4 Vector3f (org.joml.Vector3f)4