Add Oh The Trees You'll Grow partner generator

This commit is contained in:
Misode
2024-01-18 07:53:05 +01:00
parent f855c7d938
commit f3b852025d
7 changed files with 201 additions and 50 deletions

View File

@@ -0,0 +1,114 @@
import type { CollectionRegistry, SchemaRegistry } from '@mcschema/core'
import { Case, ListNode, Mod, NumberNode, ObjectNode, Opt, Reference as RawReference, StringNode as RawStringNode, Switch } from '@mcschema/core'
export function initOhTheTreesYoullGrow(schemas: SchemaRegistry, collections: CollectionRegistry) {
const Reference = RawReference.bind(undefined, schemas)
const StringNode = RawStringNode.bind(undefined, collections)
collections.register('ohthetreesyoullgrow:feature', [
'ohthetreesyoullgrow:tree_from_nbt_v1',
])
const BlockSet = ListNode(
StringNode({ validator: 'resource', params: { pool: 'block' } })
)
schemas.register('ohthetreesyoullgrow:configured_feature', Mod(ObjectNode({
type: StringNode({ validator: 'resource', params: { pool: 'ohthetreesyoullgrow:feature' as any } }),
config: ObjectNode({
[Switch]: ['pop', { push: 'type' }],
[Case]: {
'ohthetreesyoullgrow:tree_from_nbt_v1': {
base_location: StringNode({ validator: 'resource', params: { pool: '$structure' } }),
canopy_location: StringNode({ validator: 'resource', params: { pool: '$structure' } }),
can_grow_on_filter: Reference('block_predicate_worldgen'),
can_leaves_place_filter: Reference('block_predicate_worldgen'),
decorators: Opt(ListNode(
ObjectNode({
type: StringNode({ validator: 'resource', params: { pool: 'worldgen/tree_decorator_type' } }),
[Switch]: [{ push: 'type' }],
[Case]: {
'minecraft:alter_ground': {
provider: Reference('block_state_provider'),
},
'minecraft:attached_to_leaves': {
probability: NumberNode({ min: 0, max: 1 }),
exclusion_radius_xz: NumberNode({ integer: true, min: 0, max: 16 }),
exclusion_radius_y: NumberNode({ integer: true, min: 0, max: 16 }),
required_empty_blocks: NumberNode({ integer: true, min: 1, max: 16 }),
block_provider: Reference('block_state_provider'),
directions: ListNode(
StringNode({ enum: 'direction' })
),
},
'minecraft:beehive': {
probability: NumberNode({ min: 0, max: 1 }),
},
'minecraft:cocoa': {
probability: NumberNode({ min: 0, max: 1 }),
},
'minecraft:leave_vine': {
probability: NumberNode({ min: 0, max: 1 }),
},
},
}, { context: 'tree_decorator' })
)),
height: Reference('int_provider'),
leaves_provider: Reference('block_state_provider'),
leaves_target: BlockSet,
log_provider: Reference('block_state_provider'),
log_target: BlockSet,
max_log_depth: Opt(NumberNode({ integer: true })),
place_from_nbt: BlockSet,
},
},
}, { disableSwitchContext: true }),
}, { context: 'ohthetreesyoullgrow.configured_feature' }), {
default: () => ({
type: 'ohthetreesyoullgrow:tree_from_nbt_v1',
config: {
can_grow_on_filter: {
type: 'minecraft:matching_block_tag',
tag: 'minecraft:dirt',
},
can_leaves_place_filter: {
type: 'minecraft:replaceable',
},
height: {
type: 'minecraft:uniform',
value: {
min_inclusive: 5,
max_inclusive: 10,
},
},
leaves_provider: {
type: 'minecraft:simple_state_provider',
state: {
Name: 'minecraft:acacia_leaves',
Properties: {
distance: '7',
persistent: 'false',
waterlogged: 'false',
},
},
},
leaves_target: [
'minecraft:oak_leaves',
],
log_provider: {
type: 'minecraft:simple_state_provider',
state: {
Name: 'minecraft:acacia_log',
Properties: {
axis: 'y',
},
},
},
log_target: [
'minecraft:oak_log',
],
place_from_nbt: [],
},
}),
}))
}

View File

@@ -2,6 +2,7 @@ import type { CollectionRegistry, SchemaRegistry } from '@mcschema/core'
import { initImmersiveWeathering } from './ImmersiveWeathering.js'
import { initLithostitched } from './Lithostitched.js'
import { initObsidian } from './Obsidian.js'
import { initOhTheTreesYoullGrow } from './OhTheTreesYoullGrow.js'
export * from './ImmersiveWeathering.js'
export * from './Lithostitched.js'
@@ -10,4 +11,5 @@ export function initPartners(schemas: SchemaRegistry, collections: CollectionReg
initImmersiveWeathering(schemas, collections)
initLithostitched(schemas, collections)
initObsidian(schemas, collections)
initOhTheTreesYoullGrow(schemas, collections)
}

View File

@@ -133,6 +133,29 @@
"obsidian:block.display.block_model": "Block Model",
"obsidian:block.display.lore": "Lore",
"rule_test.blocks": "Blocks",
"rule_test.fluid": "Fluid"
"ohthetreesyoullgrow:feature.ohthetreesyoullgrow:tree_from_nbt_v1": "Tree from NBT v1",
"ohthetreesyoullgrow.configured_feature.type": "Type",
"ohthetreesyoullgrow.configured_feature.config": "Config",
"ohthetreesyoullgrow.configured_feature.config.base_location": "Base location",
"ohthetreesyoullgrow.configured_feature.config.base_location.help": "The path to the trunk structure piece.",
"ohthetreesyoullgrow.configured_feature.config.canopy_location": "Canopy location",
"ohthetreesyoullgrow.configured_feature.config.canopy_location.help": "The path to the canopy structure piece.",
"ohthetreesyoullgrow.configured_feature.config.can_grow_on_filter": "Can grow on filter",
"ohthetreesyoullgrow.configured_feature.config.can_grow_on_filter.help": "Block filter for which this tree is allowed to grow on. Checks all of the red wool positions defined by the trunk.",
"ohthetreesyoullgrow.configured_feature.config.can_leaves_place_filter": "Can leaves place filter",
"ohthetreesyoullgrow.configured_feature.config.can_leaves_place_filter.help": "Block filter for which this tree's leaves are allowed to place.",
"ohthetreesyoullgrow.configured_feature.config.decorators": "Decorators",
"ohthetreesyoullgrow.configured_feature.config.decorators.entry": "Decorator",
"ohthetreesyoullgrow.configured_feature.config.height": "Height",
"ohthetreesyoullgrow.configured_feature.config.height.help": "Int provider defining the height of the tree.",
"ohthetreesyoullgrow.configured_feature.config.leaves_provider": "Leaves provider",
"ohthetreesyoullgrow.configured_feature.config.leaves_target": "Leaves target",
"ohthetreesyoullgrow.configured_feature.config.leaves_target.entry": "Block",
"ohthetreesyoullgrow.configured_feature.config.log_provider": "Log provider",
"ohthetreesyoullgrow.configured_feature.config.log_target": "Log target",
"ohthetreesyoullgrow.configured_feature.config.log_target.entry": "Block",
"ohthetreesyoullgrow.configured_feature.config.max_log_depth": "Max log depth",
"ohthetreesyoullgrow.configured_feature.config.place_from_nbt": "Place from NBT",
"ohthetreesyoullgrow.configured_feature.config.place_from_nbt.help": "Additional blocks from the structure pieces that should be placed in the world.",
"ohthetreesyoullgrow.configured_feature.config.place_from_nbt.entry": "Block"
}