Skip to content
Draylar edited this page Apr 14, 2021 · 1 revision

Modifying ore generation with KubeJS

Miner's Horizon provides KubeJS compatibility through startup script events (kubejs/.startup_scripts/xyz.js).


Config Event - horizon.config

This event is called every time an ore entry is loaded from the minershorizon.json config file. Handlers can call event.cancel() to prevent the ore from loading.

Exclude Diamond Ore from loading from the config file:

onEvent('horizon.config', event => {
    if(event.ore.block.includes("diamond")) {
        event.cancel()
    }
});

Block ores based on namespace:

onEvent('horizon.config', event => {
    if(event.ore.block.startsWith("techreborn")) {
        event.cancel()
    }
});

Prevent ALL ore from loading from the config file:

onEvent('horizon.config', event => {
    event.cancel()
});

Ores Event - horizon.ores

Miner's Horizon also exposes the horizon.ores event, which allows handlers to attach their own ore entries to the dimension generation.

Introduce a Diamond Block entry, which spawns from y200-250, up to 25 times with a vein size of 10:

onEvent('horizon.ores', event => {
    event.ore("minecraft:diamond_block").size(10).count(25).minY(200).maxY(250)
});
Clone this wiki locally