模组正在重写,请加入 Discord
FabricMC + JavaScript = JSCore
JSCore 是 FabricMC 的一个轻量级封装。
这个模组能做什么?
该模组为 Minecraft 模组开发提供了完整的 JavaScript 支持,你可以创建或使用社区模块来定制你的游戏。
简而言之,JSCore 可以:
- 完成典型 JS 运行时(如 KubeJS)所能做的所有事情。
- 实现 FabricMC 中不依赖 Mixins* 的所有功能。
- 与其他模组进行交互。
*Mixins 的支持取决于 Discord 上某位成员能否使其正常运行。
如何使用?
只需下载该模组并运行游戏即可!
阅读 快速入门指南。
它与 KubeJS/JSMacros 有何不同?
访问 Minecraft 内部类
JSCore 允许访问 net.minecraft 包中的类——FabricMC 能做到的任何事情(除 Mixins 外),JSCore 也能做到。
// client: net.minecraft.client.MinecraftClient
let client = net.minecraft.client.MinecraftClient.getInstance();
// player: net.minecraft.client.network.ClientPlayerEntity
let player = client.player;
// position: net.minecraft.util.math.BlockPos
let position = player.getBlockPos();
类似 Node.js 的模块系统
Node.js 的模块系统允许将复杂的游戏机制构建为小而可管理的部分,因此我们将其引入 JSCore。
// init.js
let savePlayers = require("./savePlayers");
savePlayers();
// savePlayers.js
let fs = require("fs");
let { getPlayers } = require("./getPlayers");
function savePlayers() {
let players = getPlayers();
let content = JSON.stringify(players);
fs.writeFileSync("./playerList.json", content);
}
module.exports = savePlayers;
该模组有哪些特性?
该模组在启动时会运行 init.js。
其他功能由第三方模块提供,例如:
- Rinode:提供
console.log 和 fs 等 Node.js 特性。
- Command:声明式注册 Minecraft 命令。
- Pully:JSCore 的包管理器。
软件包列表可在 软件包仓库 中找到,任何人都可以向此仓库发布软件包。
该模组的工作原理是什么?
Minecraft 的代码经过混淆处理,无法直接使用其真实名称进行引用。该模组使用 Yarnwrap,它对所有 net.minecraft 类进行了封装,从而允许使用真实名称而非混淆后的名称。
该模组仍处于早期阶段,如需支持或推动其发展,请加入 Discord。
MOD BEING REWRITTEN, JOIN DISCORD INSTEAD
BEFORE DOWNLOADINGRead the JSCore Player Guide and Join Discord
FabricMC + JavaScript = JSCore
JSCore is a thin wrapper around FabricMC.
What does this mod do?
This mod provides full JavaScript support for Minecraft modding, you can create or use community modules to customise your game.
In short, JSCore can do
- Everything a typical JS runtime, such as KubeJS, can do.
- Everything in FabricMC that does not use Mixins*
- Interact with other mods.
*Mixins support depends on whether one guy on Discord can get it to work or not.
How to use it?
Just download the mod and run the game!
Read the Quickstart Guide.
How is it different from KubeJS/JSMacros?
Access to Minecraft Internals
JSCore allows access to classes in the net.minecraft package - anything that FabricMC can do (except Mixins), JSCore can also do it.
// client: net.minecraft.client.MinecraftClient
let client = net.minecraft.client.MinecraftClient.getInstance();
// player: net.minecraft.client.network.ClientPlayerEntity
let player = client.player;
// position: net.minecraft.util.math.BlockPos
let position = player.getBlockPos();
Module System Similar to Node.js
The module system from Node.js allows complex game mechanics to be built from small and managable chunks, so we brought it to JSCore.
// init.js
let savePlayers = require("./savePlayers");
savePlayers();
// savePlayers.js
let fs = require("fs");
let { getPlayers } = require("./getPlayers");
function savePlayers() {
let players = getPlayers();
let content = JSON.stringify(players);
fs.writeFileSync("./playerList.json", content);
}
module.exports = savePlayers;
What features does this mod have?
This mod runs init.js on start.
Additional features are provided by third-party modules, such as
- Rinode: provide Node.js features such as
console.log and fs.
- Command: Declarative Minecraft command registration.
- Pully: package manager for JSCore.
A list of package can be found in the package repository, anyone can publish packages to this repository.
How does this mod work?
The Minecraft code is obfuscated and cannot be referred to by their real name. This mod uses Yarnwrap, which wraps all net.minecraft classes so their real name can be used instead of their obfuscated name.
This mod is still in its early stages, please join Discord for support or to sway its development.
评论 0
登录后参与评分
还没有评论,来抢沙发吧