OpticalJS: Add KubeJS Support to Create Optical

OpticalJS adds KubeJS support for Create Optical in Minecraft, letting you craft custom focusing recipes with simple code. Download OpticalJS now.

Download optical js for Minecraft 1.21.1

Original name: optical js

Minecraft: 1.21.1

Loaders: NeoForge

FileVersionLoaderSize
optical_js-2.0.0.jar1.21.1NeoForge38 КБDownload

OpticalJS

If you have spent any time tinkering with the Create mod in Minecraft, you know that its optical addon opens up a world of possibilities. But what if you want to go further and create your own custom recipes without wrestling with complex JSON files? That is exactly where OpticalJS steps in. This clever add-on bridges the gap between Create Optical and KubeJS, giving you a clean, code-based way to define new focusing recipes. It is a game-changer for modpack creators and players who love to customize their experience.

What Exactly Does OpticalJS Do?

At its core, OpticalJS is a compatibility layer. It takes the powerful recipe system from Create Optical and makes it accessible through KubeJS. Instead of manually editing JSON files and hoping you got the syntax right, you can write simple JavaScript events. The result is a much more intuitive workflow for adding new recipes. For example, you can define a recipe that turns a copper door into a brass door after a specific amount of time under the right light. The code is straightforward and readable, which is a huge relief for anyone who has ever struggled with raw data packs.

Supported Versions and Loaders

As of the initial release, OpticalJS 1.0.0 is built to work with Create Optical 0.2.1 and KubeJS 2001.6.5-build.16. This means you will need to be running a version of Minecraft that supports these mods, typically on the Forge loader. The mod is designed to be lightweight and does not require any additional dependencies beyond what you already have for Create Optical and KubeJS. Always check the mod page for the latest compatibility updates, as the developer is likely to add support for newer versions over time.

How to Install OpticalJS for Minecraft

Getting started is simple. First, make sure you have both Create Optical and KubeJS installed and running correctly. Then, you simply drop the OpticalJS jar file into your mods folder. There is no complex configuration needed. Once you launch the game, the mod will load and you can start writing your custom recipes. For those who are looking to streamline the process even further, the foxygame.net launcher offers a one-click install for modpacks that include OpticalJS, saving you from manually managing dependencies and version conflicts. It is a handy tool for keeping your setup organized.

How to Install via the Mods Folder

  • Download the OpticalJS jar file from a trusted source.
  • Navigate to your Minecraft game directory.
  • Open the mods folder.
  • Copy the OpticalJS jar file into this folder.
  • Launch Minecraft with the Forge profile to verify it loads correctly.

Writing Your First Recipe with OpticalJS

The beauty of OpticalJS is in its simplicity. You use the ServerEvents.recipes event to add new focusing recipes. The basic structure is event.recipes.create_optical.focusing(output, input, time, beamType). The output is what you get, the input is what you put in, the time is how many ticks the process takes, and the beam type is the kind of light required. This is a massive improvement over the traditional JSON approach, which requires you to know the exact schema and resource locations.

Understanding the Beam Types

One of the most important aspects of Create Optical is the beam type. In OpticalJS, you can specify this using a number or a string. The numbers correspond to specific light types: 0 is radio, 1 is microwave, 2 is visible light, 3 is gamma, and 4 is none. After version 0.1.1, you can also use the enum name directly, like 'gamma' or 'radio'. This makes your code much more readable and less prone to errors. For example, a recipe requiring a lever and exposure to gamma light would look like this: event.recipes.create_optical.focusing(["create:analog_lever"], ["minecraft:lever"], 10, 'gamma').

When you are setting up a new modpack, having this level of control is invaluable. You can balance your progression by making certain items require more exotic light sources or longer processing times. The foxygame.net launcher also features an add-on catalog where you can browse and install mods like OpticalJS directly, which is perfect for discovering new tools and ensuring you have the right versions for your game. It takes the guesswork out of manual downloads.

Practical Code Examples

Let us look at a few examples to see how easy it is. The first recipe will turn a copper door into a brass door. The second will turn a lever into an analog lever using radio light, and the third will do the same but with gamma light. The code is as follows:

ServerEvents.recipes(event => {
  event.recipes.create_optical.focusing(
    ["create:brass_door"],
    ["create:copper_door"]
  )
  event.recipes.create_optical.focusing(
    ["create:analog_lever"],
    ["minecraft:lever"],
    10, 0
  )
  event.recipes.create_optical.focusing(
    ["create:analog_lever"],
    ["minecraft:lever"],
    10, 'gamma'
  )
})

In the first example, the default processing time is 40 ticks. The second and third examples specify a time of 10 ticks. The first recipe requires no specific beam type, while the others do. This flexibility allows you to create intricate and unique crafting chains that fit perfectly into your world.

Why Use OpticalJS?

For anyone who is serious about modding, OpticalJS is a must-have. It saves you time, reduces errors, and makes your code more maintainable. Whether you are a seasoned developer or a beginner just getting into modpacks, the learning curve is gentle. The documentation is clear, and the community around KubeJS is very supportive. If you are wondering how to install it, the process is the same as any other Forge mod, and you can easily find guides online by searching for "how to install OpticalJS".

Final Thoughts

OpticalJS is a fantastic addition to the Minecraft modding scene. It elegantly solves a common problem and opens up new creative avenues. By combining the power of Create Optical with the flexibility of KubeJS, it empowers you to craft the exact gameplay experience you want. So, go ahead and download OpticalJS for Minecraft, start experimenting with the code, and see what amazing contraptions you can come up with. The only limit is your imagination.

--- **Update Sep 18, 2026:** Added 1 file for version 1.21.1 (NeoForge).