use of org.joml.Vector3dc in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class VSDarknessLibAPILightProvider method apply.
@Override
public Integer apply(final EntityPlayer entityPlayer) {
final World world = entityPlayer.world;
final AxisAlignedBB searchBB = new AxisAlignedBB(entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ, entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ).grow(8);
final List<PhysicsObject> nearbyShips = ValkyrienUtils.getPhysObjWorld(world).getPhysObjectsInAABB(searchBB);
final Vector3d temp0 = new Vector3d();
final BlockPos.MutableBlockPos temp1 = new BlockPos.MutableBlockPos();
int maxLight = 0;
for (final PhysicsObject physicsObject : nearbyShips) {
final Vector3dc positionInShip = physicsObject.getShipTransform().transformPositionNew(temp0.set(entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ), TransformType.GLOBAL_TO_SUBSPACE);
final BlockPos blockPosInShip = temp1.setPos(positionInShip.x(), positionInShip.y(), positionInShip.z());
final int blockLight = getLightFromNeighborsFor(world, EnumSkyBlock.BLOCK, blockPosInShip);
maxLight = Math.max(blockLight, maxLight);
}
return maxLight;
}
Aggregations