Skip to content

Latest commit

 

History

History
68 lines (49 loc) · 1.92 KB

README.md

File metadata and controls

68 lines (49 loc) · 1.92 KB

GrowtopiaJS Github Stars NPM Version NPM Downloads NPM Minified GitHub Actions Workflow Status

A Rust based, cross-platform, high-performance Growtopia private server ENet framework utilizing Node.js, Bun.js.

Features

  • Stable
  • Built-in ItemsDat tools

Installation

npm i growtopia.js

Example

const { Client, TextPacket, Peer } = require("growtopia.js");

const client = new Client({
  enet: {
    ip: "0.0.0.0",
    port: 17091
  }
});

client.on("ready", () => {
  console.log(`ENet server: port ${client.config.enet.port} on ${client.config.enet.ip}`);
});

client.on("error", (err) => {
  console.log("Something wrong", err);
});

client.on("connect", (netID) => {
  console.log(`Connected netID ${netID}`);
  const peer = new Peer(client, netID);
  peer.send(TextPacket.from(0x1));
});

client.on("disconnect", (netID) => {
  console.log(`Disconnected netID ${netID}`);
});

client.on("raw", (netID, channelID, data) => {
  const peer = new Peer(client, netID);
  console.log("raw", data);
});

client.listen();

Links

Credits

Give a thumbs to these cool people