Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block traits #227

Merged
merged 4 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions source/behavior/blocks/format/minecraft.block.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -238,6 +248,11 @@
{ "type": "object" }
]
}
},
"traits": {
"type": "object",
"title": "Trait",
"$ref": "#/definitions/traits_ref"
}
}
},
Expand Down
30 changes: 30 additions & 0 deletions source/behavior/blocks/format/traits/placement_direction.json
Original file line number Diff line number Diff line change
@@ -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]
}
}
}
25 changes: 25 additions & 0 deletions source/behavior/blocks/format/traits/placement_position.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
}
}
}
Loading