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

@@ -317,7 +317,7 @@ export function SchemaGenerator({ gen, allowedVersions }: Props) {
<main class={`generator${previewShown ? ' has-preview' : ''}${projectShown ? ' has-project' : ''}`}>
{!gen.tags?.includes('partners') && <Ad id="data-pack-generator" type="text" />}
<div class="controls generator-controls">
{gen.wiki && <a class="btn btn-link tooltipped tip-se" aria-label={locale('learn_on_the_wiki')} href={`https://minecraft.wiki/w/${gen.wiki}`} target="_blank">
{gen.wiki && <a class="btn btn-link tooltipped tip-se" aria-label={locale('learn_on_the_wiki')} href={gen.wiki} target="_blank">
{Octicon.mortar_board}
<span>{locale('wiki')}</span>
</a>}

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"
}

View File

@@ -15,7 +15,7 @@ import type { BlockStateRegistry, VersionId } from '../services/index.js'
import { CachedDecorator, CachedFeature } from '../services/index.js'
import { ModelWrapper } from './ModelWrapper.js'
const selectRegistries = ['loot_table.type', 'loot_entry.type', 'function.function', 'condition.condition', 'criterion.trigger', 'recipe.type', 'dimension.generator.type', 'dimension.generator.biome_source.type', 'dimension.generator.biome_source.preset', 'carver.type', 'feature.type', 'decorator.type', 'feature.tree.minimum_size.type', 'block_state_provider.type', 'trunk_placer.type', 'foliage_placer.type', 'tree_decorator.type', 'int_provider.type', 'float_provider.type', 'height_provider.type', 'structure_feature.type', 'surface_builder.type', 'processor.processor_type', 'rule_test.predicate_type', 'pos_rule_test.predicate_type', 'template_element.element_type', 'block_placer.type', 'block_predicate.type', 'material_rule.type', 'material_condition.type', 'structure_placement.type', 'density_function.type', 'root_placer.type', 'entity.type_specific.cat.variant', 'entity.type_specific.frog.variant', 'rule_block_entity_modifier.type', 'pool_alias_binding.type', 'lithostitched.worldgen_modifier.type', 'lithostitched.modifier_predicate.type']
const selectRegistries = ['loot_table.type', 'loot_entry.type', 'function.function', 'condition.condition', 'criterion.trigger', 'recipe.type', 'dimension.generator.type', 'dimension.generator.biome_source.type', 'dimension.generator.biome_source.preset', 'carver.type', 'feature.type', 'decorator.type', 'feature.tree.minimum_size.type', 'block_state_provider.type', 'trunk_placer.type', 'foliage_placer.type', 'tree_decorator.type', 'int_provider.type', 'float_provider.type', 'height_provider.type', 'structure_feature.type', 'surface_builder.type', 'processor.processor_type', 'rule_test.predicate_type', 'pos_rule_test.predicate_type', 'template_element.element_type', 'block_placer.type', 'block_predicate.type', 'material_rule.type', 'material_condition.type', 'structure_placement.type', 'density_function.type', 'root_placer.type', 'entity.type_specific.cat.variant', 'entity.type_specific.frog.variant', 'rule_block_entity_modifier.type', 'pool_alias_binding.type', 'lithostitched.worldgen_modifier.type', 'lithostitched.modifier_predicate.type', 'ohthetreesyoullgrow.configured_feature.type']
const hiddenFields = ['number_provider.type', 'score_provider.type', 'nbt_provider.type', 'int_provider.type', 'float_provider.type', 'height_provider.type']
const flattenedFields = ['feature.config', 'decorator.config', 'int_provider.value', 'float_provider.value', 'block_state_provider.simple_state_provider.state', 'block_state_provider.rotated_block_provider.state', 'block_state_provider.weighted_state_provider.entries.entry.data', 'rule_test.block_state', 'structure_feature.config', 'surface_builder.config', 'template_pool.elements.entry.element', 'decorator.block_survives_filter.state', 'material_rule.block.result_state']
const inlineFields = ['loot_entry.type', 'function.function', 'condition.condition', 'criterion.trigger', 'dimension.generator.type', 'dimension.generator.biome_source.type', 'feature.type', 'decorator.type', 'block_state_provider.type', 'feature.tree.minimum_size.type', 'trunk_placer.type', 'foliage_placer.type', 'tree_decorator.type', 'block_placer.type', 'rule_test.predicate_type', 'processor.processor_type', 'template_element.element_type', 'nbt_operation.op', 'number_provider.value', 'score_provider.name', 'score_provider.target', 'nbt_provider.source', 'nbt_provider.target', 'generator_biome.biome', 'block_predicate.type', 'material_rule.type', 'material_condition.type', 'density_function.type', 'root_placer.type', 'entity.type_specific.type', 'glyph_provider.type', 'sprite_source.type', 'rule_block_entity_modifier.type', 'immersive_weathering.area_condition.type', 'immersive_weathering.block_growth.growth_for_face.entry.direction', 'immersive_weathering.position_test.predicate_type', 'pool_alias_binding.type']