Download KubeJS ComputerCraft — Minecraft Mods — MetaMods

KubeJS ComputerCraft

Active

Downloads

0

Last update

3 years ago
Client

KubeJS ComputerCraft

This addon enables the creation of custom peripheral devices for any blocks directly through the KubeJS scripting platform and their integration with ComputerCraft mod.

Usage example

Core Features

Users can programmatically add modern interaction interfaces to various world blocks of Minecraft. This utilizes two primary approaches to method execution, each with specific performance characteristics.

Method Execution Features

Main Thread Methods (mainThreadMethod): These operations execute in the game's main thread with synchronization for safe access to gameplay data. However, they feature performance limitation - maximum one call per tick. This approach ensures stability when working with entity NBT data and other thread-sensitive operations.

Asynchronous Methods (method): Unlike the previous ones, these methods have no call frequency restrictions and execute considerably faster. The main limitation lies in the inability to directly access world data and some synchronized resources.

Peripheral Creation Example

onEvent("computercraft.peripheral", event => {
    event.registerPeripheral("furnace", "furnace")
        // This method executes in the main thread
        // since it requires accessing game entity data.
        .mainThreadMethod("burnTime", (container, direction, arguments) => {
            return container.entityData.getInt("BurnTime")
        })
        // This method executes quickly without limitations
        // but cannot access complex world data.
        .method("say_hi", (container, direction, arguments) => {
            container.up.set("diamond_block")
            return "hi, here's your diamond block"
        })
})

The service supports both Forge and Fabric versions.

Project members
Amygdaloideae

Amygdaloideae

Created: 18 Jul 2022

ID: 98999