Loader Preprocessor

Link to loader-preprocessor

The loader preprocessor is really simple, it affects where and when the script is loaded. As of writing this script, there are two loaders: crafttweaker and contenttweaker.

crafttweaker is the default loader, where most things take place. Scripts here will get executed whenever resources get reloaded, on world join, or when running the /reload command.

The contenttweaker loader loads its scripts a bit early, before regular registration, so that Objects that need to be registered while the game is starting are registered and present. This means that this loader doesn't allow you to /reload and requires you to restart the game to apply changes.

Loaders are independent. You will not be able to add recipes in a contenttweaker loader or create an item in a crafttweaker loader.

Simply append #loader name to the top of the script.

ZenScript
Copy
#loader contenttweaker

import contenttweaker.builder.vanilla.block.Basic;
import contenttweaker.object.vanilla.property.StandardBlockProperties;

val veryBasicBlock = <factory:block>.typed<Basic>()
    .material(<material:minecraft:metal>)
    .lightLevel(14) 
    .tab(<tab:examplesTab>)
    .build("very_basic_block");