From ba221007841dc8ceb0e22453137f183dabd44f49 Mon Sep 17 00:00:00 2001 From: Xterionix <72647213+Xterionix@users.noreply.github.com> Date: Sat, 3 May 2025 14:15:47 +0500 Subject: [PATCH] Misc improvements (#347) * - Allow for items without namespaces in loot tables * - Made rolls in loot table required * - Account for match tag conditions by not requiring item and count * - Allow forward / in feature (and rule) identifers * - Added pattern for structure names * - Change atlas > texture_name to const * - Allow . in texture entries in atlas files * - Food nutrition can only be ints --- .../features/minecraft.structure_template_feature.json | 3 ++- source/behavior/items/format/components/food.json | 2 +- source/behavior/loot_tables/conditions/match_tool.json | 2 +- source/behavior/loot_tables/loot_tables.json | 3 ++- source/general/feature/identifier.json | 2 +- source/resource/textures/item_texture.json | 4 ++-- source/resource/textures/terrain_texture.json | 4 ++-- 7 files changed, 11 insertions(+), 9 deletions(-) diff --git a/source/behavior/features/features/minecraft.structure_template_feature.json b/source/behavior/features/features/minecraft.structure_template_feature.json index 830bf2ba..f9166927 100644 --- a/source/behavior/features/features/minecraft.structure_template_feature.json +++ b/source/behavior/features/features/minecraft.structure_template_feature.json @@ -11,7 +11,8 @@ "structure_name": { "title": "Structure Name", "description": "Reference to the structure to be placed.", - "type": "string" + "type": "string", + "pattern": "^mystructure:(\\w|\/)+" }, "adjustment_radius": { "title": "Adjustment Radius", diff --git a/source/behavior/items/format/components/food.json b/source/behavior/items/format/components/food.json index f4ff09b1..7a1b363e 100644 --- a/source/behavior/items/format/components/food.json +++ b/source/behavior/items/format/components/food.json @@ -11,7 +11,7 @@ "type": "boolean", "default": false }, - "nutrition": { "title": "Nutrition", "description": "How much nutrition does this food item give the player when eaten.", "type": "number", "default": 0 }, + "nutrition": { "title": "Nutrition", "description": "How much nutrition does this food item give the player when eaten.", "type": "integer", "default": 0 }, "saturation_modifier": { "title": "Saturation Modifier", "description": "Saturation Modifier is used in this formula: (nutrition * saturation_modifier * 2) when appling the saturation buff. Which happens when you eat the item.", diff --git a/source/behavior/loot_tables/conditions/match_tool.json b/source/behavior/loot_tables/conditions/match_tool.json index 38a46b11..a0ca2bba 100644 --- a/source/behavior/loot_tables/conditions/match_tool.json +++ b/source/behavior/loot_tables/conditions/match_tool.json @@ -4,7 +4,7 @@ "additionalProperties": false, "description": "Returns the condition true if the block of the loot table was broken with a specific item.", "title": "Killed By Player", - "required": ["condition", "item", "count"], + "required": ["condition"], "properties": { "condition": { "type": "string", "const": "match_tool", "title": "Condition", "description": "UNDOCUMENTED.", "$comment": "UNDOCUMENTED" }, "item": { diff --git a/source/behavior/loot_tables/loot_tables.json b/source/behavior/loot_tables/loot_tables.json index 33ae1454..26438906 100644 --- a/source/behavior/loot_tables/loot_tables.json +++ b/source/behavior/loot_tables/loot_tables.json @@ -16,6 +16,7 @@ "additionalProperties": false, "title": "A Single Pool", "type": "object", + "required": ["rolls"], "properties": { "rolls": { "title": "Rolls", @@ -72,7 +73,7 @@ "title": "Count", "description": "The amount of the item." }, - "name": { "title": "Name", "type": "string", "description": "An item or loottable.", "pattern": "^([\\w]+:|loot_tables/)" }, + "name": { "title": "Name", "type": "string", "description": "An item or loottable.", "pattern": "^(?:[\\w]+:|loot_tables\/)?[\\w]+(?:\/[\\w]+)*$" }, "weight": { "title": "Weight", "type": "integer", diff --git a/source/general/feature/identifier.json b/source/general/feature/identifier.json index d2a91860..11abadd0 100644 --- a/source/general/feature/identifier.json +++ b/source/general/feature/identifier.json @@ -2,7 +2,7 @@ "$id": "blockception.minecraft.feature.identifier", "description": "A minecraft feature identifier.", "examples": ["namespace:feature"], - "pattern": "^[0-9a-zA-Z:_\\.\\-]+$", + "pattern": "^[0-9a-zA-Z:_\\.\/-]+$", "title": "Feature Identifier", "type": "string", "defaultSnippets": [{ "label": "New Identifier", "body": "$1:$2" }] diff --git a/source/resource/textures/item_texture.json b/source/resource/textures/item_texture.json index 56094991..7f30720f 100644 --- a/source/resource/textures/item_texture.json +++ b/source/resource/textures/item_texture.json @@ -70,7 +70,7 @@ "description": "UNDOCUMENTED.", "$comment": "UNDOCUMENTED", "type": "object", - "propertyNames": { "pattern": "^[a-z0-9_:\\-]*$" }, + "propertyNames": { "pattern": "^[a-z0-9_:.\\-]*$" }, "additionalProperties": { "title": "Texture Data", "description": "UNDOCUMENTED.", @@ -84,6 +84,6 @@ } } }, - "texture_name": { "title": "Texture Name", "description": "UNDOCUMENTED.", "$comment": "UNDOCUMENTED", "type": "string" } + "texture_name": { "const": "atlas.items" } } } diff --git a/source/resource/textures/terrain_texture.json b/source/resource/textures/terrain_texture.json index 78d681d7..9d986ecd 100644 --- a/source/resource/textures/terrain_texture.json +++ b/source/resource/textures/terrain_texture.json @@ -59,7 +59,7 @@ "resource_pack_name": { "type": "string", "title": "Resource Pack Name", "description": "UNDOCUMENTED.", "$comment": "UNDOCUMENTED" }, "texture_data": { "type": "object", - "propertyNames": { "pattern": "^[a-z0-9_:\\-]*$" }, + "propertyNames": { "pattern": "^[a-z0-9_:.\\-]*$" }, "additionalProperties": { "type": "object", "title": "Texture Data", @@ -73,6 +73,6 @@ "$comment": "UNDOCUMENTED", "title": "Texture Data" }, - "texture_name": { "type": "string", "description": "UNDOCUMENTED.", "$comment": "UNDOCUMENTED", "title": "Texture Name" } + "texture_name": { "const": "atlas.terrain" } } }