Test mod
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import type { WorldgenContext } from "bworld/worldgen";
|
||||
|
||||
// runs in chunk workers on the server and every client, which must all generate the same world.
|
||||
// only use chunk.rng and the noise helpers, never Math.random or the time
|
||||
export function setup(gen: WorldgenContext) {
|
||||
// a boulder on one chunk in ten
|
||||
gen.register_feature("example_mod:boulders", (chunk) => {
|
||||
if (chunk.rng.next() > 0.1) {
|
||||
return;
|
||||
}
|
||||
const x = chunk.x * 16 + Math.floor(chunk.rng.next() * 16);
|
||||
const z = chunk.z * 16 + Math.floor(chunk.rng.next() * 16);
|
||||
chunk.set_block(x, chunk.height_at(x, z) + 1, z, "bworld:stone");
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user