diff --git a/js/view.js b/js/view.js index 501dadfb..a7992a8d 100644 --- a/js/view.js +++ b/js/view.js @@ -348,6 +348,15 @@ function generateArray(data, struct) { function generateObject(data, struct, options) { let out = {}; + if (struct.id === 'condition' && data.condition === 'minecraft:requirements') { + out = { + condition: "minecraft:inverted", + term: { + condition: "minecraft:alternative", + terms: [] + } + }; + } let $el = $('
').addClass('mt-3'); let $header = $(''); let $body = $(''); @@ -407,7 +416,18 @@ function generateObject(data, struct, options) { ({out: outValue, component: $field} = generateError('Failed generating "' + field.id + '" field')); } if ($field !== false) { - out[field.id] = outValue; + if (struct.id === 'condition' && data.condition === 'minecraft:requirements') { + if (field.id === 'terms' && outValue) { + for (let term of outValue) { + out.term.terms.push({ + condition: 'minecraft:inverted', + term: term + }); + } + } + } else { + out[field.id] = outValue; + } if (field.type === 'array') { let color = field.color || components.find(e => e.id === field.values).color; let $button = $(''); diff --git a/locales/en.json b/locales/en.json index 16067697..940bbf9e 100644 --- a/locales/en.json +++ b/locales/en.json @@ -51,18 +51,19 @@ "condition.time_value": "Value", "condition.time_period": "Period", "condition.type": "Condition", - "condition.type.alternative": "Alternative", + "condition.type.alternative": "Alternative (OR)", "condition.type.block_state_property": "Block Properties", "condition.type.damage_source_properties": "Damage Source", "condition.type.entity_properties": "Entity Properties", "condition.type.entity_scores": "Entity Scores", - "condition.type.inverted": "Inverted", + "condition.type.inverted": "Inverted (NOT)", "condition.type.killed_by_player": "Killed by Player", "condition.type.location_check": "Location", "condition.type.match_tool": "Tool Properties", "condition.type.random_chance": "Random Chance", "condition.type.random_chance_with_looting": "Random Chance with Looting", "condition.type.reference": "Reference", + "condition.type.requirements": "Requirements (AND)", "condition.type.survives_explosion": "Survives Explosion", "condition.type.table_bonus": "Table Bonus", "condition.type.time_check": "Time", diff --git a/schemas/1.15.json b/schemas/1.15.json index bf02b492..81aad8c1 100644 --- a/schemas/1.15.json +++ b/schemas/1.15.json @@ -645,6 +645,7 @@ "default": "minecraft:random_chance", "values": [ "minecraft:alternative", + "minecraft:requirements", "minecraft:inverted", "minecraft:reference", "minecraft:entity_properties", @@ -872,7 +873,8 @@ "values": "condition", "button": "field", "require": [ - "minecraft:alternative" + "minecraft:alternative", + "minecraft:requirements" ] } ]