Skip to content

Commit

Permalink
24w21a
Browse files Browse the repository at this point in the history
  • Loading branch information
misode committed May 28, 2024
1 parent dd82640 commit db1cfcb
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 31 deletions.
1 change: 1 addition & 0 deletions core/src/ValidationOption.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ export type ResourceType =
| 'int_provider_type'
| 'item'
| 'item_sub_predicate_type'
| 'jukebox_song'
| 'loot_condition_type'
| 'loot_function_type'
| 'loot_nbt_provider_type'
Expand Down
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.15",
"version": "0.0.16",
"description": "Schemas for Java Edition 1.21",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
10 changes: 5 additions & 5 deletions java/1.21/src/schemas/Components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,8 @@ export function initComponentsSchemas(schemas: SchemaRegistry, collections: Coll
], { context: 'adventure_mode_predicate' }))

schemas.register('attribute_modifiers_entry', ObjectNode({
id: StringNode(),
type: StringNode({ validator: 'resource', params: { pool: 'attribute' } }),
uuid: ListNode(
NumberNode({ integer: true }),
{ minLength: 4, maxLength: 4 },
),
name: StringNode(),
amount: NumberNode(),
operation: StringNode({ enum: 'attribute_modifier_operation' }),
slot: Opt(StringNode({ enum: 'equipment_slot_group' })),
Expand Down Expand Up @@ -321,6 +317,10 @@ export function initComponentsSchemas(schemas: SchemaRegistry, collections: Coll
}, { context: 'data_component.block_entity_data' }),
'minecraft:instrument': StringNode({ validator: 'resource', params: { pool: 'instrument' } }),
'minecraft:ominous_bottle_amplifier': NumberNode({ integer: true, min: 0, max: 4 }),
'minecraft:jukebox_playable': ObjectNode({
song: StringNode({ validator: 'resource', params: { pool: 'jukebox_song' } }),
show_in_tooltip: Opt(BooleanNode()),
}, { context: 'data_component.jukebox_playable' }),
'minecraft:recipes': ListNode(
StringNode({ validator: 'resource', params: { pool: '$recipe' } }),
{ context: 'data_component.recipes' },
Expand Down
3 changes: 1 addition & 2 deletions java/1.21/src/schemas/Enchantment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,10 @@ export function initEnchantmentSchemas(schemas: SchemaRegistry, collections: Col
}, { context: 'particle_velocity_source' })

const attributeEffectFields = {
name: StringNode(),
id: StringNode(),
attribute: StringNode({ validator: 'resource', params: { pool: 'attribute' } }),
amount: Reference('level_based_value'),
operation: StringNode({ enum: 'attribute_modifier_operation' }),
uuid: StringNode({ validator: 'uuid' }),
}

const SharedEffects = {
Expand Down
28 changes: 28 additions & 0 deletions java/1.21/src/schemas/JukeboxSong.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import {
Reference as RawReference,
Mod,
ObjectNode,
SchemaRegistry,
CollectionRegistry,
NumberNode
} from '@mcschema/core'

export function initJukeboxSongSchemas(schemas: SchemaRegistry, collections: CollectionRegistry) {
const Reference = RawReference.bind(undefined, schemas)

schemas.register('jukebox_song', Mod(ObjectNode({
sound_event: Reference('sound_event'),
description: Reference('text_component'),
length_in_seconds: NumberNode({ min: 1 }),
comparator_output: NumberNode({ integer: true, min: 0, max: 15 }),
}, { context: 'jukebox_song' }), {
default: () => ({
sound_event: 'minecraft:music_disc.cat',
description: {
translate: 'jukebox_song.minecraft.cat',
},
length_in_seconds: 185,
comparator_output: 2,
})
}))
}
4 changes: 1 addition & 3 deletions java/1.21/src/schemas/LootTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,18 +196,16 @@ export function initLootTableSchemas(schemas: SchemaRegistry, collections: Colle
}))

schemas.register('attribute_modifier', Mod(ObjectNode({
id: StringNode(),
attribute: StringNode({ validator: 'resource', params: { pool: 'attribute' } }),
name: StringNode(),
amount: Reference('number_provider'),
operation: StringNode({ enum: 'attribute_modifier_operation' }),
id: Opt(StringNode({ validator: 'uuid' })),
slot: StringOrList(
StringNode({ enum: 'equipment_slot_group' })
)
}, { context: 'attribute_modifier' }), {
default: () => ({
attribute: 'minecraft:generic.max_health',
name: '',
amount: 1,
operation: 'addition',
slot: 'mainhand'
Expand Down
2 changes: 1 addition & 1 deletion java/1.21/src/schemas/PackMcmeta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from '@mcschema/core'
import { InclusiveRange } from './Common'

const CURRENT_PACK_FORMAT = 44
const CURRENT_PACK_FORMAT = 45

export function initPackMcmetaSchemas(schemas: SchemaRegistry, collections: CollectionRegistry) {
const Reference = RawReference.bind(undefined, schemas)
Expand Down
22 changes: 7 additions & 15 deletions java/1.21/src/schemas/Predicates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,8 @@ export function initPredicatesSchemas(schemas: SchemaRegistry, collections: Coll
}

schemas.register('attribute_modifiers_entry_predicate', ObjectNode({
id: StringNode(),
attribute: Opt(Tag({ resource: 'attribute' })),
uuid: Opt(ChoiceNode([
{
type: 'list',
node: ListNode(
NumberNode({ integer: true }),
{ minLength: 4, maxLength: 4 },
),
},
{
type: 'string',
node: StringNode({ validator: 'uuid' }),
},
])),
name: Opt(StringNode()),
amount: Opt(Reference('float_bounds')),
operation: Opt(StringNode({ enum: 'attribute_modifier_operation' })),
slot: Opt(StringNode({ enum: 'equipment_slot_group' })),
Expand Down Expand Up @@ -102,6 +89,9 @@ export function initPredicatesSchemas(schemas: SchemaRegistry, collections: Coll
)),
flight_duration: Opt(Reference('int_bounds')),
}),
'minecraft:jukebox_playable': ObjectNode({
song: Opt(Tag({ resource: 'jukebox_song' })),
}),
'minecraft:potion_contents': Tag({ resource: 'potion' }),
'minecraft:stored_enchantments': ListNode(
Reference('enchantment_predicate')
Expand Down Expand Up @@ -286,7 +276,9 @@ export function initPredicatesSchemas(schemas: SchemaRegistry, collections: Coll
variant: Opt(StringNode({ enum: 'parrot_variant' }))
},
'minecraft:player': {
gamemode: Opt(StringNode({ enum: 'gamemode' })),
gamemode: Opt(ListNode(
StringNode({ enum: 'gamemode' })
)),
level: Opt(Reference('int_bounds')),
advancements: Opt(MapNode(
StringNode({ validator: 'resource', params: { pool: '$advancement' } }),
Expand Down
2 changes: 2 additions & 0 deletions java/1.21/src/schemas/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { initWorldSettingsSchemas } from './WorldSettings'
import { initComponentsSchemas } from './Components'
import { initPaintingVariantSchemas } from './PaintingVariant'
import { initEnchantmentSchemas } from './Enchantment'
import { initJukeboxSongSchemas } from './JukeboxSong'

export function initSchemas(schemas: SchemaRegistry, collections: CollectionRegistry) {
// `Common.ts` is the only file that has exports. It should be initialized first.
Expand All @@ -37,6 +38,7 @@ export function initSchemas(schemas: SchemaRegistry, collections: CollectionRegi
initDimensionSchemas(schemas, collections)
initEnchantmentSchemas(schemas, collections)
initItemModifierSchemas(schemas, collections)
initJukeboxSongSchemas(schemas, collections)
initLootTableSchemas(schemas, collections)
initPackMcmetaSchemas(schemas, collections)
initPaintingVariantSchemas(schemas, collections)
Expand Down
2 changes: 1 addition & 1 deletion locales/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mcschema/locales",
"version": "0.1.101",
"version": "0.1.102",
"description": "Locales for Minecraft schemas",
"keywords": [],
"author": "Misode",
Expand Down
8 changes: 7 additions & 1 deletion locales/src/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"attribute_modifier.operation.addition": "Addition",
"attribute_modifier.operation.multiply_base": "Multiply base",
"attribute_modifier.operation.multiply_total": "Multiply total",
"attribute_modifier.id": "UUID",
"attribute_modifier.id": "ID",
"attribute_modifier.uuid": "UUID",
"attribute_modifier.slot": "Slots",
"attribute_modifier.slot.list": "Multiple",
Expand Down Expand Up @@ -532,6 +532,8 @@
"data_component.food.effects.entry": "Effect",
"data_component.food.effects.entry.effect": "Effect",
"data_component.food.effects.entry.probability": "Probability",
"data_component.jukebox_playable.song": "Song",
"data_component.jukebox_playable.show_in_tooltip": "Show in tooltip",
"data_component.lodestone_tracker.target": "Target",
"data_component.lodestone_tracker.target.dimension": "Dimension",
"data_component.lodestone_tracker.target.pos": "Pos",
Expand Down Expand Up @@ -1636,6 +1638,10 @@
"item_transform.rotation": "Rotation",
"item_transform.translation": "Translation",
"item_transform.scale": "Scale",
"jukebox_song.sound_event": "Sound event",
"jukebox_song.description": "Description",
"jukebox_song.length_in_seconds": "Length in seconds",
"jukebox_song.comparator_output": "Comparator output",
"key.advancements": "Advancements",
"key.attack": "Attack/destroy",
"key.back": "Walk backwards",
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

0 comments on commit db1cfcb

Please sign in to comment.