Skip to content

Commit

Permalink
Fix item damage component and event object schema (#316)
Browse files Browse the repository at this point in the history
* Fix item damage component
* Remove duplicate event schema and unnecessary pattern match
  • Loading branch information
ink0rr authored Oct 8, 2024
1 parent 8473646 commit fa09417
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 31 deletions.
2 changes: 1 addition & 1 deletion source/behavior/entities/format/components/breedable.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"title": "Baby Type"
},
"breed_event": {
"$ref": "../types/event_object_filters.json",
"$ref": "../types/event_object.json",
"description": "Event to run when this entity breeds.",
"title": "Breed Event"
},
Expand Down
4 changes: 2 additions & 2 deletions source/behavior/entities/format/types/event.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
}
],
"oneOf": [
{ "type": "string", "pattern": "^[a-zA-Z0-9_\\-:]+$", "description": "The event to fire." },
{ "type": "string", "description": "The event to fire." },
{
"type": "object",
"properties": {
"event": { "type": "string", "pattern": "^[a-zA-Z0-9_\\-:]+$", "description": "The event to fire.", "title": "Event" },
"event": { "type": "string", "description": "The event to fire.", "title": "Event" },
"target": {
"type": "string",
"description": "The target of the event.",
Expand Down
2 changes: 1 addition & 1 deletion source/behavior/entities/format/types/event_object.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"filters": {
"$ref": "../../filters/filters.json"
},
"event": { "type": "string", "pattern": "^[a-zA-Z0-9_\\-:]+$", "description": "The event to fire.", "title": "Event" },
"event": { "type": "string", "description": "The event to fire.", "title": "Event" },
"target": {
"type": "string",
"description": "The target of the event.",
Expand Down
20 changes: 0 additions & 20 deletions source/behavior/entities/format/types/event_object_filters.json

This file was deleted.

27 changes: 20 additions & 7 deletions source/behavior/items/format/components/damage.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
{
"$id": "blockception.minecraft.behavior.items.minecraft:damage",
"additionalProperties": false,
"type": "object",
"title": "Damage",
"description": "The damage component determines how much extra damage the item does on attack.",
"required": ["value"],
"properties": { "value": { "type": "number", "title": "Value", "description": "How much extra damage the item does, must be a positive number.", "minimum": 1 } },
"examples": [
{ "value": 7 }
]
"oneOf": [
{
"type": "number",
"minimum": 1
},
{
"type": "object",
"additionalProperties": false,
"required": ["value"],
"properties": {
"value": {
"type": "number",
"title": "Value",
"description": "How much extra damage the item does, must be a positive number.",
"minimum": 1
}
}
}
],
"examples": [{ "value": 7 }]
}

0 comments on commit fa09417

Please sign in to comment.