Skip to content

Custom Fan Type Registration

vomiter edited this page Aug 19, 2026 · 1 revision

Startup Script

var $LivingEntity = Java.loadClass("net.minecraft.world.entity.LivingEntity");

global.fooName = "foo";

KJSCAutoEvents.customFanRegistry(event => {
    event.register(global.fooName)
            .isValidAt((level, pos) => {return level.getBlock(pos).getId() == "minecraft:acacia_button"})
            .affectEntity((entity, level) => {
                if(entity instanceof $LivingEntity){
                    entity.heal(5);
                }
            })
            .morphAirFlow(FanUtils.morphAirFlow(0x00FF00, 0x0000FF, 0.5, "minecraft:angry_villager", 0.01))
            .spawnProcessingParticles(FanUtils.spawnProcessingParticles(FanUtils.dustParticle(0x00DD00, 1)))
            .build()
})  

KJSCAutoEvents.customFanJei(event => {
    event.assign(global.fooName)
    .setCatalystBlock("acacia_button")
    .setSecondaryIcon("acacia_planks")
    .setTitle(Component.ofString("FOO FAN"))
    .save()
})

Server Script

ServerEvents.recipes(event => {
    let customRecipe = FanUtils.buildRecipe()
    .setType(global.fooName)
    .addResult(Item.of("acacia_boat", 2), 1)
    .setIngredient("stick")
    event.custom(customRecipe.build());    
})

Clone this wiki locally