Skip to content

Commit 865137a

Browse files
committed
chore: update package name and version, update README installation instructions, and modify package dependencies
1 parent 7701506 commit 865137a

File tree

3 files changed

+642
-147
lines changed

3 files changed

+642
-147
lines changed

README.md

+81-88
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,15 @@
66

77
</div>
88

9-
<p align="center">TikTokLiveMCBE is a simple tool that connects your TikTok Live stream with your Minecraft.</p>
9+
<p align="center">TikTokLiveMCBE is a simple tool that connects your TikTok Live stream with your Minecraft BE/PE.</p>
1010

11-
## Setup Tutorial on Termux
11+
## Installation
12+
13+
### Prerequisites
14+
15+
Before you begin, ensure you have [Node.js](https://nodejs.org/) installed on your computer. If you're on an Android device, you can use Termux to run TikTokLiveMCBE.
16+
17+
#### Setup Tutorial on Termux
1218

1319
Click the image below to watch the full setup tutorial on YouTube!
1420

@@ -18,33 +24,27 @@ Click the image below to watch the full setup tutorial on YouTube!
1824

1925
</div>
2026

21-
## Installation
22-
23-
### Prerequisites
24-
25-
Before you begin, ensure you have Node.js installed. If you're on a mobile device, you can use Termux to run this WebSocket server.
26-
27-
- [Download & Install Node.js](https://nodejs.org/)
28-
29-
1. Download the Latest Release
27+
1. **Download the Latest Release**
3028

3129
Download the latest version of TikTokLiveMCBE. Look for the ZIP file in the list of assets.
3230

3331
> - [Download TikTokLiveMCBE](https://github.com/rqinix/TikTokLiveMCBE/releases/)
3432
>
3533
> **_Show your support by giving it a ⭐!_**
3634
37-
2. Uncompress the ZIP File
35+
2. **Uncompress the ZIP File**
36+
37+
- Once the download is complete, extract the contents of the ZIP file to a folder of your choice.
3838

39-
- Once the download is complete, uncompress the ZIP file.
39+
3. **Navigate to the TikTokLiveMCBE Folder**
4040

41-
3. Navigate to the Project Directory
41+
- Using your terminal or command prompt, navigate to the extracted folder. For example:
4242

4343
```bash
4444
cd TikTokLiveMCBE
4545
```
4646

47-
4. Install the Dependencies
47+
4. **Install the Dependencies**
4848

4949
```bash
5050
npm install
@@ -60,18 +60,7 @@ Then install the dependencies:
6060
yarn install
6161
```
6262

63-
5. Set Up Configuration
64-
65-
Create an `.env` file in the root directory
66-
67-
```bash
68-
TIKTOK_USERNAME=tiktok_username
69-
PORT=3000 # or any other port you want to use
70-
```
71-
72-
> **Note:** The TIKTOK_USERNAME should be the username of the TikTok account you want to connect to.
73-
74-
6. Start the Server
63+
5. **Start the Server**
7564

7665
Start the TikTokLiveMCBE server:
7766
```bash
@@ -82,23 +71,44 @@ or if you're using Yarn:
8271
yarn start
8372
```
8473

85-
> When you start the TikTokLiveMCBE server, it will attempt to connect to the TikTok live stream associated with the username specified in the .env file.
74+
TikTokLiveMCBE will prompt you to provide your TikTok username, port number (default is `3000`), and select your desired plugins from the available options.
8675

87-
7. Connect Minecraft to Server
76+
```bash
77+
Welcome to TikTokLiveMCBE!
78+
✔ Enter TikTok username (must be live): rqinix
79+
✔ Enter the port number: 3000
80+
? Select plugins to activate: (Press <space> to select, <a> to toggle all, <i> to invert selection, and <enter> to
81+
proceed)
82+
❯◯ TNT Coin by Rqinix
83+
```
84+
85+
```bash
86+
Welcome to TikTokLiveMCBE!
87+
✔ Enter TikTok username (must be live): rqinix
88+
✔ Enter the port number: 3000
89+
✔ Select plugins to activate: TNT Coin by Rqinix
90+
✔ Connected to rqinix TikTok Live Stream.
91+
Open Minecraft and run this command '/connect localhost:3000' to connect.
92+
<Ctrl + C> to stop the server.
93+
```
94+
95+
6. **Connect Minecraft to TikTokLiveMCBE**
96+
97+
Once TikTokLiveMCBE is successfully connected to the live stream, open Minecraft and connect to the server using the following command:
8898

89-
In your Minecraft, connect to the server by typing the following command:
9099
```bash
91100
/connect localhost:3000
92101
```
93-
Replace `localhost` with your server’s IP address if you are not running it locally.
94102

95-
## Usage
103+
This command establishes the connection between Minecraft and TikTokLiveMCBE. Make sure the port matches the one configured during the setup process.
104+
105+
---
96106

97-
### Subscribe to Minecraft Events
107+
## Subscribing to Minecraft Events
98108

99-
In your application file (e.g. `app.ts`), you can subscribe to Minecraft events like this:
109+
You can subscribe to Minecraft events like this:
100110
```ts
101-
import { connection } from "./core/MinecraftTikTokBridge.js";
111+
import { connection } from "./core/TikTokLiveMcbe.js";
102112

103113
const { tiktok, minecraft } = connection;
104114

@@ -165,17 +175,18 @@ This will output:
165175
BlockPlaced Event: {"body":{"block":{"aux":0,"id":"diamond_block","namespace":"minecraft"},"count":1,"placedUnderWater":false,"placementMethod":0,"player":{"color":"ffededed","dimension":0,"id":-4294967295,"name":"Steve","position":{"x":11.93433761596680,"y":-56.45503997802734,"z":13.82549858093262},"type":"minecraft:player","variant":0,"yRot":-95.34191131591797},"tool":{"aux":0,"enchantments":[],"freeStackSize":0,"id":"diamond_block","maxStackSize":64,"namespace":"minecraft","stackSize":64}},"header":{"eventName":"BlockPlaced","messagePurpose":"event","version":17039360}}
166176
```
167177

168-
### Sending Minecraft Commands
178+
## Sending Minecraft Commands
179+
169180
```ts
170181
minecraft.sendCommand('say hello, world!');
171182
```
172183

173-
### Handling TikTok Events
184+
## Handling TikTok Events
174185

175186
You can also handle TikTok events, such as receiving gifts, likes, chats and follows, as shown below:
176187

177188
```ts
178-
import { connection } from "./core/MinecraftTikTokBridge.js";
189+
import { connection } from "./core/TikTokLiveMcbe.js";
179190

180191
const { tiktok, minecraft } = connection;
181192

@@ -216,71 +227,53 @@ tiktok.events.onShare(data => {
216227
// ...
217228
```
218229

219-
## Using TNT Coin Add-On
220-
221-
- [Download TNT Coin Addon](https://github.com/rqinix/TNTCoin/releases)
222-
223-
In your application file (e.g., `app.ts`), you can enable the TNTCoin extension as follows:
224-
```ts
225-
import { connection } from "./src/core/MinecraftTikTokBridge.js";
230+
## Creating Plugins for TikTokLiveMCBE
226231

227-
// import the TNT Coin
228-
import { useTNTCoin } from "./src/extensions/tntcoin.js";
232+
TikTokLiveMCBE supports custom plugins to extend its functionality. Each plugin must have its own folder containing two files:
229233

230-
// Enable the TNTCoin extension
231-
useTNTCoin();
234+
1. `manifest.json`
235+
- This file describes the plugin's metadata.
232236

233-
//...
237+
Below is an example:
234238
```
235-
236-
The TNTCoin extension listens for various TikTok events, such as join, like, chat, and gift events, and sends corresponding script events to Minecraft. These script events include messages containing relevant information, such as the nickname and unique ID of the user who triggered the event.
237-
238-
For example, when someone joins the stream, the extension sends a `tntcoin:join` script event to Minecraft, containing the nickname and unique ID of the user who joined:
239-
```ts
240-
tiktok.events.onJoin((data) => {
241-
// convert our JSON message to string
242-
const message = JSON.stringify({
243-
uniqueId: data.uniqueId,
244-
nickname: data.nickname,
245-
});
246-
247-
// send `/scripevent` command to minecraft
248-
minecraft.sendScriptEvent('tntcoin:join', message);
249-
});
250-
```
251-
252-
This simply just sends a minecraft command:
253-
```bash
254-
/scriptevent tntcoin:join {"uniqueId":"steve123","nickname":"steve"}
239+
{
240+
"name": "My Custom Plugin",
241+
"version": "1.0.0",
242+
"description": "A custom plugin for TikTokLiveMCBE.",
243+
"author": "Your Name"
244+
}
255245
```
256-
You can also run this manually in-game if you want to test a function that runs when script event like `tntcoin:join` sent without connecting to server:
257246

258-
<div>
247+
Ensure `manifest.json` includes `name`, `version`, `description`, and `author`.
259248

260-
![img1](./docs/images/image_1.png)
261-
![img2](./docs/images/image_2.png)
249+
2. `main.ts` or `main.js`
250+
- Contains the plugin's logic. Example:
251+
```js
252+
import { TikTokLiveMCBE } from "../../core/TikTokLiveMcbe.js";
262253

263-
</div>
254+
export function plugin(tiktokLiveMcbe: TikTokLiveMCBE): void {
255+
const { tiktok, minecraft } = tiktokLiveMcbe;
264256

265-
When the TNTCoin add-on receives the `tntcoin:join` event with the associated message, it triggers a function to execute specific actions:
266-
```ts
267-
// Path to the onJoin event handler: /src/game/events/onJoin.ts
257+
console.log('Hello TikTokLiveMCBE');
268258

269-
export function onJoin(game: TNTCoin, message: string): void {
270-
// Parse the JSON message to string
271-
const data = JSON.parse(message);
272-
const { nickname, uniqueId } = data;
273-
274-
// Send a welcome message to the player in Minecraft
275-
game.player.sendMessage(`§aWelcome, §e${nickname} (@${uniqueId})§a!`);
259+
minecraft.on("connected", () => {
260+
const data = { tiktokUserName: tiktok.username };
261+
minecraft.sendCommand(`tellraw @a {"rawtext":[{"text":"LOL"}]}`);
262+
});
276263
}
277264
```
278265

279-
<div>
266+
#### Plugin Folder Structure
280267

281-
![img3](./docs/images/image_3.png)
268+
```
269+
plugins/
270+
├── MyCustomPlugin/
271+
│ ├── manifest.json
272+
│ └── main.ts
273+
```
282274

283-
</div>
275+
### Submitting Your Plugin
276+
If you’ve created a plugin that you’d like to share with the community, feel free to open a pull request or contribute to the TikTokLiveMCBE repository.
284277

285278
## Contributing
286279

0 commit comments

Comments
 (0)