From 289faaf0ec2063c42acc54f80f9b9298106b8e32 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Wed, 26 Jun 2024 21:50:58 +0200 Subject: overwrite all generating structures with "empty" files --- src/worldgen/structure/index.js | 71 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 src/worldgen/structure/index.js (limited to 'src/worldgen') diff --git a/src/worldgen/structure/index.js b/src/worldgen/structure/index.js new file mode 100644 index 0000000..8f19547 --- /dev/null +++ b/src/worldgen/structure/index.js @@ -0,0 +1,71 @@ +const { JigsawStartHeight } = require('../../enum.js'); + + +const jigsawConversionFields = { + type: 'minecraft:jigsaw', + start_pool: null, + size: 1, + start_height: { + absolute: { + value: 0, + }, + }, + max_distance_from_center: 1, + use_expansion_hack: false, +}; + +const jigsawStartHeightUniform = { + type: 'minecraft:uniform', + min_inclusive: { + above_bottom: 0, + }, + max_inclusive: { + below_top: 0, + }, +}; + +const jigsawStartHeightBiasedToBottom = { + type: 'minecraft:biased_to_bottom', + min_inclusive: { + above_bottom: 0, + }, + max_inclusive: { + below_top: 0, + }, +}; + +const jigsawStartHeightVeryBiasedToBottom = { + type: 'minecraft:very_biased_to_bottom', + min_inclusive: { + above_bottom: 0, + }, + max_inclusive: { + below_top: 0, + }, +}; + + +function jigsawConversion(structure, fields) { + fields = Object.assign({ + ...jigsawConversionFields, + }, fields); + + if (fields.start_height === JigsawStartHeight.UNIFORM) { + fields.start_height = jigsawStartHeightUniform; + } + else if (fields.start_height === JigsawStartHeight.BIASED_TO_BOTTOM) { + fields.start_height = jigsawStartHeightBiasedToBottom; + } + else if (fields.start_height === JigsawStartHeight.VERY_BIASED_TO_BOTTOM) { + fields.start_height = jigsawStartHeightVeryBiasedToBottom; + } + + return Object.assign({}, structure, fields); +} + + +module.exports = { + jigsawConversionFields, + jigsawStartHeightUniform, + jigsawConversion, +}; -- cgit v1.2.3