mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-26 16:35:39 +00:00
22
js/view.js
22
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 = $('<div/>').addClass('mt-3');
|
||||
let $header = $('<div/>');
|
||||
let $body = $('<div/>');
|
||||
@@ -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 = $('<button type="button" class="btn btn-' + color + ' mr-3" onclick="addComponent(this, \'' + field.id + '\')" data-i18n="' + field.translate + '_add"></button>');
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user