mirror of
https://github.com/misode/misode.github.io.git
synced 2026-05-01 01:59:33 +00:00
Add Lithostitched partner (#436)
* Add Lithostitched partner * Remove modded biome slice stuff * Run formatter --------- Co-authored-by: Misode <misoloo64@gmail.com>
This commit is contained in:
229
src/app/partners/Lithostitched.ts
Normal file
229
src/app/partners/Lithostitched.ts
Normal file
@@ -0,0 +1,229 @@
|
||||
import type { CollectionRegistry, ResourceType, SchemaRegistry } from '@mcschema/core'
|
||||
import { BooleanNode, Case, ChoiceNode, ListNode, Mod, NumberNode, ObjectNode, Opt, Reference as RawReference, StringNode as RawStringNode, Switch } from '@mcschema/core'
|
||||
|
||||
|
||||
const ID = 'lithostitched'
|
||||
|
||||
export function initLithostitched(schemas: SchemaRegistry, collections: CollectionRegistry) {
|
||||
const Reference = RawReference.bind(undefined, schemas)
|
||||
const StringNode = RawStringNode.bind(undefined, collections)
|
||||
|
||||
const Tag = (id: Exclude<ResourceType, `$tag/${string}`>) =>
|
||||
ChoiceNode(
|
||||
[
|
||||
{
|
||||
type: 'string',
|
||||
node: StringNode({
|
||||
validator: 'resource',
|
||||
params: { pool: id, allowTag: true },
|
||||
}),
|
||||
change: (v: unknown) => {
|
||||
if (
|
||||
Array.isArray(v) &&
|
||||
typeof v[0] === 'string' &&
|
||||
!v[0].startsWith('#')
|
||||
) {
|
||||
return v[0]
|
||||
}
|
||||
return undefined
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'list',
|
||||
node: ListNode(
|
||||
StringNode({ validator: 'resource', params: { pool: id } })
|
||||
),
|
||||
change: (v: unknown) => {
|
||||
if (typeof v === 'string' && !v.startsWith('#')) {
|
||||
return [v]
|
||||
}
|
||||
return []
|
||||
},
|
||||
},
|
||||
],
|
||||
{ choiceContext: 'tag' }
|
||||
)
|
||||
|
||||
// Worldgen Modifiers
|
||||
const MobCategorySpawnSettings = Mod(
|
||||
ObjectNode({
|
||||
type: StringNode({
|
||||
validator: 'resource',
|
||||
params: { pool: 'entity_type' },
|
||||
}),
|
||||
weight: NumberNode({ integer: true }),
|
||||
minCount: NumberNode({ integer: true }),
|
||||
maxCount: NumberNode({ integer: true }),
|
||||
}),
|
||||
{
|
||||
category: () => 'pool',
|
||||
default: () => [
|
||||
{
|
||||
type: 'minecraft:bat',
|
||||
weight: 1,
|
||||
},
|
||||
],
|
||||
}
|
||||
)
|
||||
|
||||
collections.register(`${ID}:modifier_type`, [
|
||||
'lithostitched:add_biome_spawns',
|
||||
'lithostitched:add_features',
|
||||
'lithostitched:add_structure_set_entries',
|
||||
'lithostitched:add_surface_rule',
|
||||
'lithostitched:add_template_pool_elements',
|
||||
'lithostitched:no_op',
|
||||
'lithostitched:redirect_feature',
|
||||
'lithostitched:remove_biome_spawns',
|
||||
'lithostitched:remove_features',
|
||||
'lithostitched:remove_structures_from_structure_set',
|
||||
'lithostitched:replace_climate',
|
||||
'lithostitched:replace_effects',
|
||||
])
|
||||
|
||||
collections.register(`${ID}:modifier_predicate_type`, [
|
||||
'lithostitched:all_of',
|
||||
'lithostitched:any_of',
|
||||
'lithostitched:mod_loaded',
|
||||
'lithostitched:not',
|
||||
'lithostitched:true',
|
||||
])
|
||||
|
||||
schemas.register(`${ID}:worldgen_modifier`, Mod(ObjectNode({
|
||||
type: StringNode({ validator: 'resource', params: { pool: `${ID}:modifier_type` as any } }),
|
||||
predicate: Opt(Reference(`${ID}:modifier_predicate`)),
|
||||
[Switch]: [{ push: 'type' }],
|
||||
[Case]: {
|
||||
'lithostitched:add_biome_spawns': {
|
||||
biomes: Tag('$worldgen/biome'),
|
||||
spawners: ChoiceNode([
|
||||
{
|
||||
type: 'object',
|
||||
node: MobCategorySpawnSettings,
|
||||
change: (v: any) => v[0],
|
||||
},
|
||||
{
|
||||
type: 'list',
|
||||
node: ListNode(MobCategorySpawnSettings),
|
||||
change: (v: any) => Array(v),
|
||||
},
|
||||
]),
|
||||
},
|
||||
'lithostitched:add_features': {
|
||||
biomes: Tag('$worldgen/biome'),
|
||||
features: Tag('$worldgen/configured_feature'),
|
||||
step: StringNode({ enum: 'decoration_step' }),
|
||||
},
|
||||
'lithostitched:add_structure_set_entries': {
|
||||
structure_set: StringNode({ validator: 'resource', params: { pool: '$worldgen/structure_set' } }),
|
||||
entries: ListNode(
|
||||
ObjectNode({
|
||||
structure: StringNode({ validator: 'resource', params: { pool: '$worldgen/structure' } }),
|
||||
weight: NumberNode({ integer: true, min: 1 }),
|
||||
})
|
||||
),
|
||||
},
|
||||
'lithostitched:add_surface_rule': {
|
||||
levels: ListNode(StringNode({ validator: 'resource', params: { pool: '$dimension' } })),
|
||||
surface_rule: Reference('material_rule'),
|
||||
},
|
||||
'lithostitched:add_template_pool_elements': {
|
||||
template_pool: StringNode({ validator: 'resource', params: { pool: '$worldgen/template_pool' } }),
|
||||
elements: ListNode(
|
||||
Reference('template_weighted_element')
|
||||
),
|
||||
},
|
||||
'lithostitched:redirect_feature': {
|
||||
placed_feature: StringNode({ validator: 'resource', params: { pool: '$worldgen/placed_feature' } }),
|
||||
redirect_to: StringNode({ validator: 'resource', params: { pool: '$worldgen/configured_feature' } }),
|
||||
},
|
||||
'lithostitched:remove_biome_spawns': {
|
||||
biomes: Tag('$worldgen/biome'),
|
||||
mobs: Tag('entity_type'),
|
||||
},
|
||||
'lithostitched:remove_features': {
|
||||
biomes: Tag('$worldgen/biome'),
|
||||
features: Tag('$worldgen/configured_feature'),
|
||||
step: StringNode({ enum: 'decoration_step' }),
|
||||
},
|
||||
'lithostitched:remove_structures_from_structure_set': {
|
||||
structure_set: StringNode({ validator: 'resource', params: { pool: '$worldgen/structure_set' } }),
|
||||
structures: ListNode(
|
||||
StringNode({ validator: 'resource', params: { pool: '$worldgen/structure' } })
|
||||
),
|
||||
},
|
||||
'lithostitched:replace_climate': {
|
||||
biomes: Tag('$worldgen/biome'),
|
||||
climate: ObjectNode({
|
||||
temperature: NumberNode(),
|
||||
downfall: NumberNode(),
|
||||
has_precipitation: BooleanNode(),
|
||||
temperature_modifier: Opt(StringNode({ enum: ['none', 'frozen'] })),
|
||||
}),
|
||||
},
|
||||
'lithostitched:replace_effects': {
|
||||
biomes: Tag('$worldgen/biome'),
|
||||
effects: ObjectNode({
|
||||
sky_color: Opt(NumberNode({ color: true })),
|
||||
fog_color: Opt(NumberNode({ color: true })),
|
||||
water_color: Opt(NumberNode({ color: true })),
|
||||
water_fog_color: Opt(NumberNode({ color: true })),
|
||||
grass_color: Opt(NumberNode({ color: true })),
|
||||
foliage_color: Opt(NumberNode({ color: true })),
|
||||
grass_color_modifier: Opt(StringNode({ enum: ['none', 'dark_forest', 'swamp'] })),
|
||||
ambient_sound: Opt(StringNode()),
|
||||
mood_sound: Opt(ObjectNode({
|
||||
sound: StringNode(),
|
||||
tick_delay: NumberNode({ integer: true }),
|
||||
block_search_extent: NumberNode({ integer: true }),
|
||||
offset: NumberNode(),
|
||||
})),
|
||||
additions_sound: Opt(ObjectNode({
|
||||
sound: StringNode(),
|
||||
tick_chance: NumberNode({ min: 0, max: 1 }),
|
||||
})),
|
||||
music: Opt(ObjectNode({
|
||||
sound: StringNode(),
|
||||
min_delay: NumberNode({ integer: true, min: 0 }),
|
||||
max_delay: NumberNode({ integer: true, min: 0 }),
|
||||
replace_current_music: BooleanNode(),
|
||||
})),
|
||||
particle: Opt(ObjectNode({
|
||||
options: ObjectNode({
|
||||
type: StringNode(),
|
||||
}),
|
||||
probability: NumberNode({ min: 0, max: 1 }),
|
||||
})),
|
||||
}),
|
||||
},
|
||||
},
|
||||
}, { context: `${ID}.worldgen_modifier`, disableSwitchContext: true }), {
|
||||
default: () => ({
|
||||
type: `${ID}:add_features`,
|
||||
biomes: '#minecraft:is_overworld',
|
||||
features: 'example:ore_ruby',
|
||||
step: 'underground_ores',
|
||||
}),
|
||||
}))
|
||||
|
||||
schemas.register(`${ID}:modifier_predicate`, ObjectNode({
|
||||
type: StringNode({ validator: 'resource', params: { pool: `${ID}:modifier_predicate_type` as any } }),
|
||||
[Switch]: [{ push: 'type' }],
|
||||
[Case]: {
|
||||
'lithostitched:all_of': {
|
||||
predicates: ListNode(Reference(`${ID}:modifier_predicate`)),
|
||||
},
|
||||
'lithostitched:any_of': {
|
||||
predicates: ListNode(Reference(`${ID}:modifier_predicate`)),
|
||||
},
|
||||
'lithostitched:mod_loaded': {
|
||||
mod_id: StringNode(),
|
||||
},
|
||||
'lithostitched:not': {
|
||||
predicate: Reference(`${ID}:modifier_predicate`),
|
||||
},
|
||||
},
|
||||
}, {
|
||||
context: `${ID}.modifier_predicate`, disableSwitchContext: true,
|
||||
}))
|
||||
}
|
||||
@@ -1,10 +1,13 @@
|
||||
import type { CollectionRegistry, SchemaRegistry } from '@mcschema/core'
|
||||
import { initImmersiveWeathering } from './ImmersiveWeathering.js'
|
||||
import { initLithostitched } from './Lithostitched.js'
|
||||
import { initObsidian } from './Obsidian.js'
|
||||
|
||||
export * from './ImmersiveWeathering.js'
|
||||
export * from './Lithostitched.js'
|
||||
|
||||
export function initPartners(schemas: SchemaRegistry, collections: CollectionRegistry) {
|
||||
initImmersiveWeathering(schemas, collections)
|
||||
initLithostitched(schemas, collections)
|
||||
initObsidian(schemas, collections)
|
||||
}
|
||||
|
||||
@@ -55,8 +55,24 @@
|
||||
"immersive_weathering:rule_test.immersive_weathering:block_set_match": "Block set match",
|
||||
"immersive_weathering:rule_test.immersive_weathering:fluid_match": "Fluid match",
|
||||
"immersive_weathering:rule_test.immersive_weathering:tree_log": "Tree log",
|
||||
"rule_test.blocks": "Blocks",
|
||||
"rule_test.fluid": "Fluid",
|
||||
|
||||
"lithostitched:modifier_type.lithostitched:add_biome_spawns": "Add biome spawns",
|
||||
"lithostitched:modifier_type.lithostitched:add_features": "Add features",
|
||||
"lithostitched:modifier_type.lithostitched:add_structure_set_entries": "Add structure set entries",
|
||||
"lithostitched:modifier_type.lithostitched:add_surface_rule": "Add surface rule",
|
||||
"lithostitched:modifier_type.lithostitched:add_template_pool_elements": "Add template pool elements",
|
||||
"lithostitched:modifier_type.lithostitched:no_op": "Nothing",
|
||||
"lithostitched:modifier_type.lithostitched:redirect_feature": "Redirect feature",
|
||||
"lithostitched:modifier_type.lithostitched:remove_biome_spawns": "Remove biome spawns",
|
||||
"lithostitched:modifier_type.lithostitched:remove_features": "Remove features",
|
||||
"lithostitched:modifier_type.lithostitched:remove_structures_from_structure_set": "Remove structures from set",
|
||||
"lithostitched:modifier_type.lithostitched:replace_climate": "Replace climate",
|
||||
"lithostitched:modifier_type.lithostitched:replace_effects": "Replace effects",
|
||||
"lithostitched:modifier_predicate_type.lithostitched:all_of": "All of",
|
||||
"lithostitched:modifier_predicate_type.lithostitched:any_of": "Any of",
|
||||
"lithostitched:modifier_predicate_type.lithostitched:mod_loaded": "Mod loaded",
|
||||
"lithostitched:modifier_predicate_type.lithostitched:not": "Not",
|
||||
"lithostitched:modifier_predicate_type.lithostitched:true": "True",
|
||||
|
||||
"obsidian:item.information": "Item Information",
|
||||
"obsidian:item_information.rarity": "Rarity",
|
||||
@@ -115,5 +131,8 @@
|
||||
"obsidian:block.display.model": "Model",
|
||||
"obsidian:block.display.item_model": "Item Model",
|
||||
"obsidian:block.display.block_model": "Block Model",
|
||||
"obsidian:block.display.lore": "Lore"
|
||||
"obsidian:block.display.lore": "Lore",
|
||||
|
||||
"rule_test.blocks": "Blocks",
|
||||
"rule_test.fluid": "Fluid"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user