- TypeScript 51.3%
- JavaScript 48.7%
| config/default | ||
| scripts | ||
| src | ||
| .gitignore | ||
| LICENSE | ||
| manifest.json | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
InariConnector
Minecraft Bedrock Edition addon that connects a server to Inari through WebSocket.
The addon initializes players, periodically sends their position, view direction, and mute status, and automatically attempts to reconnect when the connection is closed.
Features
- WebSocket connection to Inari when the world loads.
- Server authentication with an API key.
- Periodic synchronization of connected players.
- An Inari code assigned to each initialized player.
- Commands for displaying a code and managing mute status.
- Connection and reconnection messages sent to players with the
stafftag.
Requirements
- Minecraft Bedrock Edition Vanilla Server.
- An Inari WebSocket URL.
- A valid Inari API key.
The project versions are declared in package.json:
- TypeScript
7.x. @minecraft/serverbeta.@minecraft/server-adminbeta.@minecraft/server-netbeta.
Installation
Clone the project and install its dependencies:
npm install
Then configure the values for your server in:
config/default/variables.json
config/default/permissions.json
Example variables.json:
{
"INARI_WS_URL": "wss://inari.example.com/ws",
"INARI_API_KEY": "your-api-key"
}
Replace the example values before starting the server. Never publish the API key in a public repository.
Note: the API key is stored in
variables.jsonand not insecrets.json, because Bedrock secrets cannot be used with WebSocket connections, so the addon would be unable to use it.
Build
Compile the TypeScript source into the scripts/ directory:
npx tsc
The generated entry point is scripts/main.js, as declared in
manifest.json.
Installing in Minecraft
- Build the project with
npx tsc. - Place the addon folder in Minecraft's behavior pack directory.
- Activate the behavior pack on the target world.
- Make sure the required scripting modules are available in your Minecraft version.
- Start the world and check the server logs.
The manifest declares scripts/main.js as the script module entry point.
Minecraft Commands
/inari:inari
Displays the player's Inari code.
/inari:mute
Allows a player to mute themselves.
Force Mute
To force mute a player, simply add the muted tag to them:
/tag <player> add muted
To remove the force mute, remove the tag:
/tag <player> remove muted
Project Structure
src/ TypeScript source code
src/main.ts Addon entry point
src/entities/ Entity and player initialization
config/default/ Configuration variables
scripts/ Generated JavaScript files
manifest.json Behavior pack declaration
tsconfig.json TypeScript 7 configuration
JavaScript files in scripts/ are generated by the compiler. Modify the code
in src/, then rebuild the project.
License
This project is distributed under the GNU Affero General Public License v3.0. See LICENSE for the full license text.