Created & applied new event_object type (#109)

Created new event type.
some components only allow for an event to be an object, not a string
Co-authored-by: Daan Verstraten <daanverstraten@hotmail.com>
This commit is contained in:
ChibiMango
2022-08-22 19:13:13 +01:00
committed by GitHub
parent 3f980980ee
commit 534d77c389
20 changed files with 47 additions and 30 deletions

View File

@@ -58,7 +58,7 @@
"title": "Feed Items" "title": "Feed Items"
}, },
"grow_up": { "grow_up": {
"$ref": "../types/event.json", "$ref": "../types/event_object.json",
"description": "Event to run when this entity grows up.", "description": "Event to run when this entity grows up.",
"title": "Grow Up" "title": "Grow Up"
}, },

View File

@@ -40,7 +40,7 @@
}, },
"calm_event": { "calm_event": {
"title": "Calm Event", "title": "Calm Event",
"$ref": "../types/event.json", "$ref": "../types/event_object.json",
"description": "Event to run after the number of seconds specified in duration expires (when the entity stops being \"angry\")" "description": "Event to run after the number of seconds specified in duration expires (when the entity stops being \"angry\")"
}, },
"angry_sound": { "angry_sound": {

View File

@@ -16,7 +16,7 @@
"title": "Baby Type" "title": "Baby Type"
}, },
"breed_event": { "breed_event": {
"$ref": "../types/event.json", "$ref": "../types/event_object.json",
"description": "Event to run when this entity breeds.", "description": "Event to run when this entity breeds.",
"title": "Breed Event" "title": "Breed Event"
}, },

View File

@@ -6,17 +6,17 @@
"additionalProperties": false, "additionalProperties": false,
"properties": { "properties": {
"dried_out_event": { "dried_out_event": {
"$ref": "../types/event.json", "$ref": "../types/event_object.json",
"description": "Event to fire when the drying out time runs out.", "description": "Event to fire when the drying out time runs out.",
"title": "Dried Out Event" "title": "Dried Out Event"
}, },
"recover_after_dried_out_event": { "recover_after_dried_out_event": {
"$ref": "../types/event.json", "$ref": "../types/event_object.json",
"description": "Event to fire when entity was already dried out but received increase in water supply.", "description": "Event to fire when entity was already dried out but received increase in water supply.",
"title": "Recover After Dried Out Event" "title": "Recover After Dried Out Event"
}, },
"stopped_drying_out_event": { "stopped_drying_out_event": {
"$ref": "../types/event.json", "$ref": "../types/event_object.json",
"description": "Event to fire when entity stopped drying out, for example got into water or under rain.", "description": "Event to fire when entity stopped drying out, for example got into water or under rain.",
"title": "Stopped Drying Out Event" "title": "Stopped Drying Out Event"
}, },

View File

@@ -42,12 +42,12 @@
"title": "Interact Text" "title": "Interact Text"
}, },
"on_equip": { "on_equip": {
"$ref": "../types/event.json", "$ref": "../types/event_object.json",
"description": "Event to trigger when this entity is equipped with this item.", "description": "Event to trigger when this entity is equipped with this item.",
"title": "On Equip" "title": "On Equip"
}, },
"on_unequip": { "on_unequip": {
"$ref": "../types/event.json", "$ref": "../types/event_object.json",
"description": "Event to trigger when this item is removed from this entity.", "description": "Event to trigger when this item is removed from this entity.",
"title": "On Unequip" "title": "On Unequip"
} }

View File

@@ -70,7 +70,7 @@
"type": "object", "type": "object",
"properties": { "properties": {
"birth_event": { "birth_event": {
"$ref": "../types/event.json", "$ref": "../types/event_object.json",
"description": "Event to run when this mob is created and matches the above allele conditions.", "description": "Event to run when this mob is created and matches the above allele conditions.",
"title": "Brith Event" "title": "Brith Event"
}, },

View File

@@ -28,7 +28,7 @@
} }
}, },
"on_give": { "on_give": {
"$ref": "../types/event.json", "$ref": "../types/event_object.json",
"description": "Event to fire when the correct item is given.", "description": "Event to fire when the correct item is given.",
"title": "On Give" "title": "On Give"
} }

View File

@@ -23,13 +23,13 @@
"title": "Entered Block Event", "title": "Entered Block Event",
"description": "Event to run when this mob enters a valid block.", "description": "Event to run when this mob enters a valid block.",
"$comment": "UNDOCUMENTED", "$comment": "UNDOCUMENTED",
"$ref": "../types/event.json" "$ref": "../types/event_object.json"
}, },
"exited_block_event": { "exited_block_event": {
"title": "Exited Block Event", "title": "Exited Block Event",
"description": "Event to run when this mob leaves a valid block.", "description": "Event to run when this mob leaves a valid block.",
"$comment": "UNDOCUMENTED", "$comment": "UNDOCUMENTED",
"$ref": "../types/event.json" "$ref": "../types/event_object.json"
} }
} }
} }

View File

@@ -24,12 +24,12 @@
"title": "Maximum Distance" "title": "Maximum Distance"
}, },
"on_leash": { "on_leash": {
"$ref": "../types/event.json", "$ref": "../types/event_object.json",
"description": "Event to call when this entity is leashed.", "description": "Event to call when this entity is leashed.",
"title": "On Leash" "title": "On Leash"
}, },
"on_unleash": { "on_unleash": {
"$ref": "../types/event.json", "$ref": "../types/event_object.json",
"description": "Event to call when this entity is unleashed.", "description": "Event to call when this entity is unleashed.",
"title": "On Unleash" "title": "On Unleash"
}, },

View File

@@ -25,7 +25,7 @@
"look_event": { "look_event": {
"description": "The event identifier to run when the entities specified in filters look at this entity.", "description": "The event identifier to run when the entities specified in filters look at this entity.",
"title": "Look Event", "title": "Look Event",
"$ref": "../types/event.json" "$ref": "../types/event_object.json"
}, },
"search_radius": { "search_radius": {
"type": "number", "type": "number",

View File

@@ -18,7 +18,7 @@
"title": "Name Filter" "title": "Name Filter"
}, },
"on_named": { "on_named": {
"$ref": "../types/event.json", "$ref": "../types/event_object.json",
"description": "Event to be called when this entity acquires the name specified in `name_filter'.", "description": "Event to be called when this entity acquires the name specified in `name_filter'.",
"title": "On Named" "title": "On Named"
} }

View File

@@ -7,17 +7,17 @@
"required": [], "required": [],
"properties": { "properties": {
"on_close": { "on_close": {
"$ref": "../types/event.json", "$ref": "../types/event_object.json",
"description": "Event to call when the entity is done peeking.", "description": "Event to call when the entity is done peeking.",
"title": "On Close" "title": "On Close"
}, },
"on_open": { "on_open": {
"$ref": "../types/event.json", "$ref": "../types/event_object.json",
"description": "Event to call when the entity starts peeking.", "description": "Event to call when the entity starts peeking.",
"title": "On Open" "title": "On Open"
}, },
"on_target_open": { "on_target_open": {
"$ref": "../types/event.json", "$ref": "../types/event_object.json",
"description": "Event to call when the entity's target entity starts peeking.", "description": "Event to call when the entity's target entity starts peeking.",
"title": "On Target Open" "title": "On Target Open"
} }

View File

@@ -25,12 +25,12 @@
"title": "Eject On Deactivate" "title": "Eject On Deactivate"
}, },
"on_activate": { "on_activate": {
"$ref": "../types/event.json", "$ref": "../types/event_object.json",
"description": "Event to call when the rail is activated.", "description": "Event to call when the rail is activated.",
"title": "On Activate" "title": "On Activate"
}, },
"on_deactivate": { "on_deactivate": {
"$ref": "../types/event.json", "$ref": "../types/event_object.json",
"description": "Event to call when the rail is deactivated.", "description": "Event to call when the rail is deactivated.",
"title": "On Deactivate" "title": "On Deactivate"
}, },

View File

@@ -7,12 +7,12 @@
"required": [], "required": [],
"properties": { "properties": {
"sit_event": { "sit_event": {
"$ref": "../types/event.json", "$ref": "../types/event_object.json",
"description": "Event to run when the entity enters the `sit` state.", "description": "Event to run when the entity enters the `sit` state.",
"title": "Sit Event" "title": "Sit Event"
}, },
"stand_event": { "stand_event": {
"$ref": "../types/event.json", "$ref": "../types/event_object.json",
"description": "Event to run when the entity exits the `sit` state.", "description": "Event to run when the entity exits the `sit` state.",
"title": "Stand Event" "title": "Stand Event"
} }

View File

@@ -16,7 +16,7 @@
}, },
"tame_event": { "tame_event": {
"title": "Tame Event", "title": "Tame Event",
"$ref": "../types/event.json", "$ref": "../types/event_object.json",
"description": "Event to run when this entity becomes tamed." "description": "Event to run when this entity becomes tamed."
}, },
"tame_items": { "tame_items": {

View File

@@ -95,7 +95,7 @@
"title": "Ride Text" "title": "Ride Text"
}, },
"tame_event": { "tame_event": {
"$ref": "../types/event.json", "$ref": "../types/event_object.json",
"description": "Event that triggers when the entity becomes tamed.", "description": "Event that triggers when the entity becomes tamed.",
"title": "Tame Event" "title": "Tame Event"
} }

View File

@@ -19,17 +19,17 @@
"title": "Inside Range" "title": "Inside Range"
}, },
"on_inside_range": { "on_inside_range": {
"$ref": "../types/event.json", "$ref": "../types/event_object.json",
"description": "Event to call when an entity gets in the inside range. Can specify `event` for the name of the event and `target` for the target of the event", "description": "Event to call when an entity gets in the inside range. Can specify `event` for the name of the event and `target` for the target of the event",
"title": "On Inside Range" "title": "On Inside Range"
}, },
"on_outside_range": { "on_outside_range": {
"$ref": "../types/event.json", "$ref": "../types/event_object.json",
"description": "Event to call when an entity gets in the outside range. Can specify `event` for the name of the event and `target` for the target of the event", "description": "Event to call when an entity gets in the outside range. Can specify `event` for the name of the event and `target` for the target of the event",
"title": "On Outside Range" "title": "On Outside Range"
}, },
"on_vision_lost_inside_range": { "on_vision_lost_inside_range": {
"$ref": "../types/event.json", "$ref": "../types/event_object.json",
"description": "Event to call when an entity exits visual range. Can specify `event` for the name of the event and `target` for the target of the event", "description": "Event to call when an entity exits visual range. Can specify `event` for the name of the event and `target` for the target of the event",
"title": "On Vision Lost Inside Range" "title": "On Vision Lost Inside Range"
}, },

View File

@@ -37,7 +37,7 @@
"time_down_event": { "time_down_event": {
"description": "Event to fire when the time on the timer runs out.", "description": "Event to fire when the time on the timer runs out.",
"title": "Time Down Event", "title": "Time Down Event",
"$ref": "../types/event.json" "$ref": "../types/event_object.json"
}, },
"random_time_choices": { "random_time_choices": {
"type": "array", "type": "array",

View File

@@ -13,7 +13,7 @@
"title": "Probability" "title": "Probability"
}, },
"trust_event": { "trust_event": {
"$ref": "../types/event.json", "$ref": "../types/event_object.json",
"description": "Event to run when this entity becomes trusting.", "description": "Event to run when this entity becomes trusting.",
"title": "Trust Event" "title": "Trust Event"
}, },

View File

@@ -0,0 +1,17 @@
{
"$id": "blockception.minecraft.entities.event_object",
"title": "Event",
"description": "Minecraft behavior event.",
"examples": [{ "event": "example:foo", "target": "self" }],
"type": "object",
"additionalProperties": false,
"properties": {
"event": { "type": "string", "pattern": "^[a-zA-Z0-9_\\-:]+$", "description": "The event to fire.", "title": "Event" },
"target": {
"type": "string",
"description": "The target of the event.",
"title": "Target",
"enum": ["baby", "block", "damager", "other", "parent", "player", "self", "target"]
}
}
}