NetJS (KubeJS Addon) – Safe Network Calls for Minecraft Scripts

NetJS (KubeJS Addon) brings safe async network requests to KubeJS scripts for Minecraft. Fetch Pastebin and GitHub Gists without freezing your game.

NetJS (KubeJS Addon)

Scripting in Minecraft has always had one stubborn limitation: the moment your code needs to reach the internet, everything grinds to a halt. NetJS (KubeJS Addon) exists to solve exactly that problem. It is a lightweight companion mod for KubeJS that hands script authors a controlled, safe way to make network requests from inside their scripts, without locking up the client or the server while data travels across the web.

If you have ever tried to pull configuration data, changelogs, or shared resources into a modpack dynamically, you already know why this matters. NetJS (KubeJS Addon) for Minecraft keeps the interaction narrow and predictable on purpose, which makes it a far safer choice than exposing a full HTTP client to every script on your server.

What NetJS Actually Does

The mod itself is intentionally minimal. On its own it does nothing visible in-game. What it adds is a wrapper object called NetJS that becomes available anywhere in your KubeJS scripts. That wrapper exposes a small set of methods, currently focused on two popular sources of raw text: Pastebin and GitHub Gists.

Because the scope is deliberately limited, there is no risk of scripts wandering off to arbitrary endpoints. You get the network access you need for practical modpack workflows, and nothing more.

Async and Linear Modes Explained

The real design decision behind NetJS is how it handles threading, and it gives you two distinct approaches.

Async Mode (Recommended)

By default, network access happens on a separate thread. The game keeps running normally, and your callback fires once the result arrives. The syntax looks like this:

  • NetJS.getPasteBin('3zCF8MM6', result => {})
  • NetJS.getGists('3f1cd831af032e52238ef161bdd715b3', result => {})

This is the pattern you should reach for almost every time. Players never notice a stutter, and server ticks stay clean even when a remote host is slow to respond.

Linear Mode (Use With Caution)

You can also force a blocking call by passing false as the second argument:

  • NetJS.getPasteBin('3zCF8MM6', false, result => {})
  • NetJS.getGists('3f1cd831af032e52238ef161bdd715b3', false, result => {})

This halts the main client or server thread until the result comes back. It is not recommended for anything a player will interact with, but it can be handy in tightly controlled startup logic where you genuinely need the data before proceeding.

Version Support and Loader Compatibility

NetJS (KubeJS Addon) is built for the Forge ecosystem and follows the KubeJS release cadence closely. Supported Minecraft versions track the KubeJS branches, so 1.18.2, 1.19.2, and 1.20.1 modpacks are the typical targets, with newer branches appearing as KubeJS itself updates. Always match the addon build to your exact KubeJS version, since the wrapper depends on KubeJS internals that shift between releases.

For players who prefer a frictionless setup, the foxygame.net launcher lists NetJS (KubeJS Addon) in its add-on catalog and handles version matching automatically, so you never have to hunt down the right build for your pack.

How to Install

Getting started is straightforward, and knowing how to install correctly saves a lot of head-scratching later.

  • Confirm your modpack already includes KubeJS and that you know its exact version.
  • Download NetJS (KubeJS Addon) from the official project page or your preferred launcher.
  • Drop the jar into your mods folder alongside KubeJS.
  • Launch the game once to confirm the mod loads without errors.
  • Open a script file and test the wrapper with a simple async Pastebin call.

If the wrapper is undefined in your scripts, the usual culprit is a version mismatch between the addon and KubeJS. Double-check both builds before troubleshooting anything else.

Practical Use Cases

So what do people actually build with this? Common patterns include fetching remote changelogs for a custom update screen, loading shared server rules from a Pastebin document, pulling community-maintained recipe data from a Gist, and displaying live event information in a book or GUI. Because the callback receives the raw result, you can parse it however your script requires.

Keep in mind that NetJS is a tool, not a security layer. Treat remote content as untrusted, validate what you receive, and avoid feeding fetched strings directly into commands or file operations.

Final Thoughts

NetJS (KubeJS Addon) fills a small but genuinely useful gap in the KubeJS toolbox. It does not try to be a full networking library, and that restraint is precisely its strength. If your modpack needs to pull text from Pastebin or GitHub Gists safely, with async callbacks that keep the game responsive, this addon delivers exactly that with almost no overhead. Pair it with a solid KubeJS setup, mind your versions, and you have a clean path to dynamic, network-aware scripting in Minecraft.