From cbd0262612d51bca13933c58128fa4695967c53e Mon Sep 17 00:00:00 2001 From: Piotr Brzozowski Date: Wed, 15 Oct 2025 19:48:05 +0200 Subject: [PATCH] Update loot table schemas (#391) * update loot table schemas * remove entity_properties and use new int_or_range definition * remove entity_properties from conditions.json as well --- source/behavior/loot_tables/conditions.json | 36 +++++++++++++++- .../loot_tables/conditions/bool_property.json | 19 +++++++++ .../loot_tables/conditions/entity_killed.json | 15 +++++++ .../conditions/entity_properties.json | 32 --------------- .../loot_tables/conditions/enum_property.json | 19 +++++++++ .../conditions/float_property.json | 19 +++++++++ .../loot_tables/conditions/has_property.json | 15 +++++++ .../loot_tables/conditions/has_variant.json | 15 +++++++ .../loot_tables/conditions/int_property.json | 19 +++++++++ .../loot_tables/conditions/match_tool.json | 11 +++-- .../random_regional_difficulty_chance.json | 41 ++++--------------- source/behavior/loot_tables/functions.json | 19 ++++++++- .../loot_tables/functions/set_count.json | 2 +- .../loot_tables/functions/set_damage.json | 11 +---- .../loot_tables/functions/set_data.json | 11 +---- .../set_ominous_bottle_amplifier.json | 15 +++++++ .../functions/set_stew_effect.json | 31 ++++++++++++++ source/behavior/loot_tables/loot_tables.json | 15 +------ source/general/int_or_range.json | 16 ++++++++ 19 files changed, 255 insertions(+), 106 deletions(-) create mode 100644 source/behavior/loot_tables/conditions/bool_property.json create mode 100644 source/behavior/loot_tables/conditions/entity_killed.json delete mode 100644 source/behavior/loot_tables/conditions/entity_properties.json create mode 100644 source/behavior/loot_tables/conditions/enum_property.json create mode 100644 source/behavior/loot_tables/conditions/float_property.json create mode 100644 source/behavior/loot_tables/conditions/has_property.json create mode 100644 source/behavior/loot_tables/conditions/has_variant.json create mode 100644 source/behavior/loot_tables/conditions/int_property.json create mode 100644 source/behavior/loot_tables/functions/set_ominous_bottle_amplifier.json create mode 100644 source/behavior/loot_tables/functions/set_stew_effect.json create mode 100644 source/general/int_or_range.json diff --git a/source/behavior/loot_tables/conditions.json b/source/behavior/loot_tables/conditions.json index d6ed124c..25aec50a 100644 --- a/source/behavior/loot_tables/conditions.json +++ b/source/behavior/loot_tables/conditions.json @@ -4,8 +4,36 @@ "title": "Condition", "allOf": [ { - "if": { "properties": { "condition": { "type": "string", "const": "entity_properties" } } }, - "then": { "$ref": "./conditions/entity_properties.json" } + "if": { "properties": { "condition": { "const": "has_mark_variant" } } }, + "then": { "$ref": "./conditions/has_mark_variant.json" } + }, + { + "if": { "properties": { "condition": { "const": "has_variant" } } }, + "then": { "$ref": "./conditions/has_variant.json" } + }, + { + "if": { "properties": { "condition": { "const": "has_property" } } }, + "then": { "$ref": "./conditions/has_property.json" } + }, + { + "if": { "properties": { "condition": { "const": "bool_property" } } }, + "then": { "$ref": "./conditions/bool_property.json" } + }, + { + "if": { "properties": { "condition": { "const": "int_property" } } }, + "then": { "$ref": "./conditions/int_property.json" } + }, + { + "if": { "properties": { "condition": { "const": "float_property" } } }, + "then": { "$ref": "./conditions/float_property.json" } + }, + { + "if": { "properties": { "condition": { "const": "enum_property" } } }, + "then": { "$ref": "./conditions/enum_property.json" } + }, + { + "if": { "properties": { "condition": { "const": "match_tool" } } }, + "then": { "$ref": "./conditions/match_tool.json" } }, { "if": { "properties": { "condition": { "type": "string", "const": "has_mark_variant" } } }, @@ -31,6 +59,10 @@ "if": { "properties": { "condition": { "type": "string", "const": "damaged_by_entity" } } }, "then": { "$ref": "./conditions/damaged_by_entity.json" } }, + { + "if": { "properties": { "condition": { "type": "string", "const": "entity_killed" } } }, + "then": { "$ref": "./conditions/entity_killed.json" } + }, { "if": { "properties": { "condition": { "type": "string", "const": "random_chance" } } }, "then": { "$ref": "./conditions/random_chance.json" } diff --git a/source/behavior/loot_tables/conditions/bool_property.json b/source/behavior/loot_tables/conditions/bool_property.json new file mode 100644 index 00000000..548eee7c --- /dev/null +++ b/source/behavior/loot_tables/conditions/bool_property.json @@ -0,0 +1,19 @@ +{ + "$id": "blockception.minecraft.behavior.condition.bool_property", + "type": "object", + "title": "Bool Property", + "description": "Checks whether a boolean property matches the requested value.", + "additionalProperties": false, + "required": ["condition", "domain", "value"], + "properties": { + "condition": { "const": "bool_property" }, + "domain": { + "type": "string", + "description": "Property domain identifier." + }, + "value": { + "type": "boolean", + "description": "Expected boolean value." + } + } +} diff --git a/source/behavior/loot_tables/conditions/entity_killed.json b/source/behavior/loot_tables/conditions/entity_killed.json new file mode 100644 index 00000000..816abfd1 --- /dev/null +++ b/source/behavior/loot_tables/conditions/entity_killed.json @@ -0,0 +1,15 @@ +{ + "$id": "blockception.minecraft.behavior.condition.entity_killed", + "type": "object", + "title": "Entity Killed", + "description": "Checks whether the source entity matches the supplied identifier.", + "additionalProperties": false, + "required": ["condition", "entity_type"], + "properties": { + "condition": { "const": "entity_killed" }, + "entity_type": { + "type": "string", + "description": "Entity identifier expected for the killer/victim." + } + } +} diff --git a/source/behavior/loot_tables/conditions/entity_properties.json b/source/behavior/loot_tables/conditions/entity_properties.json deleted file mode 100644 index e9f7bef6..00000000 --- a/source/behavior/loot_tables/conditions/entity_properties.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "$id": "blockception.minecraft.behavior.condition.entity_properties", - "type": "object", - "additionalProperties": false, - "description": "Returns true if the actor properties defined were executed.", - "title": "Entity Properties", - "properties": { - "condition": { "type": "string", "title": "Condition", "description": "Returns true if the actor properties defined were executed.", "$comment": "UNDOCUMENTED" }, - "entity": { "type": "string", "default": "this", "description": "The entity to test. The value must be only `this`.", "title": "Entity" }, - "properties": { - "type": "object", - "default": {}, - "description": "The entity's properties. `on_fire`, `on_ground` is used for now.", - "title": "Properties", - "additionalProperties": false, - "properties": { - "on_fire": { - "title": "On Fire", - "description": "Checks if the entity is on fire or not.", - "$comment": "UNDOCUMENTED", - "type": "boolean" - }, - "on_ground": { - "title": "On Ground", - "description": "Checks if the entity is on the ground or not.", - "$comment": "UNDOCUMENTED", - "type": "boolean" - } - } - } - } -} diff --git a/source/behavior/loot_tables/conditions/enum_property.json b/source/behavior/loot_tables/conditions/enum_property.json new file mode 100644 index 00000000..28d7cfc6 --- /dev/null +++ b/source/behavior/loot_tables/conditions/enum_property.json @@ -0,0 +1,19 @@ +{ + "$id": "blockception.minecraft.behavior.condition.enum_property", + "type": "object", + "title": "Enum Property", + "description": "Checks whether an enum property matches the requested value.", + "additionalProperties": false, + "required": ["condition", "domain", "value"], + "properties": { + "condition": { "const": "enum_property" }, + "domain": { + "type": "string", + "description": "Property domain identifier." + }, + "value": { + "type": "string", + "description": "Expected enumeration value." + } + } +} diff --git a/source/behavior/loot_tables/conditions/float_property.json b/source/behavior/loot_tables/conditions/float_property.json new file mode 100644 index 00000000..d50faecd --- /dev/null +++ b/source/behavior/loot_tables/conditions/float_property.json @@ -0,0 +1,19 @@ +{ + "$id": "blockception.minecraft.behavior.condition.float_property", + "type": "object", + "title": "Float Property", + "description": "Checks whether a float property matches the requested value.", + "additionalProperties": false, + "required": ["condition", "domain", "value"], + "properties": { + "condition": { "const": "float_property" }, + "domain": { + "type": "string", + "description": "Property domain identifier." + }, + "value": { + "description": "Expected float value.", + "type": "number" + } + } +} diff --git a/source/behavior/loot_tables/conditions/has_property.json b/source/behavior/loot_tables/conditions/has_property.json new file mode 100644 index 00000000..873a855b --- /dev/null +++ b/source/behavior/loot_tables/conditions/has_property.json @@ -0,0 +1,15 @@ +{ + "$id": "blockception.minecraft.behavior.condition.has_property", + "type": "object", + "title": "Has Property", + "description": "Checks whether the current actor exposes a property in the given domain.", + "additionalProperties": false, + "required": ["condition", "domain"], + "properties": { + "condition": { "const": "has_property" }, + "domain": { + "type": "string", + "description": "Property domain identifier." + } + } +} diff --git a/source/behavior/loot_tables/conditions/has_variant.json b/source/behavior/loot_tables/conditions/has_variant.json new file mode 100644 index 00000000..7891fd10 --- /dev/null +++ b/source/behavior/loot_tables/conditions/has_variant.json @@ -0,0 +1,15 @@ +{ + "$id": "blockception.minecraft.behavior.condition.has_variant", + "type": "object", + "title": "Has Variant", + "description": "Checks the variant value of the current actor.", + "additionalProperties": false, + "required": ["condition", "variant"], + "properties": { + "condition": { "const": "has_variant" }, + "value": { + "type": "integer", + "description": "Expected variant identifier." + } + } +} diff --git a/source/behavior/loot_tables/conditions/int_property.json b/source/behavior/loot_tables/conditions/int_property.json new file mode 100644 index 00000000..6abe8e43 --- /dev/null +++ b/source/behavior/loot_tables/conditions/int_property.json @@ -0,0 +1,19 @@ +{ + "$id": "blockception.minecraft.behavior.condition.int_property", + "type": "object", + "title": "Int Property", + "description": "Checks whether an integer property matches the requested value.", + "additionalProperties": false, + "required": ["condition", "domain", "value"], + "properties": { + "condition": { "const": "int_property" }, + "domain": { + "type": "string", + "description": "Property domain identifier." + }, + "value": { + "description": "Expected integer value.", + "type": "integer" + } + } +} diff --git a/source/behavior/loot_tables/conditions/match_tool.json b/source/behavior/loot_tables/conditions/match_tool.json index 66e0d5aa..22cc523c 100644 --- a/source/behavior/loot_tables/conditions/match_tool.json +++ b/source/behavior/loot_tables/conditions/match_tool.json @@ -8,15 +8,18 @@ "properties": { "condition": { "type": "string", "const": "match_tool", "title": "Condition", "description": "UNDOCUMENTED.", "$comment": "UNDOCUMENTED" }, "item": { - "title": "Item", "description": "The item to match", - "type": "string" + "$ref": "../../../general/item/identifier.json" }, "count": { "title": "Count", "description": "Minimum count to match of the given item", - "type": "integer", - "minimum": 0 + "$ref": "../../../general/int_or_range.json" + }, + "durability": { + "title": "Durability", + "description": "Minimum durability to match of the given item", + "$ref": "../../../general/int_or_range.json" }, "enchantments": { "title": "Enchantments", diff --git a/source/behavior/loot_tables/conditions/random_regional_difficulty_chance.json b/source/behavior/loot_tables/conditions/random_regional_difficulty_chance.json index 85163da0..81fa3d35 100644 --- a/source/behavior/loot_tables/conditions/random_regional_difficulty_chance.json +++ b/source/behavior/loot_tables/conditions/random_regional_difficulty_chance.json @@ -2,40 +2,17 @@ "$id": "blockception.minecraft.behavior.condition.random_regional_difficulty_chance", "type": "object", "additionalProperties": false, - "description": "Sets a Maximum regional difficulty random chance of the specified value.", + "description": "Passes with a probability scaled by the world's regional difficulty multiplier. The regional difficulty is based on dimension, world difficulty and moon brightness.", "title": "Random Regional Difficulty Chance", "properties": { - "condition": { "type": "string", "title": "Condition", "description": "UNDOCUMENTED.", "$comment": "UNDOCUMENTED" }, - "default_chance": { + "condition": { "const": "random_regional_difficulty_chance" }, + "max_chance": { "type": "number", - "default": 0, - "description": "The default random chance if the level difficulty is not assigned.", - "title": "Default Chance" - }, - "max_chance": { "title": "Maximum Chance", "type": "number", "description": "UNDOCUMENTED.", "$comment": "UNDOCUMENTED" }, - "easy": { - "type": "number", - "default": 0, - "description": "The default random chance if the level difficulty is in easy. Omitting this field will set the value to `default_chance` field.", - "title": "Easy" - }, - "hard": { - "type": "number", - "default": 0, - "description": "The default random chance if the level difficulty is in hard. Omitting this field will set the value to `default_chance` field.", - "title": "Hard" - }, - "normal": { - "type": "number", - "default": 0, - "description": "The default random chance if the level difficulty is in normal. Omitting this field will set the value to `default_chance` field.", - "title": "Normal" - }, - "peaceful": { - "type": "number", - "default": 0, - "description": "The default random chance if the level difficulty is in peaceful. Omitting this field will set the value to `default_chance` field.", - "title": "Peaceful" + "description": "Base probability (0-1) before scaling by the regional difficulty multiplier.", + "minimum": 0, + "maximum": 1, + "default": 0 } - } + }, + "required": ["condition"] } diff --git a/source/behavior/loot_tables/functions.json b/source/behavior/loot_tables/functions.json index 6c03aaf9..3e20098b 100644 --- a/source/behavior/loot_tables/functions.json +++ b/source/behavior/loot_tables/functions.json @@ -26,9 +26,11 @@ "set_damage", "set_data_from_color_index", "set_data", + "set_ominous_bottle_amplifier", "set_lore", "set_name", "set_potion", + "set_stew_effect", "specific_enchants", "trader_material_type", "minecraft:enchant_book_for_trading", @@ -50,9 +52,11 @@ "minecraft:set_damage", "minecraft:set_data_from_color_index", "minecraft:set_data", + "minecraft:set_ominous_bottle_amplifier", "minecraft:set_lore", "minecraft:set_name", "minecraft:set_potion", + "minecraft:set_stew_effect", "minecraft:specific_enchants", "minecraft:trader_material_type" ] @@ -66,7 +70,10 @@ }, "allOf": [ { "if": { "properties": { "function": { "type": "string", "pattern": "^(minecraft:)*enchant_random_gear$" } } }, "then": { "$ref": "./functions/enchant_random_gear.json" } }, - { "if": { "properties": { "function": { "type": "string", "pattern": "^(minecraft:)*enchant_book_for_trading$" } } }, "then": { "$ref": "./functions/enchant_book_for_trading.json" } }, + { + "if": { "properties": { "function": { "type": "string", "pattern": "^(minecraft:)*enchant_book_for_trading$" } } }, + "then": { "$ref": "./functions/enchant_book_for_trading.json" } + }, { "if": { "properties": { "function": { "type": "string", "pattern": "^(minecraft:)*enchant_randomly$" } } }, "then": { "$ref": "./functions/enchant_randomly.json" } }, { "if": { "properties": { "function": { "type": "string", "pattern": "^(minecraft:)*enchant_with_levels$" } } }, "then": { "$ref": "./functions/enchant_with_levels.json" } }, { "if": { "properties": { "function": { "type": "string", "pattern": "^(minecraft:)*exploration_map$" } } }, "then": { "$ref": "./functions/exploration_map.json" } }, @@ -82,7 +89,15 @@ { "if": { "properties": { "function": { "type": "string", "pattern": "^(minecraft:)*set_count$" } } }, "then": { "$ref": "./functions/set_count.json" } }, { "if": { "properties": { "function": { "type": "string", "pattern": "^(minecraft:)*set_damage$" } } }, "then": { "$ref": "./functions/set_damage.json" } }, { "if": { "properties": { "function": { "type": "string", "pattern": "^(minecraft:)*set_data$" } } }, "then": { "$ref": "./functions/set_data.json" } }, - { "if": { "properties": { "function": { "type": "string", "pattern": "^(minecraft:)*set_data_from_color_index$" } } }, "then": { "$ref": "./functions/set_data_from_color_index.json" } }, + { + "if": { "properties": { "function": { "type": "string", "pattern": "^(minecraft:)*set_data_from_color_index$" } } }, + "then": { "$ref": "./functions/set_data_from_color_index.json" } + }, + { + "if": { "properties": { "function": { "type": "string", "pattern": "^(minecraft:)*set_ominous_bottle_amplifier$" } } }, + "then": { "$ref": "./functions/set_ominous_bottle_amplifier.json" } + }, + { "if": { "properties": { "function": { "type": "string", "pattern": "^(minecraft:)*set_stew_effect$" } } }, "then": { "$ref": "./functions/set_stew_effect.json" } }, { "if": { "properties": { "function": { "type": "string", "pattern": "^(minecraft:)*trader_material_type$" } } }, "then": { "$ref": "./functions/trader_material_type.json" } }, { "if": { "properties": { "function": { "type": "string", "pattern": "^(minecraft:)*random_dye$" } } }, "then": { "$ref": "./functions/random_dye.json" } }, { "if": { "properties": { "function": { "type": "string", "pattern": "^(minecraft:)*set_lore$" } } }, "then": { "$ref": "./functions/set_lore.json" } }, diff --git a/source/behavior/loot_tables/functions/set_count.json b/source/behavior/loot_tables/functions/set_count.json index 0b3a04dd..3d6852c0 100644 --- a/source/behavior/loot_tables/functions/set_count.json +++ b/source/behavior/loot_tables/functions/set_count.json @@ -20,7 +20,7 @@ }, "count": { "title": "Count", - "oneOf": [{ "type": "integer" }, { "type": "object", "properties": { "min": { "type": "integer", "title": "Minimum" }, "max": { "type": "integer", "title": "Maximum" } } }], + "$ref": "../../../general/int_or_range.json", "description": "UNDOCUMENTED.", "$comment": "UNDOCUMENTED" } diff --git a/source/behavior/loot_tables/functions/set_damage.json b/source/behavior/loot_tables/functions/set_damage.json index 5464c540..1f37a1df 100644 --- a/source/behavior/loot_tables/functions/set_damage.json +++ b/source/behavior/loot_tables/functions/set_damage.json @@ -22,16 +22,7 @@ "description": "UNDOCUMENTED.", "$comment": "UNDOCUMENTED", "title": "Damage", - "oneOf": [ - { "type": "number", "minimum": 0, "maximum": 1 }, - { - "type": "object", - "properties": { - "min": { "type": "number", "description": "UNDOCUMENTED.", "$comment": "UNDOCUMENTED", "title": "Minimum", "minimum": 0, "maximum": 1 }, - "max": { "type": "number", "description": "UNDOCUMENTED.", "$comment": "UNDOCUMENTED", "title": "Maximum", "minimum": 0, "maximum": 1 } - } - } - ] + "$ref": "../../../general/int_or_range.json" } } } diff --git a/source/behavior/loot_tables/functions/set_data.json b/source/behavior/loot_tables/functions/set_data.json index fb123f89..73d212a2 100644 --- a/source/behavior/loot_tables/functions/set_data.json +++ b/source/behavior/loot_tables/functions/set_data.json @@ -10,16 +10,7 @@ "title": "Data", "description": "UNDOCUMENTED.", "$comment": "UNDOCUMENTED", - "oneOf": [ - { "type": "integer" }, - { - "type": "object", - "properties": { - "min": { "type": "integer", "title": "Minimum", "description": "UNDOCUMENTED.", "$comment": "UNDOCUMENTED" }, - "max": { "type": "integer", "title": "Maximum", "description": "UNDOCUMENTED.", "$comment": "UNDOCUMENTED" } - } - } - ] + "$ref": "../../../general/int_or_range.json" } } } diff --git a/source/behavior/loot_tables/functions/set_ominous_bottle_amplifier.json b/source/behavior/loot_tables/functions/set_ominous_bottle_amplifier.json new file mode 100644 index 00000000..df3835ce --- /dev/null +++ b/source/behavior/loot_tables/functions/set_ominous_bottle_amplifier.json @@ -0,0 +1,15 @@ +{ + "$id": "blockception.minecraft.behavior.function.set_ominous_bottle_amplifier", + "type": "object", + "title": "Set Ominous Bottle Amplifier", + "description": "Configures the amplifier value applied to the ominous bottle item.", + "additionalProperties": false, + "required": ["function", "amplifier"], + "properties": { + "function": { "const": "set_ominous_bottle_amplifier" }, + "amplifier": { + "description": "Amplifier value or range to apply.", + "$ref": "../../../general/int_or_range.json" + } + } +} diff --git a/source/behavior/loot_tables/functions/set_stew_effect.json b/source/behavior/loot_tables/functions/set_stew_effect.json new file mode 100644 index 00000000..5d695a69 --- /dev/null +++ b/source/behavior/loot_tables/functions/set_stew_effect.json @@ -0,0 +1,31 @@ +{ + "$id": "blockception.minecraft.behavior.function.set_stew_effect", + "type": "object", + "title": "Set Stew Effect", + "description": "Configures suspicious stew status effects.", + "additionalProperties": false, + "required": ["function", "effects"], + "properties": { + "function": { "const": "set_stew_effect" }, + "effects": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "additionalProperties": false, + "required": ["id"], + "properties": { + "id": { + "type": "integer", + "description": "Numeric effect identifier." + }, + "duration": { + "type": "integer", + "minimum": 0, + "description": "Optional duration in ticks for the effect." + } + } + } + } + } +} diff --git a/source/behavior/loot_tables/loot_tables.json b/source/behavior/loot_tables/loot_tables.json index 26438906..3931cf9f 100644 --- a/source/behavior/loot_tables/loot_tables.json +++ b/source/behavior/loot_tables/loot_tables.json @@ -21,18 +21,7 @@ "rolls": { "title": "Rolls", "description": "Determines how many items, will be selected.", - "$comment": "UNDOCUMENTED", - "oneOf": [ - { "type": "integer", "minimum": 0 }, - { - "type": "object", - "required": ["min", "max"], - "properties": { - "min": { "title": "Minimum", "type": "number", "minimum": 0, "description": "The minimum amount." }, - "max": { "title": "Maximum", "type": "number", "minimum": 1, "description": "The maximum amount." } - } - } - ] + "$ref": "../../general/int_or_range.json" }, "type": { "title": "Type", @@ -73,7 +62,7 @@ "title": "Count", "description": "The amount of the item." }, - "name": { "title": "Name", "type": "string", "description": "An item or loottable.", "pattern": "^(?:[\\w]+:|loot_tables\/)?[\\w]+(?:\/[\\w]+)*$" }, + "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/int_or_range.json b/source/general/int_or_range.json new file mode 100644 index 00000000..dd69c55b --- /dev/null +++ b/source/general/int_or_range.json @@ -0,0 +1,16 @@ +{ + "$id": "Integer or Range", + "description": "An integer value or inclusive range.", + "oneOf": [ + { "type": "integer" }, + { + "type": "object", + "additionalProperties": false, + "required": ["min", "max"], + "properties": { + "min": { "type": "integer", "description": "Minimum value." }, + "max": { "type": "integer", "description": "Maximum value." } + } + } + ] +}