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;
}
Aggregations