private static uint Pack(float x, float y) { uint word1 = PackHelpers.PackSigned(ushort.MaxValue, x); uint word2 = PackHelpers.PackSigned(ushort.MaxValue, y) << 16; return(word1 | word2); }
/// <summary> /// Builds the pack by resolving all dependencies. /// </summary> public async Task <bool> Build() { var failed = false; var watch = new Stopwatch(); watch.Start(); try { // Resolve the mods (and all of their dependencies if possible). // This will locate the most up to date version of the mod, and get the identifier of that specific file for the Minecraft version. _pack.LockedContent = await _resolver.ResolveAsync(_pack); watch.Stop(); _logger.LogInformation($"Taken {watch.ElapsedMilliseconds}ms to resolve {_pack.LockedContent.Count} mods."); } catch (ResolverException e) { _logger.LogError($"Failed to resolve mod {e}: {e.Message}"); } if (failed) { _logger.LogError("Pack compile failed"); return(false); } // TODO: Download (and cache) // TODO: Generate lock files for packing stage // TODO: should resolved also be here??? await PackHelpers.LockPack(_folder.FullName, _pack); return(true); }
private static ulong Pack(float x, float y, float z, float w) { ulong word1 = PackHelpers.PackSigned(ushort.MaxValue, x); ulong word2 = (ulong)PackHelpers.PackSigned(ushort.MaxValue, y) << 16; ulong word3 = (ulong)PackHelpers.PackSigned(ushort.MaxValue, z) << 32; ulong word4 = (ulong)PackHelpers.PackSigned(ushort.MaxValue, w) << 48; return(word1 | word2 | word3 | word4); }
private static async Task <PackService> LoadPack(string dir, bool lockfile = false) { var path = PackHelpers.GetPackPath(dir); var pack = await PackHelpers.LoadPack(path, lockfile); if (pack == null) { return(null); } var service = provider.GetRequiredService <PackService>(); service.InitFrom(pack, new DirectoryInfo(path)); return(service); }