Skip to content

Commit

Permalink
Dimension padding can also be a single value
Browse files Browse the repository at this point in the history
  • Loading branch information
misode committed May 15, 2024
1 parent 7536745 commit 0b356fe
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion java/1.21/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mcschema/java-1.21",
"version": "0.0.13",
"version": "0.0.14",
"description": "Schemas for Java Edition 1.21",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
20 changes: 16 additions & 4 deletions java/1.21/src/schemas/worldgen/Structure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
Opt,
MapNode,
ListNode,
ChoiceNode,
} from '@mcschema/core'
import { Tag } from '../Common'
import { MobCategorySpawnSettings } from './Biome'
Expand Down Expand Up @@ -84,10 +85,21 @@ export function initStructureSchemas(schemas: SchemaRegistry, collections: Colle
})
}))

schemas.register('dimension_padding', ObjectNode({
bottom: Opt(NumberNode({ integer: true, min: 0 })),
top: Opt(NumberNode({ integer: true, min: 0 })),
}, { context: 'dimension_padding' }))
schemas.register('dimension_padding', ChoiceNode([
{
type: 'number',
node: NumberNode({ integer: true, min: 0 }),
change: (v) => typeof v === 'object' ? (v?.bottom ?? v?.top ?? 0) : 0,
},
{
type: 'object',
node: ObjectNode({
bottom: Opt(NumberNode({ integer: true, min: 0 })),
top: Opt(NumberNode({ integer: true, min: 0 })),
}),
change: (v) => typeof v === 'number' ? ({ bottom: v, top: v }) : ({}),
}
], { context: 'dimension_padding' }))

schemas.register('pool_alias_binding', Mod(ObjectNode({
type: StringNode({ validator: 'resource', params: { pool: 'worldgen/pool_alias_binding' } }),
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0b356fe

Please sign in to comment.