From fed962ce2749fe8aeb6ac3105c670581c5f6b28f Mon Sep 17 00:00:00 2001 From: Blhcm <54273219+blhcm@users.noreply.github.com> Date: Wed, 7 Feb 2024 00:48:08 +0800 Subject: [PATCH 1/4] Add README_zh_CN.md --- README_zh_CN.md | 109 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 README_zh_CN.md diff --git a/README_zh_CN.md b/README_zh_CN.md new file mode 100644 index 000000000..aad44d531 --- /dev/null +++ b/README_zh_CN.md @@ -0,0 +1,109 @@ +# prismarine-web-client +[![NPM version](https://img.shields.io/npm/v/prismarine-web-client.svg)](http://npmjs.com/package/prismarine-web-client) +[![Build Status](https://github.com/PrismarineJS/prismarine-web-client/workflows/CI/badge.svg)](https://github.com/PrismarineJS/prismarine-web-client/actions?query=workflow%3A%22CI%22) +[![Discord](https://img.shields.io/badge/chat-on%20discord-brightgreen.svg)](https://discord.gg/GsEFRM8) +[![Try it on gitpod](https://img.shields.io/badge/try-on%20gitpod-brightgreen.svg)](https://gitpod.io/#https://github.com/PrismarineJS/prismarine-web-client) + +| 🇺🇸 [English](README.md) | 🇷🇺 [Russian](README_RU.md) | 🇵🇹 [Portuguese](README_PT.md) | 🇨🇳 [简体中文](README_zh_CN.md) | +| ----------------------- | -------------------------- | ---------------------------- | ------------------------------- | + +一个能在网页上运行的 Minecraft 客户端. **在线演示 https://prismarinejs.github.io/prismarine-web-client/** + + +## 它是如何工作的 +prismarine-web-client 在浏览器中运行 mineflayer 和 prismarine-viewer,它通过 WebSocket 连接到代理 +它将 WebSocket 连接转换为 TCP 以连接到普通的 Minecraft 服务器。prismarine-web-client 基于: +* [prismarine-viewer](https://github.com/PrismarineJS/prismarine-viewer) 用于世界渲染 +* [mineflayer](https://github.com/PrismarineJS/mineflayer) 用于高级 Minecraft 客户端 API + +如果您想了解更多它的工作原理并做出贡献,请查看这些 Modules! + +## 屏幕截图 +![Screenshot of prismarine-web-client in action](screenshot.png) + +## 在线演示 +在您的浏览器中打开链接,无需安装: +https://prismarinejs.github.io/prismarine-web-client/ + +*在桌面端的 Chrome & Firefox 上进行了测试。* + +## 使用 +如果想要自己托管,请在终端内运行下列命令: +```bash +$ npm install -g prismarine-web-client +$ prismarine-web-client +``` +最后,在浏览器中打开 `http://localhost:8080`。 + +## 功能 +* 显示生物和玩家 +* 显示方块 +* 移动(您可以移动,而且也能看到其他实体移动) +* 放置和破坏方块 + +## 开发路线 +* 容器 (例如背包,箱子) +* 声音 +* 更多的互动功能 (例如攻击实体) +* 渲染功能 (例如昼夜循环,雾) + +## 开发 + +如果您想要进行贡献/更改,您需要以不同的方式安装它。 + +首先,Clone 这个 Repo。 + +然后,切换到该 Repo 的目录。例如: +```bash +$ cd ~/prismarine-web-client/ +``` + +最后运行: + +```bash +$ npm install +$ npm start +``` + +这将在开发模式下启动express和webpack;每当您保存文件时,将重新进行构建(需要 5 秒), + +您可以刷新页面以获取新内容。 + +在浏览器中打开 http://localhost:8080 。 + +您可能想在IDE中禁用自动保存,以避免不断重新构建;请参阅 +https://webpack.js.org/guides/development/#adjusting-your-text-editor 。 + +要检查生产构建(构建需要 1 分钟),您可以运行`npm run build-start`。 + +如果有兴趣做出贡献,可以前往https://github.com/PrismarineJS/prismarine-web-client/projects 。 + +这些变量在全局中 +``window`` +调试对象: +* ``bot`` +* ``viewer`` +* ``mcData`` +* ``worldView`` +* ``Vec3`` +* ``pathfinder`` +* ``debugMenu`` + +### 在调试菜单中添加内容 + +debugMenu.customEntries['myKey'] = 'myValue' +delete debugMenu.customEntries['myKey'] + +### 一些调试示例 + +在Chrome DevTools 中: + +* `bot.chat('test')` 允许你使用聊天 +* `bot.chat(JSON.stringify(Object.values(bot.players).map(({username, ping}) => ({username, ping}))))` 显示每个人的ping值 +* `window.bot.entity.position.y += 5` 跳跃 +* `bot.chat(JSON.stringify(bot.findBlock({matching:(block) => block.name==='diamond_ore', maxDistance:256}).position))` 找到钻石块的位置 +* `bot.physics.stepHeight = 2` 允许你在方块上跳跃的高度 +* `bot.physics.sprintSpeed = 5` 走的更快 +* `bot.loadPlugin(pathfinder.pathfinder)` then `bot.pathfinder.goto(new pathfinder.goals.GoalXZ(100, 100))` 传送至坐标 100, 100 处 + +有关更多调试想法,请参阅[mineflayer](https://github.com/PrismarineJS/mineflayer) 文档。 From ccea6cd96457a482146c269e6f49c5051f78cfa9 Mon Sep 17 00:00:00 2001 From: Blhcm <54273219+blhcm@users.noreply.github.com> Date: Wed, 7 Feb 2024 00:51:27 +0800 Subject: [PATCH 2/4] Add Chinese choice. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6a1a9ea98..c2c2b73d8 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@ [![Discord](https://img.shields.io/badge/chat-on%20discord-brightgreen.svg)](https://discord.gg/GsEFRM8) [![Try it on gitpod](https://img.shields.io/badge/try-on%20gitpod-brightgreen.svg)](https://gitpod.io/#https://github.com/PrismarineJS/prismarine-web-client) -| 🇺🇸 [English](README.md) | 🇷🇺 [Russian](README_RU.md) | 🇵🇹 [Portuguese](README_PT.md) | -| ----------------------- | -------------------------- | ---------------------------- | +| 🇺🇸 [English](README.md) | 🇷🇺 [Russian](README_RU.md) | 🇵🇹 [Portuguese](README_PT.md) | 🇨🇳 [简体中文](README_zh_CN.md) | +| ----------------------- | -------------------------- | ---------------------------- | ------------------------------- | A Minecraft client running in a web page. **Live demo at https://prismarinejs.github.io/prismarine-web-client/** From daf0f2ade1e7aa1a1981c229827556bd374141ac Mon Sep 17 00:00:00 2001 From: Blhcm <54273219+blhcm@users.noreply.github.com> Date: Wed, 7 Feb 2024 00:53:05 +0800 Subject: [PATCH 3/4] Add Chinese choice. --- README_PT.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README_PT.md b/README_PT.md index 143759425..6c893dd0e 100644 --- a/README_PT.md +++ b/README_PT.md @@ -4,8 +4,8 @@ [![Discord](https://img.shields.io/badge/chat-on%20discord-brightgreen.svg)](https://discord.gg/GsEFRM8) [![Try it on gitpod](https://img.shields.io/badge/try-on%20gitpod-brightgreen.svg)](https://gitpod.io/#https://github.com/PrismarineJS/prismarine-web-client) -| 🇺🇸 [English](README.md) | 🇷🇺 [Russian](README_RU.md) | 🇵🇹 [Portuguese](README_PT.md) | -| ----------------------- | -------------------------- | ---------------------------- | +| 🇺🇸 [English](README.md) | 🇷🇺 [Russian](README_RU.md) | 🇵🇹 [Portuguese](README_PT.md) | 🇨🇳 [简体中文](README_zh_CN.md) | +| ----------------------- | -------------------------- | ---------------------------- | ------------------------------- | Um cliente de Minecraft a funcionar numa página web. **Demostração em https://prismarinejs.github.io/prismarine-web-client/** From 01bcef1537e73c86ae86aa568930a9381909a186 Mon Sep 17 00:00:00 2001 From: Blhcm <54273219+blhcm@users.noreply.github.com> Date: Wed, 7 Feb 2024 00:54:23 +0800 Subject: [PATCH 4/4] Add Chinese choice. --- README_RU.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README_RU.md b/README_RU.md index 40704df45..2765d7509 100644 --- a/README_RU.md +++ b/README_RU.md @@ -4,8 +4,8 @@ [![Discord](https://img.shields.io/badge/chat-on%20discord-brightgreen.svg)](https://discord.gg/GsEFRM8) [![Try it on gitpod](https://img.shields.io/badge/try-on%20gitpod-brightgreen.svg)](https://gitpod.io/#https://github.com/PrismarineJS/prismarine-web-client) -| 🇺🇸 [English](README.md) | 🇷🇺 [Russian](README_RU.md) | 🇵🇹 [Portuguese](README_PT.md) | -| ----------------------- | -------------------------- | ---------------------------- | +| 🇺🇸 [English](README.md) | 🇷🇺 [Russian](README_RU.md) | 🇵🇹 [Portuguese](README_PT.md) | 🇨🇳 [简体中文](README_zh_CN.md) | +| ----------------------- | -------------------------- | ---------------------------- | ------------------------------- | Клиент Minecraft, запущенный на веб-странице. **Демонстрация на https://prismarinejs.github.io/prismarine-web-client/**