Coder Social home page Coder Social logo

voxelum / minecraft-launcher-core-node Goto Github PK

View Code? Open in Web Editor NEW
175.0 8.0 25.0 28.64 MB

Provide packages to install Minecraft, launch Minecraft and more to build launcher with NodeJs/Electron!

Home Page: https://docs.xmcl.app/en/core/

License: MIT License

TypeScript 98.51% HTML 1.49%
minecraft typescript minecraft-launcher nodejs electron minecraft-launcher-node minecraftforge fabric

minecraft-launcher-core-node's Introduction

Minecraft Launcher Core

npm Build Status Convensional Commits Discord

Provide several useful functions to build a Minecraft Launcher.

Most packages are targeting the Electron environment. Feel free to report issues related to it.

Looking for C# Launcher Core?

Introduce the awesome .net framework launcher core, ProjBobcat.

It's the next generation Minecraft launcher core written in C# providing the freest, fastest and the most complete experience. https://corona.studio

Featured Launcher

  • x-minecraft-launcher: An launcher provides general electron api related to minecraft launching (in renderer side), making other developers can easily create new launcher view.
  • PureLauncher: An awesome Minecraft Launcher using React to build beautiful UI.

Getting Started

You can see Active Packages section to quickly find a package you need.

Go our document website to find more detail usage.

Active Packages

Name Usage Version Location Runtime Envrionment
@xmcl/core Launch Minecraft npm version packages/core Node
@xmcl/installer Install Minecraft npm version packages/installer Node
@xmcl/user User Authentication and skin npm version packages/user Node/Browser
@xmcl/mod-parser Parse forge/liteloader/fabric mod npm version packages/mod-parser Node/Browser
@xmcl/curseforge Provide Curseforge API npm version packages/curseforge Node/Browser
@xmcl/modrinth Provide Modrinth API npm version packages/modrinth Node/Browser
@xmcl/forge-site-parser Parse forge website npm version packages/forge-site-parser Node/Browser
@xmcl/client Utilities of Minecraft client network. Ping Minecraft Server npm version packages/client Node
@xmcl/model Display player/block model npm version packages/model Browser
@xmcl/gamesetting Parse game setting npm version packages/gamesetting Node/Browser
@xmcl/nbt Parse NBT npm version packages/nbt Node/Browser
@xmcl/text-component Parse and render Minecraft text npm version packages/text-component Node/Browser
@xmcl/game-data Load level data or servers.dat npm version packages/game-data Node/Browser
@xmcl/resourcepack Parse resource pack npm version packages/resourcepack Node/Browser
@xmcl/task Util package to create task npm version packages/task Node/Browser
@xmcl/system A fs middleware for browser/node npm version packages/system Node/Browser
@xmcl/unzip yauzl unzip wrapper npm version packages/unzip Node
@xmcl/file-transfer High performance undici file download implementation npm version packages/file-transfer Node
@xmcl/nat-api Port mapping with UPnP and NAT-PMP npm version packages/nat-api Node
@xmcl/bytebuffer The bytebuffer module port from bytebuffer.js npm version packages/bytebuffer Node/Browser

Comsuming the Packages with bundlers

The whole project use typescript and esbuild to build. It will build both esm and commonjs version js files. Some modules can be used in browser, and they will have browser version built.

Nowaday, the bundler should all support reading the module field in package.json and use the esm version. If you are using webpack, you can use the resolve.mainFields option to specify which field to use.

From my experience, the esbuild and vite works pretty fine with current package.json.

Contribute

See Contribute.md

Special Thanks

yushijinhun, the author of JMCCC which inspire this library.

Indexyz, helped me a lot on Minecraft launching, authing.

And all of contributors of this repo!

minecraft-launcher-core-node's People

Contributors

cecer avatar ci010 avatar dozono avatar erisdev avatar genegames avatar github-actions[bot] avatar holdyourwaffle avatar honxmsft avatar jamesonknutson avatar jocat avatar john-dean avatar lasmgratel avatar lukechu10 avatar reterw avatar rqbik avatar ryanccn avatar so1ve avatar ssouper avatar tomate0613 avatar tw4r avatar yuxuanchiadm avatar zardoy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

minecraft-launcher-core-node's Issues

Module importing

I encountered a problem with importing your packages in main process of my project that is based on electron-react-boilerplate. I couldn't do anything with webpack configs, so I tried importing index.cjs of each package. The problem is that there is no type definitions for these files, which is stopping me from doing anything with them.

Corrupted versions

It seems that parsing versions installed by custom Minecraft launchers is broken.
I installed my versions using custom Minecraft launcher -- TLauncher, but I couldn't get them to work with @xmcl/core. When I try to parse them - they either throw CorruptedVersionJson, CorruptedVersionJar or MissingLibrary error. But that's really strange -- I can successfully see them in official Minecraft launcher (I didn't test launching them, but isn't seeming them in Minecraft launcher enough?)

I investigated into this issue a little bit, and found out that the structure of [version].json is indeed different to the one you are checking.

if ("natives" in lib) {
if (!lib.natives[platform.name]) { return undefined; }
const classifier = (lib.natives[platform.name]).replace("${arch}", platform.arch.substring(1));
const nativeArtifact = lib.downloads.classifiers[classifier];
if (!nativeArtifact) { return undefined; }
return new ResolvedNative(lib.name + ":" + classifier, LibraryInfo.resolve(lib.name + ":" + classifier), lib.downloads.classifiers[classifier], lib.extract ? lib.extract.exclude ? lib.extract.exclude : undefined : undefined);
}

When checking for native libraries -- you depend on classifiers object of downloads. In my ''corrupted'' [version].json these native libraries don't have downloads parameter, but instead have classifies (not classifiers) and artifacts in the root object of library.
TL;DR: You test for this structure of native library:

{
    name: '...'
    // ...
   downloads: {
         artifact: Artifact;
         classifiers: {
              [os: string]: Artifact;
         },
    };
}

But in my "corrupted" [version].json I have this structure:

{
    name: '...'
    // ...
    artifact: Artifact;
    // notice that it doesn't have an 'r'
    classifies: {
         [os: string]: Artifact;
    },
}

Which is really strange. Is this a strange spaghetti code of custom Minecraft launcher, or does official Minecraft launcher implement different structures of native libraries [and custom Minecraft launcher uses a different structure than yours]?


But my main question isn't about all of this. My main question is: How can I resolve these versions or fix this issue?

My two options are:

  • Reinstall these versions [or somehow normalize their .json file] in background
  • Drop compatibility with these custom launchers (not good)

If I reinstall these corrupted versions, will their settings reset? Will my users even notice it?
Is reinstalling other launchers' versions even good -- what if they stop working after I install different [version].json? Is this even a good decision design-wise?

I'm pretty stuck with this issue. Please help :)

Couple of questions regarding this "ecosystem"

I just found this repository while doing the whole "this must have been done before"-search for a project I'm working on, and I have to say it looks very promising and I'd love to contribute ๐Ÿ˜„

I have a few questions however to clear up some confusion:

  1. I found two other repositories in this organization that look very similar to some modules in this one, minecraft-three-model and minecraft-resource-manager-js. What's the relation between those repositories and their "corresponding" modules in this repository? (model and resource-manager)

  2. What's the relation between resourcepack and resource-manager? Intuitively I'd think resourcepack would be a "resource implementation" for resource-manager, but various "common resource interfaces" like Resource and ResourceLocation are defined in the (more specific) resourcepack.

  3. The documentation on what is a resource/resource-manager/resource-pack/resource-source doesn't seem to "add up" so to speak. For example, the resource-manager readme mentions an addResourceSource method on ResourceManager, but I can't find the definition for this. The documentation for ResourceManager also mentions a generic parameter for the "type of resource content", but it doesn't seem to actually exist.
    I know there are more of these kinds of discrepancies, but right now I only remember those two. Is the documentation just outdated or am I missing something here?

  4. What is the zlib folder inside the nbt module?

As I said before, I'd love to contribute to this project (#102 (comment)), but right now I'm mostly getting confused by it ๐Ÿ˜…

Add support for Javascript, not Typescript

I want to use this module in minecraft launcher that made of electron-vue boilerplate. But there is no example code about JS. And I don't know TS. Can you add example code for JS?

Unable to import the package through the Vue template.

Hello. I have a problem. I use Electron in conjunction with Vue. I import the dependency in the template, but after compilation, various errors keep appearing. In the latest version of the "@xmcl/core" it gives an error with a cycle:

electron_dRr68I805J

The template looks like this

I just started to master the library, so there is no complex code. It's all:

<template>
  <div id="main">
    <input v-model="username" type="text" />
    <input v-model="password" type="password" />
    <input v-on:click="playgame" type="button" value="Play" />
  </div>
</template>

<script>
	import { launch } from "@xmcl/core";

	export default {
	  name: "home-page",
	  data: {
	    username: null,
	    password: null
	  },
	  methods: {
	    playgame () {
		console.log(launch);
	    }
	  }
	}
</script>

The dependencies I am using are

{
"dependencies": {
    "@xmcl/core": "2.6.0",
    "@xmcl/unzip": "^2.0.0",
    "@xmcl/user": "^2.1.5",
    "axios": "^0.18.0",
    "form-data": "^4.0.0",
    "uuid": "^8.3.2",
    "vue": "^2.5.16",
    "vue-devtools": "^5.1.4",
    "vue-electron": "^1.0.6",
    "vue-router": "^3.0.1",
    "vuex": "^3.0.1",
    "vuex-electron": "^1.0.0",
    "yauzl": "^2.10.0"
  },
  "devDependencies": {
    "ajv": "^6.5.0",
    "babel-core": "^6.26.3",
    "babel-eslint": "^8.2.3",
    "babel-loader": "^7.1.4",
    "babel-minify-webpack-plugin": "^0.3.1",
    "babel-plugin-transform-runtime": "^6.23.0",
    "babel-preset-env": "^1.7.0",
    "babel-preset-stage-0": "^6.24.1",
    "babel-register": "^6.26.0",
    "cfonts": "^2.1.2",
    "chalk": "^2.4.1",
    "copy-webpack-plugin": "^4.5.1",
    "cross-env": "^5.1.6",
    "css-loader": "^0.28.11",
    "del": "^3.0.0",
    "devtron": "^1.4.0",
    "electron": "^2.0.4",
    "electron-builder": "^20.19.2",
    "electron-debug": "^1.5.0",
    "electron-devtools-installer": "^2.2.4",
    "eslint": "7.26.0",
    "eslint-config-standard": "^11.0.0",
    "eslint-friendly-formatter": "^4.0.1",
    "eslint-plugin-html": "6.1.2",
    "eslint-plugin-import": "2.22.1",
    "eslint-plugin-node": "11.1.0",
    "eslint-plugin-promise": "5.1.0",
    "eslint-webpack-plugin": "^2.5.4",
    "file-loader": "^1.1.11",
    "html-webpack-plugin": "^3.2.0",
    "listr": "^0.14.3",
    "mini-css-extract-plugin": "0.4.0",
    "node-loader": "^0.6.0",
    "node-sass": "^4.9.2",
    "sass-loader": "^7.0.3",
    "style-loader": "^0.21.0",
    "url-loader": "^1.0.1",
    "vue-html-loader": "^1.2.4",
    "vue-loader": "^15.2.4",
    "vue-style-loader": "^4.1.0",
    "vue-template-compiler": "^2.5.16",
    "webpack": "^4.15.1",
    "webpack-cli": "^3.0.8",
    "webpack-dev-server": "^3.1.4",
    "webpack-hot-middleware": "^2.22.2",
    "webpack-merge": "^4.1.3"
  }
}

I have not found a topic with a similar problem, so I can assume that I am doing something wrong. Any suggestions?

The "options.agent" property must be one of type Agent-like Object, undefined, or false.

When I try to install minecraft jar with @xmcl/installer, I get the following error but not all the times:

GotError: The "options.agent" property must be one of type Agent-like Object, undefined, or false. Received type object

I only get this error in a linux environment (which is sandboxed in a docker environment) or when I test my launcher with spectron which is also sandboxed.

My guess is that it has something to do with these lines:

/**
* The default downloader based on gotjs
*/
export class DefaultDownloader implements Downloader {
constructor(readonly requster = got.extend({
agent: {
http: new HttpAgent(),
https: new HttpsAgent(),
} as any,
followRedirect: true,
})) { }

However, when I do the following, I don't get any error:

const got = require("got")
const HttpAgent = require("agentkeepalive")
const { HttpsAgent } = HttpAgent;

await got("https://www.google.com", {
    agent: {
        http: new HttpAgent(),
        https: new HttpsAgent()
    }
).text();

But if I replace https: new HttpsAgent() with https: new Object(), I get the same error. There must be some conditional agent in the code that I am not aware of that is causing this issue.

Cannot read property 'rawText' of undefined

Hey, there appears to be a change in the structure of the forge website which causes the forge installer to crash.

This line const url = tt.querySelector("a") || elem.querySelector("a") gets the dom element with the following html:

<a href="/maven/net/minecraftforge/forge/1.14.4-28.1.80/forge-1.14.4-28.1.80-changelog.txt">
    <i class="fa download-classifier classifier-changelog" aria-hidden="true"></i> Changelog
</a>

then it tries to get its first child node (the i tag) and tries to get its rawText, which it does not have because 'Changelog' is now the next element.

Heres the stackstrace:

TypeError: Cannot read property 'rawText' of undefined
    at I:/Projects/catlunch/node_modules/@xmcl/forge-installer/forgeweb.ts:32:57
    at Array.map (<anonymous>)
    at I:/Projects/catlunch/node_modules/@xmcl/forge-installer/forgeweb.ts:27:26
    at Array.map (<anonymous>)
    at parse (I:/Projects/catlunch/node_modules/@xmcl/forge-installer/forgeweb.ts:24:18)
    at Object.getIfUpdate (I:/Projects/catlunch/node_modules/@xmcl/net/index.ts:40:16)
    at runMicrotasks (<anonymous>)
    at Object.getWebPage (I:/Projects/catlunch/node_modules/@xmcl/forge-installer/forgeweb.ts:136:22)
    at Install.run (I:/Projects/catlunch/src/commands/install.ts:67:18)

the crash should be reproducable by simply getting the forge versions with the forge installer module:

    const page = await ForgeWebPage.getWebPage(
      {mcversion: installcfg.minecraft_version}
    )

JavaInstaller does not work.

I'm getting a TypeError: Cannot read property '64' of undefined when i attempt to call installJreFromMojang

It's failing on const { sha1, url } = info[system][currentArch].jre;
I'm suspecting because its using os.platform.name as system, which is "platform" in this case

Extract natives caused the problem to fail to launch 1.13

Cause:
https://github.com/InfinityStudio/ts-minecraft/blob/472e0e6059ac0b2ea240dd7823b20fd05cfe32ca/src/libs/launch.ts#L180-L185
Should be:

let zip = await Zip().loadAsync(await fs.readFile(from))
for (const entry of zip.filter(containsExcludes)) {
  const filePath = path.join(native, entry.name);
  if (entry.dir) {
    if (await !fs.existsSync(filePath))
      await fs.mkdir(filePath);
  } else {
    await fs.ensureFile(filePath);
    await fs.writeFile(filePath, await entry.async('nodebuffer'))
  }
}

Roadmap

This issue will list the thing I'm currently doing or planning to do, but there is no guarantee for a date to deliver these...

  • A better fabric metadata support in @xmcl/installer
  • Optifine installer (beta)
  • An independent curseforge (@xmcl/curseforge) package support bunch of cusreforge/twitch API
  • More general support for java downloading (not require lzma version, if I can find a src)
  • A recommended way to setup webpack, electron with the packages.
  • [Feature] Chunk parsing in @xmcl/world.
  • [Feature] Chunk rendering in @xmcl/model
  • BMCLAPI special support. I will take time to investigate if this is necessary.
  • [Refactor] Use other module to swap bytebuffer to reduce final built size
  • [Refactor] Use other backend other than threejs to reduce bundle size (raised by @ShirasawaSama)

Goal of Chunk parsing

Provide a set of API to parse Minecraft chunk (.mca) file which can read the block id or name in chunk.

Some good references

How to validate

We can capture the chunk data by writing mod, which might be really helpful to test.

I don't know how to catch Task.CancelledError()

When I use

handle.cancel()

It will trigger a CancelledError, but I don't know how to catch it.

Such as: catch caught nothing

handle.wait().then(() => {
 console.log('Assets files downloaded.')
}).catch((err) => {
 log('Error', err)
})

Some features

I would like to request some features for launch speed optimization:

  • Data caching: avoid unnecessary IO access.
  • Customizable UnzipAPI: To use native-build libraries, e.g. zipfile.
  • Hash-checking at startup can be disabled.

ServerStatus ping timeout

We really need to have the time-out and auto-retry function for ServerStatus fetching....
Sometimes, the request never responses, and this will deflate users' experiences...

Error with got decompressResponse is not a function

When I use any method that has some kind of http request, I get the following error:

Type Error: decompressResponse is not a function

Here is my code:

import { Installer } from "@xmcl/installer";
import path from "path";

(async () => {
	const temp = await Installer.getVersionList();
	const app = remote.app;
	await Installer.install("client", temp.versions[0], path.join(app.getPath("userData"), "./game/"));
})();

Edit
Auth module still seems to work because if I recall correctly, it uses window.fetch instead of got.

Github Pages Website details

I'll be interested to work on the website because it is something I know how to do. However, I do not know whether there are any constraints or whether there are any frameworks I should use. I am pretty open and can use any framework required.

Losing stacktrace on error during compound tag write

When debugging #125 I noticed that stacktraces get lost if an error occurs when writing a compound tag. Instead of a helpful pointer to offending code, I got the following error from jest:

โ— NBT โ€บ #serialize โ€บ default โ€บ async

    Failed: Object {
      "message": "Require LongArray but found object",
      "type": "IllegalInputType",
    }

      133 |                 //expect(value).toStrictEqual(src);
      134 |             });
    > 135 |             test("async", async () => {
          |             ^
      136 |                 const src = new TestType();
      137 |                 const buffer = await serialize(src, { compressed: compress });
      138 |                 //expect(buffer).toBeTruthy();

      at Env.it (node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:89:24)
      at testNBT (packages/nbt/test.ts:135:13)
      at Suite.describe (packages/nbt/test.ts:154:13)
      at Suite.describe (packages/nbt/test.ts:153:9)

As you can probably imagine, this wasn't a fun one to debug ๐Ÿ˜“
The offending code:

try {
buf.writeByte(tagType);
writeUTF8(buf, key);
writer.write(buf, value, childContext);
} catch (e) {
if (e instanceof TypeError) {
throw {
type: "IllegalInputType",
message: `Require ${TagType.getName(tagType)} but found ${typeof value}`,
};
}
}

I think the stacktrace is lost because a 'plain object' is thrown instead of an actual Error. (I didn't even know you could do that, although I'm definitely not surprised.)

The (false) stacktrace that's listed in the log points to jest code that creates an Error instance. This is probably the error that causes the actual message in the log, thus creating a false stacktrace.

General Idea of Roadmap

These issue is opened for put some rough idea about the future of the project.

Currently, I personally want the project to have:

  • Some modules to support browser. (This is already in action, see the PR #49)
    1. Let the infra to support this. (Already covered in #49)
    2. Write browser middleware for all supporting browser modules (Not started)
    3. Add setup browser env test for them (Not started)
  • More higher test coverage! (Always in progress)
  • Make a github page as our website, it can have a playground for the modules supporting the browser env.
  • Support more on minecraft chunk/region parsing (Some covered in PR #49)
  • Support more model rendering for minecraft model, like chunk rendering (Not Started)

ForgeInstaller doesn't work

const minecraft = path.resolve(__dirname, 'client')
try {
    const res = await ForgeInstaller.install({ version: '31.2.9', mcversion: '1.15.2' }, minecraft)
    console.log(res)
} catch (err) {
    console.log(err)
}
console.log('done')

Running the above just exits the application after ForgeInstaller.install. None of the console.log statements run, and only the following is output in the versions folder in the client:

+ versions
    + 1.15.2-forge-31.2.9
        + 1.15.2-forge-31.2.9.json
        + install_profile.json

Running on Windows 10 (2004), Node 14, with:

"@xmcl/core": "^2.3.1",
"@xmcl/installer": "^2.9.1",

I expect I might be doing something wrong, but I also expect to be able to catch the error and not have the application force quit.

Separate output directories

I noticed that there are no separate directories for compiled files (such as dist).
IMHO this would be a welcome improvement, since it creates a much cleaner workspace.
I'd be happy to create a PR for this if you agree.

[5.0.22-beta] Launch: Main class not found

I am trying to use this libarary to launch minecraft, but it throws this error:

Error: Could not find or load main class net.minecraft.client.main.Main
Caused by: java.lang.ClassNotFoundException: net.minecraft.client.main.Main

This is the full source code

import { Launcher, Version } from "ts-minecraft";

const javaPath = '/usr/bin/java';
const gamePath = 'temp';
const versionId = '1.14.2';

async function main() {
  const metas = await Version.updateVersionMeta();
  const version = metas.versions.find(version => version.id === versionId);
  await Version.install('client', version, gamePath);
  const process = await Launcher.launch({ gamePath, javaPath, version: version.id });
  process.stderr.on('data', data => console.error(data.toString()));
}

main().catch(console.error);

And this is the contents of my gamePath:

โ”œโ”€โ”€ assets
โ”‚   โ”œโ”€โ”€ objects // IGNORED
โ”‚   โ””โ”€โ”€ indexes
โ”‚       โ””โ”€โ”€ 1.14.json
โ”œโ”€โ”€ libraries // IGNORED
โ””โ”€โ”€ versions
    โ””โ”€โ”€ 1.14.2
        โ”œโ”€โ”€ 1.14.2.jar
        โ”œโ”€โ”€ 1.14.2.json
        โ””โ”€โ”€ 1.14.2-natives
            โ”œโ”€โ”€ libfliteWrapper.so
            โ”œโ”€โ”€ libglfw.so
            โ”œโ”€โ”€ libglfw_wayland.so
            โ”œโ”€โ”€ libjemalloc.so
            โ”œโ”€โ”€ liblwjgl_opengl.so
            โ”œโ”€โ”€ liblwjgl.so
            โ”œโ”€โ”€ liblwjgl_stb.so
            โ””โ”€โ”€ libopenal.so

New NBT API need more testcase

So we got a new typed tree based NBT API. Need more testcase then we can merge it to master.

  • TestEmpty
  • TestSignleValue
  • TestAllTags
  • TestIllegalTags
  • TestNestedCompound
  • TestNestedList

Add more if needed.

Fetch is not defined

I built with electron 6.0.0 & vuejs & electron-builder.

and I have tried npn i node-fetch, it throw an error:

Launching Electron...
ReferenceError: fetch is not defined
    at post (webpack:///./node_modules/@xmcl/auth/index.module.js?:13:22) 
    at eval (webpack:///./node_modules/@xmcl/auth/auth.js?:13:59)
    at Object.login (webpack:///./node_modules/@xmcl/auth/auth.js?:107:20)
    at EventEmitter.eval (webpack:///./src/main/login.js?:20:61)
    at EventEmitter.emit (events.js:200:13)
    at WebContents.<anonymous> (*\node_modules\electron\dist\resources\electron.asar\browser\api\web-contents.js:335:21)
    at WebContents.emit (events.js:200:13)

Swap to github actions and organize the workflow

  1. Use github actions to run the test
    • Split the test to make them run in parallel
    • This requires lots of mocking data...
  2. Auto bump version & publish npm packages if a pull request is merged
    • This is not really work now, as it requires to push some commit back to repo in github actions
    • Maybe let the actions create a pr is another way...

Cant build.

node_modules/@xmcl/util/fs.ts:136:52 - error TS2345: Argument of type 'Error' is not assignable to parameter of type 'string'.

136             .on("error", (e) => { reject(new Error(e)); })

:(

List minecraft saves in a folder

It would be nice to have an utility to list all the minecraft worlds and return the corresponding data. There doesn't seem to be any built-in functionality in this package apart from the nbt module. If you want, I can implement it here.

Edit:
Oh wait, I didn't see the docs for @xmcl/world. It would still be nice, however, to have an utility to list the saves.

No sound on minecraft versions prior to 1.7

There seems to be no support for the old way of how the game stored its sounds, or i am doing something wrong. :(
Assets from assets/objects/(first 2 hex letters of hash)/(whole hash) are not being copied over to assets/virtual/legacy/

Cannot Install minecraft

const { install, getVersionList, Version} = require("@xmcl/installer/minecraft");

async function testinstall() {
    const minecraft="./minecraft";
    const list = await getVersionList();
    const aVersion = list[0];
    await install("client", aVersion, minecraft)
};
testinstall()

I just ran this code. Then an error occurred.

C:\Users\doohe\WebstormProjects\MRS-electronjs-launcher\node_modules\@xmcl\installer\minecraft.js:1
import { MinecraftFolder, Version as VersionJson } from "@xmcl/core";
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at Module._compile (internal/modules/cjs/loader.js:892:18)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:849:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (C:\Users\doohe\WebstormProjects\MRS-electronjs-launcher\src\renderer\components\js\mchandler.js:1:45)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)

What's wrong?

[BUG] spawn java ENOENT

Sometimes when I use Launcher.launch(), I get the following error:
Error: spawn java ENOENT
This is because the argument for javaPath is "java" but it also gives the same error if I use the entire path on my computer. I have no idea what the cause of this error is because when I run:

var child_process = require("child_process");
child_process.spawn("java");

... it works perfectly fine.

Socket Hangup

Sockets will hangup when # of concurrent https request is huge

Forge 2852 and 2851 fails to install for 1.12.2

These two forge versions fail to install for Minecraft version 1.12.2 with the error:

Error: Cannot install forge json for 14.23.5.2852 since the version json is missing!

I suspect because the forge webpage is different for these two versions
Forge website

Core Dependencies Rewrite

Rewrite or get rid of some core dependencies we are using.

Currently we should rewrite the downloader part of the code. We should separate the downloader as a individual nodejs module.
The code is in 'packages/installer/util.ts'. We should make it more generic.

Consider to replace the core library.

  • Buffer, it does not support tree-shaking, and we should make it simpler
  • Long, use nodejs bigint to handle long instead of a separate lib

Wrong Maven URL for Forge 1.7.10

Unable to download http://files.minecraftforge.net/maven/net/minecraftforge/forge/1.7.10-10.13.3.1400-1.7.10/forge-1.7.10-10.13.3.1400-1.7.10.jar Error occured during downloading lib: net.minecraftforge:forge:1.7.10-10.13.3.1400-1.7.10 { GotError [HTTPError]: Response code 404 (Not Found)

It seems that -universal is missing from the URL

Using ts-minecraft version 5.2.3

Demo bugs

Demo bug โ„–1

On your docs website, there is a preview of a skin and a grass block.

It is possible to zoom too far out (or in) so the models will disappear.

screenshot

It's actually a pretty easy fix, you just need to add 4 new lines in docs/site/demo.js file, and I could open a pull request for it, but I'm not sure about what values for control.maxDistance & control.minDistance should be, and I can't clone this repo atm to test it.

Edit: Seems like there were some sort of a fix for this issue, but only for player model preview & it's commented out.

Demo bug โ„–2

Why does the skin model have these weird lines between body parts and around the head?

image

Alternative skin model previewers (like, for example, Skinview3d) don't have this issue.

[BUG] Auth.Yggdrasil.login() "req is not a function"

When I run the following code:

const authFromMojang: Auth.Response = await Auth.Yggdrasil.login({ username, password });

I get the following error:

Exception has occurred: TypeError
TypeError: req is not a function
    at D:\Users\lukew\Visual Studio\Minecraft-Box-Launcher\node_modules\@xmcl\auth\auth.js:11:59
    at Object.login (D:\Users\lukew\Visual Studio\Minecraft-Box-Launcher\node_modules\@xmcl\auth\auth.js:106:20)

This only happens after I have upgraded to the 1.0.0 branch

I am not quite sure what is the cause of this error because of all the refactoring in the new auth module. However, it does seem to me that it has something to do with this line (auth/auth.ts:32):

function wrap(req: PostRequester) {
    return async function (url: string, payload: object) {
        const { body, statusCode, statusMessage } = await req(url, payload);
        if (statusCode < 200 || statusCode >= 300) {
            throw { statusCode, statusMessage, ...body };
        }
        return body;
    }
}

In this scenario, the debugger says req is undefined.

OS: Windows 10 (build 1909)
NodeJS: v10.16.0
Electron: v7.1.2
minecraft-launcher-core: v1.0.2

I am running this in the renderer process

Thanks for any help.

WorldInfo modification

Currently, we only support WorldInfo reading.

Though, we want the basic level of modification on the WorldInfo. (We already have a strong NBT support, which makes this much easier)

This is the current WorldInfo class. I only picked some important (I think) properties.
Feel free to support more properties you believe is fine to view/modify.

The readonly property don't need to write to nbt (of course).
The public property will be write into nbt.

export class WorldInfo {
    constructor(
        // readonly filename: string,
        public displayName: string,
        readonly sizeOnDisk: Long,
        readonly lastPlayed: Long,
        readonly gameRule: GameRule,
        readonly dataVersion: number,
        readonly version: { snapshot?: number, id: number, name: string },
        readonly generatorName: string,

        public difficulty: number,
        public gameType: GameType,
        public isHardCore: boolean,
        public enabledCheat: boolean,
        public spawnPoint: Pos3,

        public borderCenter: Pos2,
        public borderDamagePerBlock: number,
        public borderWarningBlocks: number,
        public BorderSizeLerpTarget: number
    ) { }
}

่ฏดไบ†้‚ฃไนˆๅคšๅ…ถๅฎžๅฐฑๆ˜ฏ่ฎฉ็Žฉๅฎถ่ƒฝๆœ‰็›ดๆŽฅๆ”นๅŠจไธ–็•Œ่ฎพ็ฝฎ็š„่ƒฝๅŠ›2333level.dat้‡ŒไนŸๅญ˜ไบ†็Žฉๅฎถ็š„ๆ•ฐๆฎ๏ผŒๅฆ‚ๆžœไปฅๅŽๆœ‰็ฒพๅŠ›็”š่‡ณๅฏไปฅๆ”น็Žฉๅฎถ็Šถๆ€ๅ’Œ่ƒŒๅŒ…ๆ•ฐๆฎ็ญ‰โ€ฆโ€ฆไฝ†ๆ— ่ฎบๅฆ‚ไฝ•่ฟ™็Žฉๆ„ๅ†™่ตทๆฅๆฏ”่พƒๆžฏ็‡ฅ

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.