-
Notifications
You must be signed in to change notification settings - Fork 2
Documentation
Welcome to the KubeJS + CC: Tweaked wiki! Here is where everything is
Tip
ComputerCraftEvents.peripheral(function (event) {})
has to be put inside a KubeJS startup script.
Also, read this super useful!!
-
event.registerPeripheral(type, blockStateMatcher)
type: string
The peripheral type name of your choice
blockStateMatcher: string | RegExp
A string or regular expression to match against one or multiple block ids (e.g.:"minecraft:furnace"
or/^modid:.*_pulverizer$/
). -
event.registerComplexPeripheral(type, blockTester)
type: string
The peripheral type name of your choice
blockTester: function(BlockContainerJS block) {}
A function that will test the block (BlockContainerJS) against one ore more conditions to write inside. The provided function must returntrue
orfalse
to be valid.
Both of those Event functions return a Peripheral (see next section below).
method(name, methodFunction)
mainThreadMethod(name, methodFunction)
Both of these functions share the same parameters:
name: string
: the name of the method you want to declare on this peripheral
methodFunction: function(block, side, args, computer, context) {}
: the function code that will be executed when the peripheral method is called by a turtle/computer.
methodFunction
function parameter types:
-
block: BlockContainerJS
: the peripheral block, see KubeJS BlockContainerJS code.
-
side: Direction
: the side from which the peripheral is attached, see minecraftforge Direction java docs. In your JS code you can also useDirection
global variable provided by KubeJS (code)
-
args: array[]
: a javascript Array containing the arguments provided when calling the method
-
computer: IComputerAccess
: the computer instance from which the method was called, you shouldn't need to use it, but it's there if you need it. See IComputerAccess java code.
context: ILuaContext
: lua context instance in case you need it at some point (you won't). See ILuaContext java code.