Search in sources :

Example 21 with TIntIterator

use of gnu.trove.iterator.TIntIterator in project OsmAnd-tools by osmandapp.

the class ObfFileInMemory method readTransportData.

public void readTransportData(BinaryMapIndexReader indexReader, TransportIndex ind, boolean override) throws IOException {
    SearchRequest<TransportStop> sr = BinaryMapIndexReader.buildSearchTransportRequest(MapUtils.get31TileNumberX(lonleft), MapUtils.get31TileNumberX(lonright), MapUtils.get31TileNumberY(lattop), MapUtils.get31TileNumberY(latbottom), -1, null);
    List<TransportStop> sti = indexReader.searchTransportIndex(ind, sr);
    // merged could not be overridden
    TIntLongMap routesData = putTransportStops(sti, override);
    if (routesData.size() > 0) {
        int[] filePointers = routesData.keys();
        // reads all route
        TIntObjectHashMap<TransportRoute> transportRoutes = indexReader.getTransportRoutes(filePointers);
        TIntIterator it = transportRoutes.keySet().iterator();
        while (it.hasNext()) {
            int offset = it.next();
            TransportRoute route = transportRoutes.get(offset);
            Long routeId = route.getId();
            if (override || !this.transportRoutes.containsKey(routeId)) {
                this.transportRoutes.put(routeId, route);
            }
        }
    }
}
Also used : TIntIterator(gnu.trove.iterator.TIntIterator) TransportRoute(net.osmand.data.TransportRoute) TIntLongMap(gnu.trove.map.TIntLongMap) TransportStop(net.osmand.data.TransportStop)

Example 22 with TIntIterator

use of gnu.trove.iterator.TIntIterator in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class BalloonProcessor method doLastHoleCheck.

private boolean doLastHoleCheck(BlockPos holeToCheck, BlockPos[] adjacentPositions) {
    BalloonHoleDetector holeDetector = new BalloonHoleDetector(holeToCheck, parent.worldObj, 2500, this);
    if (!holeDetector.cleanHouse) {
        // Wow the hole is actually filled! Add the new positions here!
        TIntIterator newBallonWallIterator = holeDetector.newBalloonWalls.iterator();
        TIntIterator newAirPostitionsIterator = holeDetector.foundSet.iterator();
        while (newBallonWallIterator.hasNext()) {
            int hash = newBallonWallIterator.next();
            BlockPos fromHash = holeDetector.getPosWithRespectTo(hash, holeDetector.firstBlock);
            balloonWalls.add(fromHash);
            internalAirPositions.remove(fromHash);
            balloonHoles.remove(fromHash);
        }
        while (newAirPostitionsIterator.hasNext()) {
            int hash = newAirPostitionsIterator.next();
            BlockPos fromHash = holeDetector.getPosWithRespectTo(hash, holeDetector.firstBlock);
            internalAirPositions.add(fromHash);
            balloonWalls.remove(fromHash);
            balloonHoles.remove(fromHash);
        }
        return true;
    }
    return false;
}
Also used : TIntIterator(gnu.trove.iterator.TIntIterator) MutableBlockPos(net.minecraft.util.math.BlockPos.MutableBlockPos) BlockPos(net.minecraft.util.math.BlockPos)

Example 23 with TIntIterator

use of gnu.trove.iterator.TIntIterator in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class BalloonProcessor method makeProcessorForDetector.

public static BalloonProcessor makeProcessorForDetector(PhysicsWrapperEntity wrapper, BalloonDetector detector) {
    TIntIterator ballonWallIterator = detector.balloonWalls.iterator();
    TIntIterator airPostitionsIterator = detector.foundSet.iterator();
    HashSet<BlockPos> staticBalloonWalls = new HashSet<BlockPos>();
    HashSet<BlockPos> staticInternalPositions = new HashSet<BlockPos>();
    int minX, maxX, minY, maxY, minZ, maxZ;
    minX = maxX = detector.firstBlock.getX();
    minY = maxY = detector.firstBlock.getY();
    minZ = maxZ = detector.firstBlock.getZ();
    while (ballonWallIterator.hasNext()) {
        int hash = ballonWallIterator.next();
        BlockPos fromHash = detector.getPosWithRespectTo(hash, detector.firstBlock);
        staticBalloonWalls.add(fromHash);
        minX = Math.min(minX, fromHash.getX());
        minY = Math.min(minY, fromHash.getY());
        minZ = Math.min(minZ, fromHash.getZ());
        maxX = Math.max(maxX, fromHash.getX());
        maxY = Math.max(maxY, fromHash.getY());
        maxZ = Math.max(maxZ, fromHash.getZ());
    }
    while (airPostitionsIterator.hasNext()) {
        int hash = airPostitionsIterator.next();
        BlockPos fromHash = detector.getPosWithRespectTo(hash, detector.firstBlock);
        staticInternalPositions.add(fromHash);
    }
    BalloonProcessor toReturn = new BalloonProcessor(wrapper, staticBalloonWalls, staticInternalPositions);
    toReturn.minX = minX;
    toReturn.minY = minY;
    toReturn.minZ = minZ;
    toReturn.maxX = maxX;
    toReturn.maxY = maxY;
    toReturn.maxZ = maxZ;
    return toReturn;
}
Also used : TIntIterator(gnu.trove.iterator.TIntIterator) MutableBlockPos(net.minecraft.util.math.BlockPos.MutableBlockPos) BlockPos(net.minecraft.util.math.BlockPos) HashSet(java.util.HashSet)

Example 24 with TIntIterator

use of gnu.trove.iterator.TIntIterator in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class WorldPhysicsCollider method runPhysCollision.

//Runs the collision code
public void runPhysCollision() {
    // Multiply by 20 to convert seconds (physTickSpeed) into ticks (ticksSinceCacheUpdate)
    ticksSinceCacheUpdate += 20D * calculator.physTickSpeed;
    TIntIterator iterator = cachedHitsToRemove.iterator();
    while (iterator.hasNext()) {
        cachedPotentialHits.remove(iterator.next());
    }
    cachedHitsToRemove.clear();
    if (shouldUpdateCollisonCache()) {
        updatePotentialCollisionCache();
    // Collections.shuffle(cachedPotentialHits);
    }
    processPotentialCollisionsAccurately();
}
Also used : TIntIterator(gnu.trove.iterator.TIntIterator)

Example 25 with TIntIterator

use of gnu.trove.iterator.TIntIterator in project Terasology by MovingBlocks.

the class OpenGLMesh method createIndexBuffer.

private void createIndexBuffer(TIntList indexList) {
    IntBuffer indexBuffer = BufferUtils.createIntBuffer(indexList.size());
    TIntIterator iterator = indexList.iterator();
    while (iterator.hasNext()) {
        indexBuffer.put(iterator.next());
    }
    indexBuffer.flip();
    if (disposalAction.vboIndexBuffer == 0) {
        disposalAction.vboIndexBuffer = disposalAction.bufferPool.get(getUrn().toString());
    }
    VertexBufferObjectUtil.bufferVboElementData(disposalAction.vboIndexBuffer, indexBuffer, GL15.GL_STATIC_DRAW);
    indexBuffer.flip();
}
Also used : TIntIterator(gnu.trove.iterator.TIntIterator) IntBuffer(java.nio.IntBuffer)

Aggregations

TIntIterator (gnu.trove.iterator.TIntIterator)39 MutableBlockPos (net.minecraft.util.math.BlockPos.MutableBlockPos)13 BlockPos (net.minecraft.util.math.BlockPos)8 ArrayList (java.util.ArrayList)5 TIntArrayList (gnu.trove.list.array.TIntArrayList)4 TIntHashSet (gnu.trove.set.hash.TIntHashSet)4 IBlockState (net.minecraft.block.state.IBlockState)4 Chunk (net.minecraft.world.chunk.Chunk)4 EntityData (org.terasology.protobuf.EntityData)4 TIntList (gnu.trove.list.TIntList)3 HashSet (java.util.HashSet)3 ExtendedBlockStorage (net.minecraft.world.chunk.storage.ExtendedBlockStorage)3 Vector (ValkyrienWarfareBase.API.Vector)2 TFloatArrayList (gnu.trove.list.array.TFloatArrayList)2 ItemStack (net.minecraft.item.ItemStack)2 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)2 TileEntity (net.minecraft.tileentity.TileEntity)2 EntityRef (org.terasology.engine.entitySystem.entity.EntityRef)2 EntityRef (org.terasology.entitySystem.entity.EntityRef)2 VWChunkCache (ValkyrienWarfareBase.Relocation.VWChunkCache)1