From 9ea6077e4e3840fbae6e7b18bc9808c0fefc7806 Mon Sep 17 00:00:00 2001 From: Xterionix <72647213+Xterionix@users.noreply.github.com> Date: Mon, 18 Mar 2024 23:58:22 +0500 Subject: [PATCH] Block traits (#227) * - Spawn category * - Block traits --- .../blocks/format/minecraft.block.json | 15 ++++++++++ .../format/traits/placement_direction.json | 30 +++++++++++++++++++ .../format/traits/placement_position.json | 25 ++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 source/behavior/blocks/format/traits/placement_direction.json create mode 100644 source/behavior/blocks/format/traits/placement_position.json diff --git a/source/behavior/blocks/format/minecraft.block.json b/source/behavior/blocks/format/minecraft.block.json index 09641f3f..8fda0d13 100644 --- a/source/behavior/blocks/format/minecraft.block.json +++ b/source/behavior/blocks/format/minecraft.block.json @@ -43,6 +43,16 @@ "minecraft:queued_ticking": { "$ref": "./triggers/queued_ticking.json" }, "minecraft:random_ticking": { "$ref": "./triggers/random_ticking.json" } } + }, + "traits_ref": { + "type": "object", + "title": "Trait", + "description": "A shortcut for creators to use Vanilla block states without needing to define and manage a series of events or triggers on custom blocks", + "additionalProperties": false, + "properties": { + "minecraft:placement_position": { "$ref": "./traits/placement_position.json" }, + "minecraft:placement_direction": { "$ref": "./traits/placement_direction.json" } + } } }, "properties": { @@ -238,6 +248,11 @@ { "type": "object" } ] } + }, + "traits": { + "type": "object", + "title": "Trait", + "$ref": "#/definitions/traits_ref" } } }, diff --git a/source/behavior/blocks/format/traits/placement_direction.json b/source/behavior/blocks/format/traits/placement_direction.json new file mode 100644 index 00000000..c6a57399 --- /dev/null +++ b/source/behavior/blocks/format/traits/placement_direction.json @@ -0,0 +1,30 @@ +{ + "$id": "blockception.minecraft.behavior.blocks.traits.minecraft.placement_direction", + "title": "Placement Direction", + "description": "Contains information about the player's rotation when the block was placed.", + "additionalProperties": false, + "type": "object", + "required": [ + "enabled_states" + ], + "properties": { + "enabled_states": { + "title": "Enabled States", + "description": "Block states you wish to enable", + "type": "array", + "maxItems": 2, + "minItems": 1, + "items": { + "enum": [ + "minecraft:cardinal_direction", + "minecraft:facing_direction" + ] + } + }, + "y_rotation_offset": { + "title": "Y Rotation Offset", + "description": "This rotation offset only applies to the horizontal state values", + "enum": [0, 90, 180, 270, -90, -180, -270] + } + } +} \ No newline at end of file diff --git a/source/behavior/blocks/format/traits/placement_position.json b/source/behavior/blocks/format/traits/placement_position.json new file mode 100644 index 00000000..3b0aca36 --- /dev/null +++ b/source/behavior/blocks/format/traits/placement_position.json @@ -0,0 +1,25 @@ +{ + "$id": "blockception.minecraft.behavior.blocks.traits.minecraft.placement_position", + "title": "Placement Position", + "description": "Contains information about where the player placed the block.", + "additionalProperties": false, + "type": "object", + "required": [ + "enabled_states" + ], + "properties": { + "enabled_states": { + "title": "Enabled States", + "description": "Block states you wish to enable", + "type": "array", + "maxItems": 2, + "minItems": 1, + "items": { + "enum": [ + "minecraft:block_face", + "minecraft:vertical_half" + ] + } + } + } +} \ No newline at end of file