Search in sources :

Example 11 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)

Aggregations

TIntIterator (gnu.trove.iterator.TIntIterator)11 MutableBlockPos (net.minecraft.util.math.BlockPos.MutableBlockPos)9 BlockPos (net.minecraft.util.math.BlockPos)6 HashSet (java.util.HashSet)3 Vector (ValkyrienWarfareBase.API.Vector)2 TIntHashSet (gnu.trove.set.hash.TIntHashSet)2 ArrayList (java.util.ArrayList)2 IBlockState (net.minecraft.block.state.IBlockState)2 Chunk (net.minecraft.world.chunk.Chunk)2 ExtendedBlockStorage (net.minecraft.world.chunk.storage.ExtendedBlockStorage)2 VWChunkCache (ValkyrienWarfareBase.Relocation.VWChunkCache)1 Feature (edu.cmu.ml.proppr.prove.wam.Feature)1 TIntDoubleIterator (gnu.trove.iterator.TIntDoubleIterator)1 TIntArrayList (gnu.trove.list.array.TIntArrayList)1 Field (java.lang.reflect.Field)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 SPacketUnloadChunk (net.minecraft.network.play.server.SPacketUnloadChunk)1 TileEntity (net.minecraft.tileentity.TileEntity)1