Feature/actor properties (#138)

* Added actor properties

* Adding Set Property in events

Co-authored-by: Daan Verstraten <daan@q42.nl>
This commit is contained in:
Daan Verstraten
2022-10-29 16:13:50 +02:00
committed by GitHub
parent bb7b2868ef
commit cd517471e7
3 changed files with 388 additions and 221 deletions

View File

@@ -1,115 +1,169 @@
{
"$id": "blockception.minecraft.behavior.entities.events",
"type": "object",
"title": "Events",
"description": "Events for entities.",
"additionalProperties": { "$ref": "#/definitions/event_base" },
"definitions": {
"addremove": {
"additionalProperties": false,
"title": "Add Or Remove",
"description": "The components groups to add or remove.",
"type": "object",
"examples": [{ "component_groups": ["self:variant1"] }],
"properties": {
"component_groups": {
"title": "Component Groups",
"description": "The components groups to add or remove.",
"type": "array",
"items": { "type": "string", "description": "A reference to a component group.", "title": "Component Groups" }
}
}
},
"event_base": {
"additionalProperties": false,
"type": "object",
"examples": [{}, { "add": { "component_groups": [] } }, { "remove": { "component_groups": [] } }],
"defaultSnippets": [
{ "label": "New Add Event", "body": { "add": { "component_groups": ["$1"] } } },
{ "label": "New Remove Event", "body": { "remove": { "component_groups": ["$1"] } } },
{
"label": "New Random Event",
"body": {
"randomize": [
{ "add": { "component_groups": ["$1"] }, "weight": 1 },
{ "add": { "component_groups": ["$2"] }, "weight": 1 }
]
}
},
{
"label": "New Sequence Events",
"body": {
"sequence": [{ "add": { "component_groups": ["$1"] } }, { "add": { "component_groups": ["$2"] } }]
}
}
],
"properties": {
"filters": { "$ref": "./../filters/filters.json" },
"trigger": { "description": "Triggers additional events.", "$comment": "UNDOCUMENTED", "title": "Trigger", "$ref": "./types/trigger.json" },
"add": { "$ref": "#/definitions/addremove", "description": "What gets added when the event gets triggered.", "title": "Add" },
"remove": { "$ref": "#/definitions/addremove", "description": "What gets removed when the event gets triggered.", "title": "Remove" },
"randomize": {
"type": "array",
"description": "Randomly selects one of the following items based upon their weight and the total weights.",
"title": "Randomize",
"items": {
"description": "Randomly selects one of the following items based upon their weight and the total weights.",
"title": "Randomize",
"examples": [{ "add": { "component_groups": ["foo:example"] }, "weight": 1 }],
"properties": {
"add": { "$ref": "#/definitions/addremove", "description": "What gets added when the event gets triggered.", "title": "Add" },
"remove": { "$ref": "#/definitions/addremove", "description": "What gets removed when the event gets triggered.", "title": "Remove" },
"trigger": { "description": "Triggers additional events.", "$comment": "UNDOCUMENTED", "title": "Trigger", "$ref": "./types/trigger.json" },
"weight": {
"type": "number",
"default": 1,
"minimum": 1,
"description": "The weight on how likely this section is to trigger.",
"$comment": "UNDOCUMENTED",
"title": "Weight"
}
}
}
},
"sequence": {
"type": "array",
"description": "A series of filters and components to be added.",
"title": "Sequences",
"items": {
"description": "Filters and components to be added.",
"title": "Sequence",
"type": "object",
"properties": {
"add": { "$ref": "#/definitions/addremove", "description": "What gets added when the event gets triggered.", "title": "Add" },
"remove": { "$ref": "#/definitions/addremove", "description": "What gets removed when the event gets triggered.", "title": "Remove" },
"trigger": { "description": "Triggers additional events.", "$comment": "UNDOCUMENTED", "title": "Trigger", "$ref": "./types/trigger.json" },
"filters": { "$ref": "./../filters/filters.json" }
}
}
}
}
}
},
"properties": {
"minecraft:entity_transformed": {
"description": "Event called on an entity that transforms into another entity.",
"$ref": "#/definitions/event_base",
"title": "Entity Transformed"
},
"minecraft:entity_born": {
"description": "Event called on an entity that is spawned through two entities breeding.",
"$ref": "#/definitions/event_base",
"title": "Entity Born"
},
"minecraft:entity_spawned": {
"description": "Event called on an entity that is placed in the level.",
"$ref": "#/definitions/event_base",
"title": "Entity Spawned"
},
"minecraft:on_prime": {
"description": "Event called on an entity whose fuse is lit and is ready to explode.",
"$ref": "#/definitions/event_base",
"title": "On Prime"
}
}
}
{
"$id": "blockception.minecraft.behavior.entities.events",
"type": "object",
"title": "Events",
"description": "Events for entities.",
"additionalProperties": { "$ref": "#/definitions/event_base" },
"definitions": {
"addremove": {
"additionalProperties": false,
"title": "Add Or Remove",
"description": "The components groups to add or remove.",
"type": "object",
"examples": [{ "component_groups": ["self:variant1"] }],
"properties": {
"component_groups": {
"title": "Component Groups",
"description": "The components groups to add or remove.",
"type": "array",
"items": { "type": "string", "description": "A reference to a component group.", "title": "Component Groups" }
}
}
},
"event_base": {
"additionalProperties": false,
"type": "object",
"examples": [{}, { "add": { "component_groups": [] } }, { "remove": { "component_groups": [] } }],
"defaultSnippets": [
{ "label": "New Add Event", "body": { "add": { "component_groups": ["$1"] } } },
{ "label": "New Remove Event", "body": { "remove": { "component_groups": ["$1"] } } },
{
"label": "New Random Event",
"body": {
"randomize": [
{ "add": { "component_groups": ["$1"] }, "weight": 1 },
{ "add": { "component_groups": ["$2"] }, "weight": 1 }
]
}
},
{
"label": "New Sequence Events",
"body": {
"sequence": [{ "add": { "component_groups": ["$1"] } }, { "add": { "component_groups": ["$2"] } }]
}
}
],
"properties": {
"filters": { "$ref": "./../filters/filters.json" },
"trigger": {
"description": "Triggers additional events.",
"$comment": "UNDOCUMENTED",
"title": "Trigger",
"$ref": "./types/trigger.json"
},
"add": {
"$ref": "#/definitions/addremove",
"description": "What gets added when the event gets triggered.",
"title": "Add"
},
"remove": {
"$ref": "#/definitions/addremove",
"description": "What gets removed when the event gets triggered.",
"title": "Remove"
},
"randomize": {
"type": "array",
"description": "Randomly selects one of the following items based upon their weight and the total weights.",
"title": "Randomize",
"items": {
"description": "Randomly selects one of the following items based upon their weight and the total weights.",
"title": "Randomize",
"examples": [{ "add": { "component_groups": ["foo:example"] }, "weight": 1 }],
"properties": {
"add": {
"$ref": "#/definitions/addremove",
"description": "What gets added when the event gets triggered.",
"title": "Add"
},
"remove": {
"$ref": "#/definitions/addremove",
"description": "What gets removed when the event gets triggered.",
"title": "Remove"
},
"trigger": {
"description": "Triggers additional events.",
"$comment": "UNDOCUMENTED",
"title": "Trigger",
"$ref": "./types/trigger.json"
},
"weight": {
"type": "number",
"default": 1,
"minimum": 1,
"description": "The weight on how likely this section is to trigger.",
"$comment": "UNDOCUMENTED",
"title": "Weight"
}
}
}
},
"sequence": {
"type": "array",
"description": "A series of filters and components to be added.",
"title": "Sequences",
"items": {
"description": "Filters and components to be added.",
"title": "Sequence",
"type": "object",
"properties": {
"add": {
"$ref": "#/definitions/addremove",
"description": "What gets added when the event gets triggered.",
"title": "Add"
},
"remove": {
"$ref": "#/definitions/addremove",
"description": "What gets removed when the event gets triggered.",
"title": "Remove"
},
"trigger": {
"description": "Triggers additional events.",
"$comment": "UNDOCUMENTED",
"title": "Trigger",
"$ref": "./types/trigger.json"
},
"filters": { "$ref": "./../filters/filters.json" }
}
}
},
"set_property": {
"title": "Set Property",
"description": "Sets a property on the entity.",
"type": "object",
"additionalProperties": {
"title": "Property",
"type": ["string", "number", "integer", "boolean"]
},
"examples": [
{ "example:property": false },
{ "example:property": 0 },
{ "example:property": 0.0 },
{ "example:property": "one" }
]
}
}
}
},
"properties": {
"minecraft:entity_transformed": {
"description": "Event called on an entity that transforms into another entity.",
"$ref": "#/definitions/event_base",
"title": "Entity Transformed"
},
"minecraft:entity_born": {
"description": "Event called on an entity that is spawned through two entities breeding.",
"$ref": "#/definitions/event_base",
"title": "Entity Born"
},
"minecraft:entity_spawned": {
"description": "Event called on an entity that is placed in the level.",
"$ref": "#/definitions/event_base",
"title": "Entity Spawned"
},
"minecraft:on_prime": {
"description": "Event called on an entity whose fuse is lit and is ready to explode.",
"$ref": "#/definitions/event_base",
"title": "On Prime"
}
}
}

View File

@@ -1,106 +1,211 @@
{
"$id": "blockception.minecraft.behavior.entities.minecraft:entity",
"title": "Entity",
"required": ["description"],
"dependencies": { "component_groups": ["events"] },
"additionalProperties": false,
"type": "object",
"properties": {
"description": {
"required": ["identifier"],
"title": "Description",
"description": "The description of the this entity.",
"properties": {
"animations": {
"title": "Animations",
"description": "Sets the mapping of internal animation / animation controllers references to actual animations. This is a JSON Object of name/animation pairs",
"type": "object",
"additionalProperties": {
"title": "Animation / Controller",
"description": "The name of the animation controller / animation.",
"type": "string",
"examples": ["animation.", "controller."]
}
},
"identifier": {
"$ref": "../../../general/entity/identifier.json",
"description": "Sets the identifier for this entity's description.",
"title": "Identifier"
},
"is_spawnable": {
"type": "boolean",
"title": "Is Spawnable",
"description": "Sets whether or not this entity has a spawn egg in the creative ui.",
"default": false
},
"is_summonable": {
"type": "boolean",
"title": "Is Summonable Property",
"description": "Sets whether or not we can summon this entity using commands such as /summon.",
"default": true
},
"is_experimental": {
"type": "boolean",
"title": "Is Experimental",
"description": "Sets whether or not this entity is experimental. Experimental entities are only enabled when the experimental toggle is enabled.",
"default": false
},
"runtime_identifier": {
"type": "string",
"title": "Runtime Identifier",
"description": "Sets the name for the Vanilla Minecraft identifier this entity will use to build itself from.",
"examples": ["minecraft."]
},
"scripts": {
"type": "object",
"title": "Scripts",
"description": "Sets the mapping of internal animation controller references to actual animation controller. This is a JSON Array of name/animation-controller pairs",
"properties": {
"animate": {
"type": "array",
"title": "Animate",
"description": "Tells minecraft to run which animation / animation controllers and under what conditions.",
"items": {
"oneOf": [
{ "type": "string", "title": "Animation", "description": "The name of an animation controller referenced in animations." },
{
"type": "object",
"title": "Conditional Animation",
"description": "A conditional statement to run the animation under a specified condition.",
"$comment": "UNDOCUMENTED",
"additionalProperties": { "type": "string", "title": "Animation" }
}
]
}
}
}
}
}
},
"component_groups": {
"title": "Component Groups",
"description": "Each group when add / remove the default components.",
"uniqueItems": true,
"type": "object",
"propertyNames": { "examples": ["self:"] },
"additionalProperties": {
"$ref": "./components.json",
"uniqueItems": true,
"description": "The components that are added as the foundation of the entity.",
"title": "Component"
}
},
"components": {
"$ref": "./components.json",
"uniqueItems": true,
"description": "The components that are added as the foundation of the entity.",
"title": "Component"
},
"events": {
"$ref": "./events.json",
"uniqueItems": true,
"description": "The events that the entity can run, these add or remove components_groups.",
"title": "Events"
}
}
}
{
"$id": "blockception.minecraft.behavior.entities.minecraft:entity",
"title": "Entity",
"required": ["description"],
"dependencies": { "component_groups": ["events"] },
"additionalProperties": false,
"type": "object",
"properties": {
"description": {
"required": ["identifier"],
"title": "Description",
"description": "The description of the this entity.",
"properties": {
"animations": {
"title": "Animations",
"description": "Sets the mapping of internal animation / animation controllers references to actual animations. This is a JSON Object of name/animation pairs",
"type": "object",
"additionalProperties": {
"title": "Animation / Controller",
"description": "The name of the animation controller / animation.",
"type": "string",
"examples": ["animation.", "controller."]
}
},
"identifier": {
"$ref": "../../../general/entity/identifier.json",
"description": "Sets the identifier for this entity's description.",
"title": "Identifier"
},
"is_spawnable": {
"type": "boolean",
"title": "Is Spawnable",
"description": "Sets whether or not this entity has a spawn egg in the creative ui.",
"default": false
},
"is_summonable": {
"type": "boolean",
"title": "Is Summonable Property",
"description": "Sets whether or not we can summon this entity using commands such as /summon.",
"default": true
},
"is_experimental": {
"type": "boolean",
"title": "Is Experimental",
"description": "Sets whether or not this entity is experimental. Experimental entities are only enabled when the experimental toggle is enabled.",
"default": false
},
"properties": {
"title": "Experimental",
"description": "Experimental",
"type": "object",
"additionalProperties": {
"type": "object",
"required": ["type"],
"properties": {
"type": {
"title": "Type",
"description": "The type of the property.",
"enum": ["bool", "int", "float", "enum"]
}
},
"oneOf": [
{
"properties": {
"type": { "const": "bool" },
"default": {
"title": "Default",
"description": "The default value of the property.",
"$ref": "../../../molang/boolean.json"
}
}
},
{
"properties": {
"type": { "const": "int" },
"default": {
"title": "Default",
"description": "The default value of the property.",
"$ref": "../../../molang/number.json"
},
"range": {
"title": "Range",
"description": "The range of the property.",
"type": "array",
"items": [
{
"title": "Min",
"type": "integer",
"description": "The minimum value of the property."
},
{
"title": "Max",
"type": "integer",
"description": "The minimum value of the property."
}
]
}
}
},
{
"properties": {
"type": { "const": "float" },
"default": {
"title": "Default",
"description": "The default value of the property.",
"$ref": "../../../molang/number.json"
},
"range": {
"title": "Range",
"description": "The range of the property.",
"type": "array",
"items": [
{
"title": "Min",
"type": "number",
"description": "The minimum value of the property."
},
{
"title": "Max",
"type": "number",
"description": "The minimum value of the property."
}
]
}
}
},
{
"properties": {
"type": { "const": "enum" },
"default": { "type": "string" },
"client_sync": {
"title": "Client Sync",
"description": "Sets whether or not the property is synced to the client.",
"type": "boolean",
"default": false
},
"values": {
"title": "Values",
"description": "The values of the property.",
"type": "array",
"minItems": 1,
"items": { "type": "string" }
}
}
}
]
}
},
"runtime_identifier": {
"type": "string",
"title": "Runtime Identifier",
"description": "Sets the name for the Vanilla Minecraft identifier this entity will use to build itself from.",
"examples": ["minecraft."]
},
"scripts": {
"type": "object",
"title": "Scripts",
"description": "Sets the mapping of internal animation controller references to actual animation controller. This is a JSON Array of name/animation-controller pairs",
"properties": {
"animate": {
"type": "array",
"title": "Animate",
"description": "Tells minecraft to run which animation / animation controllers and under what conditions.",
"items": {
"oneOf": [
{
"type": "string",
"title": "Animation",
"description": "The name of an animation controller referenced in animations."
},
{
"type": "object",
"title": "Conditional Animation",
"description": "A conditional statement to run the animation under a specified condition.",
"$comment": "UNDOCUMENTED",
"additionalProperties": { "type": "string", "title": "Animation" }
}
]
}
}
}
}
}
},
"component_groups": {
"title": "Component Groups",
"description": "Each group when add / remove the default components.",
"uniqueItems": true,
"type": "object",
"propertyNames": { "examples": ["self:"] },
"additionalProperties": {
"$ref": "./components.json",
"uniqueItems": true,
"description": "The components that are added as the foundation of the entity.",
"title": "Component"
}
},
"components": {
"$ref": "./components.json",
"uniqueItems": true,
"description": "The components that are added as the foundation of the entity.",
"title": "Component"
},
"events": {
"$ref": "./events.json",
"uniqueItems": true,
"description": "The events that the entity can run, these add or remove components_groups.",
"title": "Events"
}
}
}

View File

@@ -0,0 +1,8 @@
{
"$id": "molang_boolean1.19.0",
"title": "Molang Boolean",
"description": "The minecraft molang definition that results in a boolean.",
"anyOf": [{ "type": "string", "minLength": 0 }, { "type": "boolean" }],
"examples": [0, "query.variant", "(1.0)", "query.", "variable.=;"],
"defaultSnippets": [{ "label": "New Molang", "body": "$1" }]
}