From 56c867e73669df31e7f967bd4ed74d8e899dc9dc Mon Sep 17 00:00:00 2001 From: Misode Date: Fri, 21 Jun 2019 23:05:10 +0200 Subject: [PATCH 01/44] First validation functions --- validate.js | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 validate.js diff --git a/validate.js b/validate.js new file mode 100644 index 00000000..7b1865a0 --- /dev/null +++ b/validate.js @@ -0,0 +1,65 @@ + +function isString(data) { + return data && typeof data === 'string'; +} + +function isNumber(var) { + return data && typeof data === 'number'; +} + +function isObject(var) { + return data && typeof data === 'object'; +} + +function isArray(var) { + return data && typeof data === 'object' && Array.isArray(data); +} + +function validateRange(data, default) { + if (data === undefined) return false; + if (isObject(data)) { + if (isString(data.type) && var.type.endsWith('binomial')) + if (isNumber(data.n) && isNumber(data.p)) { + return { + type: 'minecraft:binomial', + n: data.n, + p: data.p + }; + } + } + let res = {}; + if (isNumber(data.min)) res.min = data.min; + if (isNumber(data.max)) res.max = data.max; + } + } + return false; +} + +function chooseOption(options, value, default) { + for (option of options) { + if (value === option) { + return value; + } else if('minecraft:' + value === option) { + return 'minecraft:' + value; + } + } + return default; +} + +function validateTable(table) { + let res = {}; + res.type = chooseOption(namespace(['empty', 'entity', 'block', 'chest', 'fishing', 'generic']), table.type, 'minecraft:generic'); + if (isArray(table.pools)) { + res.pools = []; + for (let entry of table.pools) { + res.pools.push(validatePool(pools)); + } + } + return res; +} + +function validatePool() { + let newpool = {}; + + return res; +} From 16e7d37ffc8982386c19a6f61305c276b31723ca Mon Sep 17 00:00:00 2001 From: Misode Date: Wed, 11 Sep 2019 00:09:25 +0200 Subject: [PATCH 02/44] Preparations for structure abstraction --- index.html | 46 +++++++++++++ structure.json | 182 +++++++++++++++++++++++++++++++++++++++++++++++++ validate.js | 41 ++++++----- 3 files changed, 252 insertions(+), 17 deletions(-) create mode 100644 structure.json diff --git a/index.html b/index.html index 854fd8f6..54e4ca6c 100644 --- a/index.html +++ b/index.html @@ -74,6 +74,51 @@
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ + + +
+ + + + + + + + + +
+
+
+ +
+
+ + +
+
+
+
@@ -1002,6 +1047,7 @@ + diff --git a/structure.json b/structure.json new file mode 100644 index 00000000..dc43d9a5 --- /dev/null +++ b/structure.json @@ -0,0 +1,182 @@ +{ + "root": { + "fields": [ + { + "id": "type", + "type": "enum", + "values": [ + "minecraft:empty", + "minecraft:entity", + "minecraft:block", + "minecraft:chest", + "minecraft:fishing", + "minecraft:generic" + ], + "default": "minecraft:generic" + }, + { + "id": "pools", + "type": "array", + "values": "pool" + } + ] + }, + "components": [ + { + "id": "pool", + "type": "object", + "class": "card bg-success", + "default": { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:stone" + } + ] + }, + "fields": [ + { + "id": "rolls", + "type": "range", + "default": 1 + }, + { + "id": "bonus_rolls", + "type": "number", + "default": 1 + }, + { + "id": "entries", + "type": "array", + "values": "entry" + }, + { + "id": "conditions", + "type": "array", + "values": "condition" + } + ] + }, + { + "id": "entry", + "type": "object", + "class": "card", + "default": { + "type": "minecraft:item", + "name": "minecraft:stone" + }, + "fields": [ + { + "id": "type", + "type": "enum", + "values": [ + "minecraft:empty", + "minecraft:item", + "minecraft:tag", + "minecraft:loot_table", + "minecraft:alternatives", + "minecraft:sequence", + "minecraft:group", + "minecraft:dynamic" + ], + "default": "minecraft:item" + }, + { + "id": "name", + "type": "string", + "default": "minecraft:stone", + "require": [ + "minecraft:item", + "minecraft:tag", + "minecraft:loot_table", + "minecraft:dynamic" + ] + }, + { + "id": "children", + "type": "array", + "values": "entry", + "require": [ + "minecraft:alternatives", + "minecraft:sequence", + "minecraft:group" + ] + }, + { + "id": "functions", + "type": "array", + "values": "function" + }, + { + "id": "conditions", + "type": "array", + "values": "condition" + } + ] + }, + { + "id": "function", + "type": "object", + "class": "card bg-info", + "default": { + "function": "minecraft:set_count", + "count": 2 + }, + "fields": [ + { + "id": "function", + "type": "enum", + "values": [ + "minecraft:set_count", + "minecraft:set_damage", + "minecraft:set_name", + "minecraft:set_lore", + "minecraft:set_nbt", + "minecraft:set_attributes", + "minecraft:set_contents", + "minecraft:enchant_randomly", + "minecraft:enchant_with_levels", + "minecraft:looting_enchant", + "minecraft:limit_count", + "minecraft:furnace_smelt", + "minecraft:explosion_decay", + "minecraft:fill_player_head", + "minecraft:copy_name", + "minecraft:copy_nbt", + "minecraft:apply_bonus" + ], + "default": "set_count" + }, + { + "id": "count", + "type": "range", + "default": 2, + "require": [ + "minecraft:set_count" + ] + }, + { + "id": "damage", + "type": "range", + "default": 1, + "require": [ + "minecraft:set_damage" + ] + } + ] + }, + { + "id": "condition", + "type": "object", + "card": true, + "default": { + "condition": "minecraft:random_chance", + "chance": 0.5 + }, + "fields": [ + + ] + } + ] +} diff --git a/validate.js b/validate.js index 7b1865a0..d2e0ce48 100644 --- a/validate.js +++ b/validate.js @@ -1,24 +1,24 @@ function isString(data) { - return data && typeof data === 'string'; + return data != undefined && typeof data === 'string'; } -function isNumber(var) { - return data && typeof data === 'number'; +function isNumber(data) { + return data != undefined && typeof data === 'number'; } -function isObject(var) { - return data && typeof data === 'object'; +function isObject(data) { + return data != undefined && typeof data === 'object' && !Array.isArray(data); } -function isArray(var) { - return data && typeof data === 'object' && Array.isArray(data); +function isArray(data) { + return data != undefined && typeof data === 'object' && Array.isArray(data); } -function validateRange(data, default) { +function validateRange(data) { if (data === undefined) return false; if (isObject(data)) { - if (isString(data.type) && var.type.endsWith('binomial')) + if (isString(data.type) && data.type.endsWith('binomial')) { if (isNumber(data.n) && isNumber(data.p)) { return { type: 'minecraft:binomial', @@ -30,12 +30,11 @@ function validateRange(data, default) { let res = {}; if (isNumber(data.min)) res.min = data.min; if (isNumber(data.max)) res.max = data.max; - } } return false; } -function chooseOption(options, value, default) { +function chooseOption(options, value, def) { for (option of options) { if (value === option) { return value; @@ -43,23 +42,31 @@ function chooseOption(options, value, default) { return 'minecraft:' + value; } } - return default; + return def; +} + +function namespace(list) { + let res = []; + for (let item of list) { + res.push('minecraft:' + item); + } + return res; } function validateTable(table) { let res = {}; res.type = chooseOption(namespace(['empty', 'entity', 'block', 'chest', 'fishing', 'generic']), table.type, 'minecraft:generic'); + res.pools = []; if (isArray(table.pools)) { - res.pools = []; - for (let entry of table.pools) { - res.pools.push(validatePool(pools)); + for (let pool of table.pools) { + res.pools.push(validatePool(pool)); } } return res; } function validatePool() { - let newpool = {}; - + let res = {}; + res return res; } From 9fb7f213112526636e77c7936a4a36644051b392 Mon Sep 17 00:00:00 2001 From: Misode Date: Thu, 12 Sep 2019 02:29:16 +0200 Subject: [PATCH 03/44] Read structure when invalidated --- index.html | 33 ++++++--- model.js | 98 ++++++++----------------- structure.json | 40 +++++++---- view.js | 189 +++++++++++++++++++++++++++++++++++++++++++------ 4 files changed, 248 insertions(+), 112 deletions(-) diff --git a/index.html b/index.html index 54e4ca6c..dff64bc4 100644 --- a/index.html +++ b/index.html @@ -44,7 +44,7 @@
-
+
@@ -75,22 +75,22 @@
-
+
- +
-
+
- +
-
+
- + -
+
- + + + +
+ + + + + +
+
+
+
diff --git a/model.js b/model.js index 10148024..493d075f 100644 --- a/model.js +++ b/model.js @@ -8,10 +8,19 @@ let indentation = 2; let luck_based = false; let table = { type: "minecraft:generic", - pools: [] + pools: [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:stone" + } + ] + } + ] }; -addPool(); -addEntry($('#structure .pool').get()); +invalidated(); const params = new URLSearchParams(window.location.search); if (params.has('q')) { @@ -156,60 +165,24 @@ function getIndex(el) { return parseInt($parent.attr('data-index')); } -function addPool(el) { - if (!table.pools) { - table.pools = []; - } - table.pools.push({ - rolls: 1 - }); - invalidated(); -} - -function addEntry(el) { - let pool = getParent(el); - if (!pool.entries) { - pool.entries = []; - } - pool.entries.push({ - type: "minecraft:item", - name: "minecraft:stone" - }); - invalidated(); -} - -function addChild(el) { - let entry = getParent(el); - if (!entry.children) { - entry.children = []; - } - entry.children.push({ - type: "minecraft:item", - name: "minecraft:stone" - }); - invalidated(); -} - -function addFunction(el) { - let entry = getParent(el); - if (!entry.functions) { - entry.functions = []; - } - entry.functions.push({ - function: "minecraft:set_count" - }); - invalidated(); -} - -function addCondition(el) { +function addComponent(el, array) { let parent = getParent(el); - if (!parent.conditions) { - parent.conditions = []; + if (!parent[array]) { + parent[array] = []; + } + parent[array].push({}); + invalidated(); +} + +function removeComponent(el) { + let node = getSuperParent(el); + let $field = $(el).closest('[data-field]'); + let index = $field.attr('data-index'); + let last = $field.attr('data-field').slice(0, -2); + node[last].splice(index, 1); + if (node[last].length === 0) { + delete node[last]; } - parent.conditions.push({ - condition: "minecraft:random_chance", - chance: 0.5 - }); invalidated(); } @@ -244,7 +217,7 @@ function updateField(el) { } } else if (type === 'json') { value = parseJSONValue(value) - } else if (type === 'range') { + } else if (type === 'range' || type === 'random') { value = getRangeValue($field, node[field]); } else if (type === 'checkbox') { value = $(el).prop('checked'); @@ -259,22 +232,11 @@ function updateField(el) { invalidated(); } -function removeField(el) { - let node = getSuperParent(el); - let $field = $(el).closest('[data-field]'); - let index = $field.attr('data-index'); - let last = $field.attr('data-field').slice(0, -2); - node[last].splice(index, 1); - if (node[last].length === 0) { - delete node[last]; - } - invalidated(); -} - function updateRangeType(el) { let $field = $(el).closest('[data-field]'); let field = $field.attr('data-field'); let type = $(el).attr('value'); + console.log('update range type!!', type, field); if (type === 'range') { setField(getParent(el), field, {}); } else if (type === 'binomial') { diff --git a/structure.json b/structure.json index dc43d9a5..86a9f039 100644 --- a/structure.json +++ b/structure.json @@ -25,7 +25,7 @@ { "id": "pool", "type": "object", - "class": "card bg-success", + "color": "success", "default": { "rolls": 1, "entries": [ @@ -38,30 +38,33 @@ "fields": [ { "id": "rolls", - "type": "range", + "type": "random", "default": 1 }, { "id": "bonus_rolls", - "type": "number", - "default": 1 + "type": "random", + "default": 1, + "luck_based": true }, { "id": "entries", "type": "array", - "values": "entry" + "values": "entry", + "button": "header" }, { "id": "conditions", "type": "array", - "values": "condition" + "values": "condition", + "button": "header" } ] }, { "id": "entry", "type": "object", - "class": "card", + "color": "light", "default": { "type": "minecraft:item", "name": "minecraft:stone" @@ -70,6 +73,7 @@ { "id": "type", "type": "enum", + "source": "entry", "values": [ "minecraft:empty", "minecraft:item", @@ -97,6 +101,7 @@ "id": "children", "type": "array", "values": "entry", + "button": "field", "require": [ "minecraft:alternatives", "minecraft:sequence", @@ -106,19 +111,21 @@ { "id": "functions", "type": "array", - "values": "function" + "values": "function", + "button": "header" }, { "id": "conditions", "type": "array", - "values": "condition" + "values": "condition", + "button": "header" } ] }, { "id": "function", "type": "object", - "class": "card bg-info", + "color": "secondary", "default": { "function": "minecraft:set_count", "count": 2 @@ -127,6 +134,7 @@ { "id": "function", "type": "enum", + "source": "function", "values": [ "minecraft:set_count", "minecraft:set_damage", @@ -150,7 +158,7 @@ }, { "id": "count", - "type": "range", + "type": "random", "default": 2, "require": [ "minecraft:set_count" @@ -158,18 +166,24 @@ }, { "id": "damage", - "type": "range", + "type": "random", "default": 1, "require": [ "minecraft:set_damage" ] + }, + { + "id": "conditions", + "type": "array", + "values": "condition", + "button": "header" } ] }, { "id": "condition", "type": "object", - "card": true, + "color": "info", "default": { "condition": "minecraft:random_chance", "chance": 0.5 diff --git a/view.js b/view.js index 86f4a684..1a3c5491 100644 --- a/view.js +++ b/view.js @@ -1,17 +1,75 @@ +let structure; +let components; + +$.getJSON('structure.json', json => { + structure = json.root; + components = json.components; + invalidated(); +}); function invalidated() { - generateStructure(); + if (structure) { + generateTable(); + if (i18next.isInitialized) { + $('html').localize(); + } + } $('#source').val(JSON.stringify(table, null, indentation)); } -function preventNewline(e) { - if (e.which === 13) { - $(e.target).trigger('change'); - e.preventDefault(); +function generateTable() { + $('#structure').removeClass('d-none').html(''); + + if (!table.type) { + table.type = 'minecraft:empty'; + } + $('#tableType').val(table.type); + + if (table.pools) { + $table = generateComponent(table.pools, structure.fields.find(e => e.id === 'pools')); + $('#structure').append($table); + } + + $('#luck-based').attr('checked', luck_based); + +} + +function generateComponent(data, struct) { + switch (struct.type) { + case 'string': return generateString(data, struct); + case 'boolean': return generateBoolean(data, struct); + case 'random': return generateRandom(data, struct); + case 'range': return generateRange(data, struct); + case 'enum': return generateEnum(data, struct); + case 'array': return generateArray(data, struct); + case 'object': return generateObject(data, struct); } } -function generateRange($el, data) { +function generateString(data, struct) { + let $el = $('#components').find('[data-type="string"]').clone(); + $el.attr('data-field', struct.id); + $el.find('[data-name]').attr('data-i18n', struct.id); + $el.find('input').val(data); + return $el; +} + +function generateBoolean(data, struct) { + let $el = $('#components').find('[data-type="boolean"]').clone(); + $el.attr('data-field', struct.id); + $el.find('[data-name]').attr('data-i18n', struct.id); + if (data === true) { + $el.find('[value="true"]').addClass('active'); + } else if (data === false) { + $el.find('[value="false"]').addClass('active'); + } + return $el; +} + +function generateRandom(data, struct) { + let $el = $('#components').find('[data-type="random"]').clone(); + $el.attr('data-field', struct.id); + $el.find('[data-name]').attr('data-i18n', struct.id); if (typeof data === 'object') { if (data.type && data.type.match(/(minecraft:)?binomial/)) { $el.find('.binomial').removeClass('d-none'); @@ -26,34 +84,88 @@ function generateRange($el, data) { $el.find('.exact').removeClass('d-none'); $el.find('.exact').val(data); } + return $el; } -function generateRadio($el, data) { - if (data === true) { - $el.find('[value="true"]').addClass('active'); - } else if (data === false) { - $el.find('[value="false"]').addClass('active'); +function generateRange(data, struct) { + let $el = $('#components').find('[data-type="range"]').clone(); + $el.attr('data-field', struct.id); + $el.find('[data-name]').attr('data-i18n', struct.id); + if (typeof data === 'object') { + $el.find('.range').removeClass('d-none'); + $el.find('.range.min').val(data.min); + $el.find('.range.max').val(data.max); + } else { + $el.find('.exact').removeClass('d-none'); + $el.find('.exact').val(data); } + return $el; } -function generateStructure() { - $('#structure').html(''); - - if (!table.type) { - table.type = 'minecraft:empty'; +function generateEnum(data, struct) { + let $el = $('#components').find('[data-type="enum"]').clone(); + $el.attr('data-field', struct.id); + $el.find('[data-name]').attr('data-i18n', struct.id); + for (let option of struct.values) { + $('
@@ -122,23 +122,23 @@
- + - +
- + - +
diff --git a/locales/en.json b/locales/en.json index 39004de9..cdedd068 100644 --- a/locales/en.json +++ b/locales/en.json @@ -1,33 +1,54 @@ { "$condition": { - "alternative": "Alternative", + "$type": { + "alternative": "Alternative", + "inverted": "Inverted", + "entity_properties": "Entity Properties", + "block_state_propery": "Block Properties", + "match_tool": "Tool Properties", + "damage_source_properties": "Damage Source", + "location_check": "Location", + "weather_check": "Weather", + "entity_scores": "Entity Scores", + "random_chance": "Random Chance", + "random_chance_with_looting": "Random Chance with Looting", + "table_bonus": "Table Bonus", + "killed_by_player": "Killed by Player", + "survives_explosion": "Survives Explosion" + }, + "type": "Condition", + "chance": "Chance", + "looting_multiplier": "Looting Multiplier", "inverted": "Inverted", - "entity_properties": "Entity Properties", - "block_state_propery": "Block Properties", - "match_tool": "Tool Properties", - "damage_source_properties": "Damage Source", - "location_check": "Location", - "weather_check": "Weather", - "entity_scores": "Entity Scores", - "random_chance": "Random Chance", - "random_chance_with_looting": "Random Chance with Looting", - "table_bonus": "Table Bonus", - "killed_by_player": "Killed by Player", - "survives_explosion": "Survives Explosion" + "entity": "Entity", + "enchantment": "Enchantment", + "chances": "Chances", + "raining": "Raining", + "thundering": "Thundering", + "block": "Block", + "block_state": "Block State", + "block_state_add": "Add Block State", + "block_state_remove": "Remove Block State", + "objective": "Objective", + "score": "Score", + "score_add": "Add Score", + "score_remove": "Remove Score", + "location": "Location", + "item": "Item", + "damage_source": "Damage Source", + "term": "Term" }, - "$damage": { - "damage_type": "Damage Type", - "projectile": "Projectile", - "explosion": "Explosion", - "fire": "Fire", - "magic": "Magic", - "lightning": "Lightning", - "starvation": "Starvation", - "void": "Void", - "bypass_armor": "Bypass Armor", - "dealt": "Dealt", - "taken": "Taken", - "blocked": "Blocked" + "$damage_source": { + "is_projectile": "Projectile", + "is_explosion": "Explosion", + "is_fire": "Fire", + "is_magic": "Magic", + "is_lightning": "Lightning", + "bypasses_magic": "Starvation", + "bypasses_invulnerability": "Void", + "bypasses_armor": "Bypass Armor", + "direct_entity": "Direct Entity", + "source_entity": "Source Entity" }, "$dimension": { "overworld": "Overworld", @@ -74,8 +95,6 @@ "unbreaking": "Unbreaking" }, "$entry": { - "name": "Name", - "type": "Type", "$type": { "empty": "Empty", "item": "Item", @@ -86,67 +105,78 @@ "group": "Group", "dynamic": "Dynamic" }, + "type": "Type", + "name": "Name", "expand": "Expand", "weight": "Weight", "quality": "Quality" }, "$function": { - "set_count": "Set Count", - "set_damage": "Set Damage", - "set_name": "Set Name", - "set_lore": "Set Lore", - "set_nbt": "Set NBT", - "set_attributes": "Set Attributes", - "set_contents": "Set Contents", - "enchant_randomly": "Enchant Randomly", - "enchant_with_levels": "Enchant With Levels", - "looting_enchant": "Looting Enchant", - "limit_count": "Limit Count", - "furnace_smelt": "Furnace Smelt", - "explosion_decay": "Explosion Decay", - "fill_player_head": "Fill Player Head", - "copy_name": "Copy Name", - "copy_nbt": "Copy NBT", - "apply_bonus": "Apply Bonus", - "$damage": { - "damage": "Damage" - }, - "$ench_rand": { - "ench": "Optional Enchantments" - }, - "$limit": { - "limit": "Limit" - }, - "$name": { - "name": "Name" - }, - "$lore_replace": { - "replace": "Replace" - }, - "$entity": { - "entity": "Entity" - }, - "$operations": { - "add_op": "Add Operation" + "$type": { + "set_count": "Set Count", + "set_damage": "Set Damage", + "set_name": "Set Name", + "set_lore": "Set Lore", + "set_nbt": "Set NBT", + "set_attributes": "Set Attributes", + "set_contents": "Set Contents", + "enchant_randomly": "Enchant Randomly", + "enchant_with_levels": "Enchant With Levels", + "looting_enchant": "Looting Enchant", + "limit_count": "Limit Count", + "furnace_smelt": "Furnace Smelt", + "explosion_decay": "Explosion Decay", + "fill_player_head": "Fill Player Head", + "copy_name": "Copy Name", + "copy_nbt": "Copy NBT", + "apply_bonus": "Apply Bonus" }, + "type": "Function", + "count": "Count", + "damage": "Damage", + "name": "Name", + "lore": "Lore", + "nbt": "NBT", + "levels": "Levels", + "treasure": "Treasure", + "limit": "Limit", + "entity": "Entity", + "source": "Source", + "replace": "Replace", + "enchantments": "Optional Enchantments", + "operation_add": "Add Operation", + "enchantment": "Enchantment", + "formula": "Formula", "$formula": { - "formula": "Formula", "uniform_bonus_count": "Uniform Bonus Count", "binomial_with_bonus_count": "Binomial with Bonus Count", "ore_drops": "Ore Drops" }, - "$bonus_multiplier": { - "multiplier": "Multiplier" + "bonusMultiplier": "Multiplier", + "extra": "Extra", + "probability": "Propability" + }, + "$attribute_modifier": { + "attribute": "Attribute", + "name": "Name", + "amount": "Amount", + "operation": "Operation", + "$operation": { + "addition": "Addition", + "multiply_base": "Multiply Base", + "multiply_total": "Multiply Total" }, - "$bonus_extra": { - "extra": "Extra" - }, - "$bonus_probability": { - "probability": "Propability" + "slots": "Slots", + "$slot": { + "mainhand": "Mainhand", + "offhand": "Offhand", + "head": "Head", + "chest": "Chest", + "legs": "Legs", + "feet": "Feet" } }, - "$modifier": { - "attribute": "Attribute", + "$attribute": { "generic_maxHealth": "Max Health", "generic_followRange": "Follow Range", "generic_knockbackResistance": "Knockback Resistance", @@ -159,18 +189,9 @@ "horse_jumpStrength": "Jump Strength", "generic_attackKnockback": "Attack Knockback", "generic_flyingSpeed": "Flying Speed", - "zombie_spawnReinforcements": "Spawn Reinforcements", - "name": "Name", - "amount": "Amount", - "operation": "Operation", - "$operation": { - "addition": "Addition", - "multiply_base": "Multiply Base", - "multiply_total": "Multiply Total" - }, - "slots": "Slots" + "zombie_spawnReinforcements": "Spawn Reinforcements" }, - "$operation": { + "$nbt_operation": { "source": "Source", "target": "Target", "operation": "Operation", @@ -187,23 +208,11 @@ "$range": { "exact": "Exact", "range": "Range", - "$range": { - "min": "Min", - "max": "Max" - }, + "min": "Min", + "max": "Max", "binomial": "Binomial", - "$binomial": { - "n": "n", - "p": "p" - } - }, - "$slot": { - "mainhand": "Mainhand", - "offhand": "Offhand", - "head": "Head", - "chest": "Chest", - "legs": "Legs", - "feet": "Feet" + "n": "n", + "p": "p" }, "$source": { "block_entity": "Block Entity", @@ -212,7 +221,6 @@ "killer_player": "Killer Player" }, "$table": { - "type": "Type", "$type": { "empty": "Empty", "entity": "Entity", @@ -220,82 +228,76 @@ "chest": "Chest", "fishing": "Fishing", "generic": "Generic" - } + }, + "type": "Type" + }, + "$entity": { + "$type": { + + }, + "type": "Entity", + "nbt": "NBT", + "location": "Location" + }, + "$location": { + "position": "Position", + "biome": "Biome", + "feature": "Feature", + "dimension": "Dimension" + }, + "$structure": { + + }, + "$dimension": { + "overworld": "Overworld", + "the_nether": "The Nether", + "the_end": "The End" + }, + "$item": { + "name": "Item ID", + "tag": "Item Tag", + "count": "Count", + "durability": "Durability", + "potion": "Potion", + "nbt": "NBT" + }, + "$biome": { + }, "2_spaces": "2 Spaces", "4_spaces": "4 Spaces", - "add_block_state": "Add Block State", - "add_child": "Add Child", - "add_condition": "Add Condition", - "add_enchantment": "Add Enchantment", - "add_entry": "Add Entry", - "add_function": "Add Function", - "add_modifier": "Add Modifier", - "add_operation": "Add Operation", - "add_pool": "Add Pool", - "add_score": "Add Score", - "add_term": "Add Term", + "child_add": "Add Child", + "condition_add": "Add Condition", + "enchantment_add": "Add Enchantment", + "entry_add": "Add Entry", + "function_add": "Add Function", + "attribute_modifier_add": "Add Modifier", + "operation_add": "Add Operation", + "pool_add": "Add Pool", + "term_add": "Add Term", "author": "by Misode", - "biome": "Biome", - "block": "Block", - "block_state": "Block State", - "chance": "Chance", - "chance_plural": "Chances", - "child": "Child", - "condition": "Condition", "copy": "Copy", - "count": "Count", "description": "Loot Table Generator for Minecraft", - "dimension": "Dimension", - "direct_entity": "Direct Entity", - "durability": "Durability", - "enchantment": "Enchantment", - "entity": "Entity", - "entry": "Entry", "false": "False", - "feature": "Feature", - "function": "Function", "hide_source": "Hide Source", - "inverted": "Inverted", - "item": "Item", - "level_plural": "Levels", - "location": "Location", - "looting_multiplier": "Looting Multiplier", "luck_based": "Luck-based", - "modifier": "Modifier", "more": "More", - "name": "Name", - "nbt": "NBT", - "objective": "Objective", - "operation": "Operation", - "pool": "Pool", - "position": "Position", - "potion": "Potion", - "raining": "Raining", "remove": "Remove", - "remove_block_state": "Remove Block State", - "remove_condition": "Remove Condition", - "remove_enchantment": "Remove Enchantment", - "remove_entry": "Remove Entry", - "remove_function": "Remove Function", - "remove_modifier": "Remove Modifier", - "remove_operation": "Remove Operation", - "remove_pool": "Remove Pool", - "remove_score": "Remove Score", - "remove_term": "Remove Term", - "score": "Score", + "condition_remove": "Remove Condition", + "enchantment_remove": "Remove Enchantment", + "entry_remove": "Remove Entry", + "function_remove": "Remove Function", + "attribute_modifier_remove": "Remove Modifier", + "operation_remove": "Remove Operation", + "pool_remove": "Remove Pool", + "term_remove": "Remove Term", "share": "Share", "show_source": "Show Source", "source": "Source", "source_entity": "Source Entity", "tabs": "Tabs", - "tag": "Tag", - "term": "Term", - "thundering": "Thundering", "title": "Loot Table Generator", - "treasure": "Treasure", "true": "True", - "type": "Type", "unset": "Unset", "x": "X", "y": "Y", diff --git a/schemas/1.14.json b/schemas/1.14.json index 10f4bc06..8a6ec707 100644 --- a/schemas/1.14.json +++ b/schemas/1.14.json @@ -4,6 +4,8 @@ { "id": "type", "type": "enum", + "translate": "$table.type", + "translateValue": "$table.$type", "default": "minecraft:generic", "values": [ "minecraft:empty", @@ -17,6 +19,7 @@ { "id": "pools", "type": "array", + "translate": "pool", "values": "pool" } ] @@ -29,22 +32,26 @@ "fields": [ { "id": "rolls", - "type": "random" + "type": "random", + "translate": "$pool.rolls" }, { "id": "bonus_rolls", "type": "random", + "translate": "$pool.bonus_rolls", "luck_based": true }, { "id": "entries", "type": "array", + "translate": "entry", "values": "entry", "button": "header" }, { "id": "conditions", "type": "array", + "translate": "condition", "values": "condition", "button": "header" } @@ -58,7 +65,8 @@ { "id": "type", "type": "enum", - "source": "entry", + "translate": "$entry.type", + "translateValue": "$entry.$type", "default": "minecraft:item", "values": [ "minecraft:empty", @@ -74,6 +82,7 @@ { "id": "name", "type": "string", + "translate": "$entry.name", "require": [ "minecraft:item", "minecraft:tag", @@ -81,14 +90,21 @@ "minecraft:dynamic" ] }, + { + "id": "weight", + "type": "random", + "translate": "$entry.weight" + }, { "id": "quality", "type": "random", + "translate": "$entry.quality", "luck_based": true }, { "id": "children", "type": "array", + "translate": "child", "values": "entry", "button": "field", "color": "success", @@ -101,12 +117,14 @@ { "id": "functions", "type": "array", + "translate": "function", "values": "function", "button": "header" }, { "id": "conditions", "type": "array", + "translate": "condition", "values": "condition", "button": "header" } @@ -120,7 +138,8 @@ { "id": "function", "type": "enum", - "source": "function", + "translate": "$function.type", + "translateValue": "$function.$type", "default": "minecraft:set_count", "values": [ "minecraft:set_count", @@ -145,6 +164,7 @@ { "id": "count", "type": "random", + "translate": "$function.count", "require": [ "minecraft:set_count", "minecraft:looting_enchant" @@ -153,6 +173,7 @@ { "id": "damage", "type": "random", + "translate": "$function.damage", "require": [ "minecraft:set_damage" ] @@ -160,6 +181,7 @@ { "id": "name", "type": "json", + "translate": "$function.name", "require": [ "minecraft:set_name" ] @@ -167,6 +189,7 @@ { "id": "lore", "type": "json-list", + "translate": "$function.lore", "require": [ "minecraft:set_lore" ] @@ -174,6 +197,7 @@ { "id": "tag", "type": "nbt", + "translate": "$function.nbt", "require": [ "minecraft:set_nbt" ] @@ -181,6 +205,7 @@ { "id": "levels", "type": "random", + "translate": "$function.levels", "require": [ "minecraft:enchant_with_levels" ] @@ -188,6 +213,7 @@ { "id": "treasure", "type": "boolean", + "translate": "$function.treasure", "default": false, "require": [ "minecraft:enchant_with_levels" @@ -196,6 +222,7 @@ { "id": "limit", "type": "int", + "translate": "$function.limit", "require": [ "minecraft:looting_enchant" ] @@ -203,6 +230,7 @@ { "id": "limit", "type": "boundary", + "translate": "$function.limit", "require": [ "minecraft:limit_count" ] @@ -210,7 +238,8 @@ { "id": "entity", "type": "enum", - "source": "source", + "translate": "$function.entity", + "translateValue": "$source", "default": "minecraft:this", "values": [ "minecraft:this", @@ -226,7 +255,8 @@ { "id": "source", "type": "enum", - "source": "source", + "translate": "$function.source", + "translateValue": "$source", "default": "minecraft:this", "values": [ "minecraft:block_entity", @@ -242,6 +272,7 @@ { "id": "replace", "type": "boolean", + "translate": "$function.replace", "require": [ "minecraft:set_lore" ] @@ -249,7 +280,8 @@ { "id": "enchantments", "type": "set", - "source": "enchantment", + "translate": "$function.enchantments", + "translateValue": "$enchantment", "values": "enchantments", "require": [ "minecraft:enchant_randomly" @@ -258,6 +290,7 @@ { "id": "modifiers", "type": "array", + "translate": "attribute_modifier", "button": "field", "values": "attribute_modifier", "require": [ @@ -267,6 +300,7 @@ { "id": "ops", "type": "array", + "translate": "$function.operation", "button": "field", "values": "nbt_operation", "require": [ @@ -276,7 +310,8 @@ { "id": "enchantment", "type": "enum", - "source": "enchantment", + "translate": "$function.enchantment", + "translateValue": "$enchantment", "values": "enchantments", "require": [ "minecraft:apply_bonus" @@ -285,6 +320,8 @@ { "id": "formula", "type": "enum", + "translate": "$function.formula", + "translateValues": "$function.$formula", "default": "minecraft:uniform_bonus_count", "values": [ "minecraft:uniform_bonus_count", @@ -298,6 +335,7 @@ { "id": "parameters.bonusMultiplier", "type": "float", + "translate": "$function.bonusMultiplier", "require": [ { "function": "minecraft:apply_bonus", @@ -308,6 +346,7 @@ { "id": "parameters.extra", "type": "int", + "translate": "$function.extra", "require": [ { "function": "minecraft:apply_bonus", @@ -318,6 +357,7 @@ { "id": "parameters.probability", "type": "float", + "translate": "$function.probability", "require": [ { "function": "minecraft:apply_bonus", @@ -328,6 +368,7 @@ { "id": "conditions", "type": "array", + "translate": "condition", "values": "condition", "button": "header" } @@ -341,7 +382,8 @@ { "id": "condition", "type": "enum", - "source": "condition", + "translate": "$condition.type", + "translateValue": "$condition.$type", "default": "minecraft:random_chance", "values": [ "minecraft:alternative", @@ -378,6 +420,7 @@ { "id": "chance", "type": "float", + "translate": "$condition.chance", "require": [ "minecraft:random_chance", "minecraft:random_chance_with_looting" @@ -386,6 +429,7 @@ { "id": "looting_multiplier", "type": "float", + "translate": "$condition.looting_multiplier", "require": [ "minecraft:random_chance_with_looting" ] @@ -393,6 +437,7 @@ { "id": "inverted", "type": "boolean", + "translate": "$condition.inverted", "default": false, "require": [ "minecraft:killed_by_player" @@ -401,6 +446,8 @@ { "id": "entity", "type": "enum", + "translate": "$condition.entity", + "translateValue": "$source", "default": "this", "values": [ "this", @@ -415,7 +462,8 @@ { "id": "enchantment", "type": "enum", - "source": "enchantment", + "translate": "$condition.enchantment", + "translateValue": "$enchantment", "values": "enchantments", "require": [ "minecraft:table_bonus" @@ -424,6 +472,7 @@ { "id": "chances", "type": "chance-list", + "translate": "$condition.chances", "require": [ "minecraft:table_bonus" ] @@ -431,6 +480,7 @@ { "id": "raining", "type": "boolean", + "translate": "$condition.raining", "require": [ "minecraft:weather_check" ] @@ -438,6 +488,7 @@ { "id": "thundering", "type": "boolean", + "translate": "$condition.thundering", "require": [ "minecraft:weather_check" ] @@ -445,6 +496,7 @@ { "id": "block", "type": "string", + "translate": "$condition.block", "require": [ "minecraft:block_state_propery" ] @@ -452,6 +504,8 @@ { "id": "properties", "type": "map", + "translate": "$condition.block_state", + "translateValue": "$condition.block_state", "values": { "type": "string" }, @@ -462,6 +516,8 @@ { "id": "scores", "type": "map", + "translate": "$condition.objective", + "translateValue": "$condition.score", "values": { "type": "range" }, @@ -472,6 +528,7 @@ { "id": "predicate", "type": "object", + "translate": "entity", "value": "entity", "require": [ "minecraft:entity_properties" @@ -480,6 +537,7 @@ { "id": "predicate", "type": "object", + "translate": "location", "value": "location", "require": [ "minecraft:location_check" @@ -488,6 +546,7 @@ { "id": "predicate", "type": "object", + "translate": "item", "value": "item", "require": [ "minecraft:match_tool" @@ -496,6 +555,7 @@ { "id": "predicate", "type": "object", + "translate": "damage_source", "value": "damage_source", "require": [ "minecraft:damage_source_properties" @@ -504,6 +564,7 @@ { "id": "term", "type": "object", + "translate": "condition", "value": "condition", "button": "field", "require": [ @@ -513,6 +574,7 @@ { "id": "terms", "type": "array", + "translate": "term", "values": "condition", "button": "field", "require": [ @@ -529,7 +591,8 @@ { "id": "attribute", "type": "enum", - "source": "attribute", + "translate": "$attribute_modifier.attribute", + "translateValue": "$attribute", "default": "generic.attackDamage", "values": [ "generic.maxHealth", @@ -549,16 +612,19 @@ }, { "id": "name", - "type": "string" + "type": "string", + "translate": "$attribute_modifier.name" }, { "id": "amount", - "type": "float" + "type": "float", + "translate": "$attribute_modifier.amount" }, { "id": "operation", "type": "enum", - "source": "modifier.operation", + "translate": "$attribute_modifier.operation", + "translateValue": "$attribute_modifier.$operation", "default": "addition", "values": [ "addition", @@ -569,6 +635,8 @@ { "id": "slots", "type": "set", + "translate": "$attribute_modifier.slots", + "translateValue": "$attribute_modifier.$slot", "values": [ "mainhand", "offhand", @@ -588,17 +656,20 @@ { "id": "source", "type": "string", + "translate": "$nbt_operation.source", "class": "code" }, { "id": "target", "type": "string", + "translate": "$nbt_operation.target", "class": "code" }, { "id": "op", "type": "enum", - "source": "operation.type", + "translate": "$nbt_operation.operation", + "translateValue": "$nbt_operation.$operation", "default": "replace", "values": [ "replace", @@ -616,17 +687,20 @@ { "id": "type", "type": "enum", - "source": "entity", + "translate": "$entity.type", + "translateValue": "$entity.$type", "unset": true, "values": "entity_types" }, { "id": "nbt", - "type": "nbt" + "type": "nbt", + "translate": "$entity.nbt" }, { "id": "location", "type": "object", + "translate": "$entity.location", "value": "location", "collapse": true } @@ -640,21 +714,24 @@ { "id": "biome", "type": "enum", - "source": "biome", + "translate": "$location.biome", + "translateValue": "$biome", "unset": true, "values": "biomes" }, { "id": "feature", "type": "enum", - "source": "structure", + "translate": "$location.feature", + "translateValue": "$structure", "unset": true, "values": "structures" }, { "id": "dimension", "type": "enum", - "source": "dimension", + "translate": "$location.dimension", + "translateValue": "$dimension", "unset": true, "values": "dimensions" } @@ -667,27 +744,33 @@ "fields": [ { "id": "name", - "type": "string" + "type": "string", + "translate": "$item.name" }, { "id": "tag", - "type": "string" + "type": "string", + "translate": "$item.tag" }, { "id": "count", - "type": "range" + "type": "range", + "translate": "$item.count" }, { "id": "durability", - "type": "range" + "type": "range", + "translate": "$item.durability" }, { "id": "potion", - "type": "string" + "type": "string", + "translate": "$item.potion" }, { "id": "nbt", - "type": "nbt" + "type": "nbt", + "translate": "$item.nbt" } ] }, @@ -697,60 +780,49 @@ "color": "dark", "fields": [ { - "id": "dealt", - "type": "range" + "id": "is_explosion", + "type": "boolean", + "translate": "$damage_source.is_explosion" }, { - "id": "taken", - "type": "range" + "id": "is_projectile", + "type": "boolean", + "translate": "$damage_source.is_projectile" }, { - "id": "blocked", - "type": "boolean" + "id": "is_fire", + "type": "boolean", + "translate": "$damage_source.is_fire" }, { - "id": "type", - "type": "object", - "color": "dark", - "collapse": true, - "fields": [ - { - "id": "is_explosion", - "type": "boolean" - }, - { - "id": "is_projectile", - "type": "boolean" - }, - { - "id": "is_fire", - "type": "boolean" - }, - { - "id": "is_lightning", - "type": "boolean" - }, - { - "id": "is_magic", - "type": "boolean" - }, - { - "id": "bypasses_magic", - "type": "boolean" - }, - { - "id": "bypasses_invulnerability", - "type": "boolean" - }, - { - "id": "bypasses_armor", - "type": "boolean" - } - ] + "id": "is_lightning", + "type": "boolean", + "translate": "$damage_source.is_lightning" + }, + { + "id": "is_magic", + "type": "boolean", + "translate": "$damage_source.is_magic" + }, + { + "id": "bypasses_magic", + "type": "boolean", + "translate": "$damage_source.bypasses_magic" + }, + { + "id": "bypasses_invulnerability", + "type": "boolean", + "translate": "$damage_source.bypasses_invulnerability" + }, + { + "id": "bypasses_armor", + "type": "boolean", + "translate": "$damage_source.bypasses_armor" }, { "id": "source_entity", "type": "object", + "translate": "$damage_source.source_entity", "color": "dark", "collapse": true, "value": "entity" @@ -758,6 +830,7 @@ { "id": "direct_entity", "type": "object", + "translate": "$damage_source.direct_entity", "color": "dark", "collapse": true, "value": "entity" diff --git a/view.js b/view.js index ea9ac43b..fa70e529 100644 --- a/view.js +++ b/view.js @@ -80,7 +80,7 @@ function generateString(data, struct) { let $el = $('#components').find('[data-type="string"]').clone(); $el.attr('data-type', struct.type); $el.attr('data-index', struct.id); - $el.find('[data-name]').attr('data-i18n', struct.id); + $el.find('[data-name]').attr('data-i18n', struct.translate); $el.find('input').val(data); return $el; } @@ -88,7 +88,7 @@ function generateString(data, struct) { function generateBoolean(data, struct) { let $el = $('#components').find('[data-type="boolean"]').clone(); $el.attr('data-index', struct.id); - $el.find('[data-name]').attr('data-i18n', struct.id); + $el.find('[data-name]').attr('data-i18n', struct.translate); if (data === true) { $el.find('[value="true"]').addClass('active'); } else if (data === false) { @@ -100,7 +100,7 @@ function generateBoolean(data, struct) { function generateRandom(data, struct) { let $el = $('#components').find('[data-type="random"]').clone(); $el.attr('data-index', struct.id); - $el.find('[data-name]').attr('data-i18n', struct.id); + $el.find('[data-name]').attr('data-i18n', struct.translate); if (typeof data === 'object') { if (data.type && data.type.match(/(minecraft:)?binomial/)) { $el.find('.binomial').removeClass('d-none'); @@ -121,7 +121,7 @@ function generateRandom(data, struct) { function generateRange(data, struct) { let $el = $('#components').find('[data-type="range"]').clone(); $el.attr('data-index', struct.id); - $el.find('[data-name]').attr('data-i18n', struct.id); + $el.find('[data-name]').attr('data-i18n', struct.translate); if (typeof data === 'object') { $el.find('.range').removeClass('d-none'); $el.find('.range.min').val(data.min); @@ -136,7 +136,7 @@ function generateRange(data, struct) { function generateBoundary(data, struct) { let $el = $('#components').find('[data-type="boundary"]').clone(); $el.attr('data-index', struct.id); - $el.find('[data-name]').attr('data-i18n', struct.id); + $el.find('[data-name]').attr('data-i18n', struct.translate); if (data) { $el.find('.range.min').val(data.min); $el.find('.range.max').val(data.max); @@ -147,7 +147,7 @@ function generateBoundary(data, struct) { function generateEnum(data, struct) { let $el = $('#components').find('[data-type="enum"]').clone(); $el.attr('data-index', struct.id); - $el.find('[data-name]').attr('data-i18n', struct.id); + $el.find('[data-name]').attr('data-i18n', struct.translate); let collection = struct.values; if (typeof struct.values === 'string') { collection = collections[struct.values]; @@ -158,10 +158,10 @@ function generateEnum(data, struct) { for (let value of collection) { if (typeof value === 'object') { if (value.require.includes(table.type)) { - $el.find('select').append(setValueAndName($('
diff --git a/locales/en.json b/locales/en.json index 4cebadc6..2f2901a3 100644 --- a/locales/en.json +++ b/locales/en.json @@ -241,6 +241,11 @@ }, "$location": { "position": "Position", + "$position": { + "x": "X", + "y": "Y", + "z": "Z" + }, "biome": "Biome", "feature": "Feature", "dimension": "Dimension" @@ -291,8 +296,5 @@ "tabs": "Tabs", "title": "Loot Table Generator", "true": "True", - "unset": "Unset", - "x": "X", - "y": "Y", - "z": "Z" + "unset": "Unset" } diff --git a/locales/ru.json b/locales/ru.json index eaf91b73..5addb7f4 100644 --- a/locales/ru.json +++ b/locales/ru.json @@ -238,6 +238,11 @@ }, "$location": { "position": "Позиция", + "$position": { + "x": "X", + "y": "Y", + "z": "Z" + }, "biome": "Биом", "feature": "Строение", "dimension": "Измерение" @@ -282,8 +287,5 @@ "tabs": "Табуляция", "title": "Генератор таблицы добычи", "true": "Да", - "unset": "Не задано", - "x": "X", - "y": "Y", - "z": "Z" + "unset": "Не задано" } diff --git a/locales/zh-CN.json b/locales/zh-CN.json index 80787a12..966ed72b 100644 --- a/locales/zh-CN.json +++ b/locales/zh-CN.json @@ -237,6 +237,11 @@ }, "$location": { "position": "位置", + "$position": { + "x": "X 坐标", + "y": "Y 坐标", + "z": "Z 坐标" + }, "biome": "生物群系", "feature": "结构", "dimension": "维度" @@ -281,8 +286,5 @@ "tabs": "Tab 缩进", "title": "战利品表生成器", "true": "是", - "unset": "未指定", - "x": "X 坐标", - "y": "Y 坐标", - "z": "Z 坐标" + "unset": "未指定" } diff --git a/model.js b/model.js index 15d2d60e..14c20ade 100644 --- a/model.js +++ b/model.js @@ -275,6 +275,7 @@ function toggleCollapseObject(el) { function updateField(el) { let path = getPath(el); + console.log(path); let $field = $(el).closest('[data-index]'); let field = path.pop(); let node = getNode(path); @@ -330,7 +331,10 @@ function updateField(el) { if (value.length === 0) { value = ''; } - } else if (type === 'range' || type === 'random') { + } else if (type === 'range' || type === 'random' || type === 'boundary') { + if (type === 'boundary' && node[field] === undefined) { + node[field] = {}; + } value = getRangeValue($field, node[field]); } else if (type === 'checkbox') { value = $(el).prop('checked'); @@ -361,6 +365,7 @@ function updateRangeType(el) { } function getRangeValue($field, data) { + console.log($field, data); if (typeof data === 'object') { if (data.type && data.type.match(/(minecraft:)?binomial/)) { let n = $field.find('.binomial.n').val(); diff --git a/schemas/1.14.json b/schemas/1.14.json index 8a6ec707..36fd7b12 100644 --- a/schemas/1.14.json +++ b/schemas/1.14.json @@ -711,6 +711,30 @@ "type": "object", "color": "dark", "fields": [ + { + "id": "position", + "type": "object", + "translate": "$location.position", + "color": "dark", + "collapse": true, + "fields": [ + { + "id": "x", + "type": "boundary", + "translate": "$location.$position.x" + }, + { + "id": "y", + "type": "boundary", + "translate": "$location.$position.y" + }, + { + "id": "z", + "type": "boundary", + "translate": "$location.$position.z" + } + ] + }, { "id": "biome", "type": "enum", From 148f5a19a37ee9bc9a29f6f9df905a45942e12c3 Mon Sep 17 00:00:00 2001 From: Misode Date: Thu, 3 Oct 2019 13:27:43 +0200 Subject: [PATCH 29/44] Fix some enum translations --- locales/en.json | 9 --------- schemas/1.14.json | 6 +++--- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/locales/en.json b/locales/en.json index 2f2901a3..e8ebc6b6 100644 --- a/locales/en.json +++ b/locales/en.json @@ -232,9 +232,6 @@ "type": "Type" }, "$entity": { - "$type": { - - }, "type": "Entity", "nbt": "NBT", "location": "Location" @@ -249,9 +246,6 @@ "biome": "Biome", "feature": "Feature", "dimension": "Dimension" - }, - "$structure": { - }, "$item": { "name": "Item ID", @@ -260,9 +254,6 @@ "durability": "Durability", "potion": "Potion", "nbt": "NBT" - }, - "$biome": { - }, "2_spaces": "2 Spaces", "4_spaces": "4 Spaces", diff --git a/schemas/1.14.json b/schemas/1.14.json index 36fd7b12..f94a0995 100644 --- a/schemas/1.14.json +++ b/schemas/1.14.json @@ -688,7 +688,7 @@ "id": "type", "type": "enum", "translate": "$entity.type", - "translateValue": "$entity.$type", + "translateValue": "", "unset": true, "values": "entity_types" }, @@ -739,7 +739,7 @@ "id": "biome", "type": "enum", "translate": "$location.biome", - "translateValue": "$biome", + "translateValue": "", "unset": true, "values": "biomes" }, @@ -747,7 +747,7 @@ "id": "feature", "type": "enum", "translate": "$location.feature", - "translateValue": "$structure", + "translateValue": "", "unset": true, "values": "structures" }, From 5e9fbc0f893a4d0d4b39681271afbb31b0b6da2d Mon Sep 17 00:00:00 2001 From: Misode Date: Fri, 4 Oct 2019 10:15:47 +0200 Subject: [PATCH 30/44] Add maps of objects + add entity effect property --- locales/en.json | 14 +++++++-- model.js | 3 +- schemas/1.14.json | 74 +++++++++++++++++++++++++++++++++++++++++++++-- view.js | 18 +++++++++--- 4 files changed, 98 insertions(+), 11 deletions(-) diff --git a/locales/en.json b/locales/en.json index e8ebc6b6..d0c87a2e 100644 --- a/locales/en.json +++ b/locales/en.json @@ -29,8 +29,7 @@ "block_state": "Block State", "block_state_add": "Add Block State", "block_state_remove": "Remove Block State", - "objective": "Objective", - "score": "Score", + "score": "Objective", "score_add": "Add Score", "score_remove": "Remove Score", "location": "Location", @@ -234,7 +233,10 @@ "$entity": { "type": "Entity", "nbt": "NBT", - "location": "Location" + "location": "Location", + "status_effect": "Effects", + "status_effect_add": "Add Effect", + "status_effect_remove": "Remove Effect" }, "$location": { "position": "Position", @@ -247,6 +249,12 @@ "feature": "Feature", "dimension": "Dimension" }, + "$status_effect": { + "amplifier": "Amplifier", + "duration": "Duration", + "ambient": "Ambient", + "visible": "Visible" + }, "$item": { "name": "Item ID", "tag": "Item Tag", diff --git a/model.js b/model.js index 14c20ade..3ed3745e 100644 --- a/model.js +++ b/model.js @@ -242,6 +242,8 @@ function addToMap(el) { node[map][key] = 0; } else if (type === 'boolean') { node[map][key] = false; + } else if (type === 'object') { + node[map][key] = {}; } else { node[map][key] = ""; } @@ -275,7 +277,6 @@ function toggleCollapseObject(el) { function updateField(el) { let path = getPath(el); - console.log(path); let $field = $(el).closest('[data-index]'); let field = path.pop(); let node = getNode(path); diff --git a/schemas/1.14.json b/schemas/1.14.json index f94a0995..d2eba69b 100644 --- a/schemas/1.14.json +++ b/schemas/1.14.json @@ -505,7 +505,6 @@ "id": "properties", "type": "map", "translate": "$condition.block_state", - "translateValue": "$condition.block_state", "values": { "type": "string" }, @@ -516,8 +515,7 @@ { "id": "scores", "type": "map", - "translate": "$condition.objective", - "translateValue": "$condition.score", + "translate": "$condition.score", "values": { "type": "range" }, @@ -703,6 +701,15 @@ "translate": "$entity.location", "value": "location", "collapse": true + }, + { + "id": "effects", + "type": "map", + "translate": "$entity.status_effect", + "values": { + "type": "object", + "value": "status_effect" + } } ] }, @@ -761,6 +768,33 @@ } ] }, + { + "id": "status_effect", + "type": "object", + "color": "dark", + "fields": [ + { + "id": "amplifier", + "type": "range", + "translate": "$status_effect.amplifier" + }, + { + "id": "duration", + "type": "range", + "translate": "$status_effect.duration" + }, + { + "id": "ambient", + "type": "boolean", + "translate": "$status_effect.ambient" + }, + { + "id": "visible", + "type": "boolean", + "translate": "$status_effect.visible" + } + ] + }, { "id": "item", "type": "object", @@ -1104,6 +1138,40 @@ "minecraft:overworld", "minecraft:the_nether", "minecraft:the_end" + ], + "status_effects": [ + "minecraft:speed", + "minecraft:slowness", + "minecraft:haste", + "minecraft:mining_fatigue", + "minecraft:strength", + "minecraft:instant_health", + "minecraft:instant_damage", + "minecraft:jump_boost", + "minecraft:nausea", + "minecraft:regeneration", + "minecraft:resistance", + "minecraft:fire_resistance", + "minecraft:water_breathing", + "minecraft:invisibility", + "minecraft:blindness", + "minecraft:night_vision", + "minecraft:hunger", + "minecraft:weakness", + "minecraft:poison", + "minecraft:wither", + "minecraft:health_boost", + "minecraft:absorption", + "minecraft:saturation", + "minecraft:glowing", + "minecraft:levitation", + "minecraft:luck", + "minecraft:unluck", + "minecraft:slow_falling", + "minecraft:conduit_power", + "minecraft:dolphins_grace", + "minecraft:bad_omen", + "minecraft:hero_of_the_village" ] } } diff --git a/view.js b/view.js index fa70e529..2565b724 100644 --- a/view.js +++ b/view.js @@ -197,13 +197,23 @@ function generateMap(data, struct) { let $el = $('#components').find('[data-type="map"]').clone(); $el.attr('data-index', struct.id).attr('data-item-type', struct.values.type); $el.find('[data-name="1"]').attr('data-i18n', struct.translate); - $el.find('[data-name="2"]').attr('data-i18n', struct.translateValue + '_add'); + $el.find('[data-name="2"]').attr('data-i18n', struct.translate + '_add'); $el.find('input').keypress((e) => {if (e.which == 13) addToMap(e.target);}); if (data) { for (let key of Object.keys(data)) { - console.log(data[key]); - let $item = generateComponent(data[key], {id: key, type: struct.values.type, translate: key}); - $item.append('
'); + let field = struct.values; + field.id = key; + field.translate = key; + let $item = generateComponent(data[key], field);; + if (field.type === 'object') { + let $header = $('
'); + $header.append(('')); + $header.append(''); + $item.prepend($header); + } else { + $item.append('
'); + } + $item.attr('data-index', field.id); $el.append($item); } } From 335a33728ebfe6fe547e9ea90e9c6a0b26e00e27 Mon Sep 17 00:00:00 2001 From: Misode Date: Fri, 4 Oct 2019 10:33:19 +0200 Subject: [PATCH 31/44] Add entity distance property --- locales/en.json | 8 ++++++++ schemas/1.14.json | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/locales/en.json b/locales/en.json index d0c87a2e..f21485ee 100644 --- a/locales/en.json +++ b/locales/en.json @@ -234,6 +234,7 @@ "type": "Entity", "nbt": "NBT", "location": "Location", + "distance": "Distance", "status_effect": "Effects", "status_effect_add": "Add Effect", "status_effect_remove": "Remove Effect" @@ -249,6 +250,13 @@ "feature": "Feature", "dimension": "Dimension" }, + "$distance": { + "x": "X", + "y": "Y", + "z": "Z", + "absolute": "Absolute", + "horizontal": "Horizontal" + }, "$status_effect": { "amplifier": "Amplifier", "duration": "Duration", diff --git a/schemas/1.14.json b/schemas/1.14.json index d2eba69b..ce4f673e 100644 --- a/schemas/1.14.json +++ b/schemas/1.14.json @@ -702,6 +702,13 @@ "value": "location", "collapse": true }, + { + "id": "distance", + "type": "object", + "translate": "$entity.distance", + "value": "distance", + "collapse": true + }, { "id": "effects", "type": "map", @@ -768,6 +775,38 @@ } ] }, + { + "id": "distance", + "type": "object", + "color": "dark", + "fields": [ + { + "id": "x", + "type": "boundary", + "translate": "$distance.x" + }, + { + "id": "y", + "type": "boundary", + "translate": "$distance.y" + }, + { + "id": "z", + "type": "boundary", + "translate": "$distance.z" + }, + { + "id": "absolute", + "type": "boundary", + "translate": "$distance.absolute" + }, + { + "id": "horizontal", + "type": "boundary", + "translate": "$distance.horizontal" + } + ] + }, { "id": "status_effect", "type": "object", From 6a5ec71b5b10da42a0c6fcffaa38f6685ca643ee Mon Sep 17 00:00:00 2001 From: Misode Date: Fri, 4 Oct 2019 19:45:28 +0200 Subject: [PATCH 32/44] Update 1.13 schema --- locales/en.json | 1 + model.js | 1 - schemas/1.13.json | 686 +++++++++++++++++++++++++++++++++++++++++++--- schemas/1.14.json | 4 +- view.js | 2 +- 5 files changed, 653 insertions(+), 41 deletions(-) diff --git a/locales/en.json b/locales/en.json index f21485ee..64d558d2 100644 --- a/locales/en.json +++ b/locales/en.json @@ -132,6 +132,7 @@ }, "type": "Function", "count": "Count", + "data": "Data", "damage": "Damage", "name": "Name", "lore": "Lore", diff --git a/model.js b/model.js index 3ed3745e..31cff8e6 100644 --- a/model.js +++ b/model.js @@ -366,7 +366,6 @@ function updateRangeType(el) { } function getRangeValue($field, data) { - console.log($field, data); if (typeof data === 'object') { if (data.type && data.type.match(/(minecraft:)?binomial/)) { let n = $field.find('.binomial.n').val(); diff --git a/schemas/1.13.json b/schemas/1.13.json index 336e1cdf..dd41da43 100644 --- a/schemas/1.13.json +++ b/schemas/1.13.json @@ -4,6 +4,7 @@ { "id": "pools", "type": "array", + "translate": "pool", "values": "pool" } ] @@ -13,36 +14,29 @@ "id": "pool", "type": "object", "color": "success", - "default": { - "rolls": 1, - "entries": [ - { - "type": "minecraft:item", - "name": "minecraft:stone" - } - ] - }, "fields": [ { "id": "rolls", "type": "range", - "default": 1 + "translate": "$pool.rolls" }, { "id": "bonus_rolls", "type": "range", - "default": 1, - "luck_based": true + "translate": "$pool.bonus_rolls", + "luckBased": true }, { "id": "entries", "type": "array", + "translate": "entry", "values": "entry", "button": "header" }, { "id": "conditions", "type": "array", + "translate": "condition", "values": "condition", "button": "header" } @@ -52,40 +46,50 @@ "id": "entry", "type": "object", "color": "light", - "default": { - "type": "minecraft:item", - "name": "minecraft:stone" - }, "fields": [ { "id": "type", "type": "enum", - "source": "entry", + "translate": "$entry.type", + "translateValue": "$entry.$type", + "default": "minecraft:item", "values": [ "minecraft:empty", "minecraft:item", "minecraft:loot_table" - ], - "default": "minecraft:item" + ] }, { "id": "name", "type": "string", - "default": "minecraft:stone", + "translate": "$entry.name", "require": [ "minecraft:item", "minecraft:loot_table" ] }, + { + "id": "weight", + "type": "random", + "translate": "$entry.weight" + }, + { + "id": "quality", + "type": "random", + "translate": "$entry.quality", + "luckBased": true + }, { "id": "functions", "type": "array", + "translate": "function", "values": "function", "button": "header" }, { "id": "conditions", "type": "array", + "translate": "condition", "values": "condition", "button": "header" } @@ -95,15 +99,13 @@ "id": "function", "type": "object", "color": "secondary", - "default": { - "function": "minecraft:set_count", - "count": 2 - }, "fields": [ { "id": "function", "type": "enum", - "source": "function", + "translate": "$function.type", + "translateValue": "$function.$type", + "default": "minecraft:set_count", "values": [ "minecraft:set_count", "minecraft:set_data", @@ -114,47 +116,90 @@ "minecraft:enchant_with_levels", "minecraft:looting_enchant", "minecraft:furnace_smelt" - ], - "default": "set_count" + ] }, { "id": "count", "type": "range", + "translate": "$function.count", "require": [ - "minecraft:set_count" + "minecraft:set_count", + "minecraft:looting_enchant" ] }, { "id": "data", "type": "range", + "translate": "$function.data", "require": [ "minecraft:set_data" ] }, { "id": "damage", - "type": "range", + "type": "random", + "translate": "$function.damage", "require": [ "minecraft:set_damage" ] }, { "id": "tag", - "type": "string", + "type": "nbt", + "translate": "$function.nbt", "require": [ "minecraft:set_nbt" ] }, { "id": "levels", - "type": "range", + "type": "random", + "translate": "$function.levels", "require": [ "minecraft:enchant_with_levels" ] }, + { + "id": "treasure", + "type": "boolean", + "translate": "$function.treasure", + "default": false, + "require": [ + "minecraft:enchant_with_levels" + ] + }, + { + "id": "limit", + "type": "int", + "translate": "$function.limit", + "require": [ + "minecraft:looting_enchant" + ] + }, + { + "id": "enchantments", + "type": "set", + "translate": "$function.enchantments", + "translateValue": "$enchantment", + "values": "enchantments", + "require": [ + "minecraft:enchant_randomly" + ] + }, + { + "id": "modifiers", + "type": "array", + "translate": "attribute_modifier", + "button": "field", + "values": "attribute_modifier", + "require": [ + "minecraft:set_attributes" + ] + }, { "id": "conditions", "type": "array", + "translate": "condition", "values": "condition", "button": "header" } @@ -164,13 +209,580 @@ "id": "condition", "type": "object", "color": "info", - "default": { - "condition": "minecraft:random_chance", - "chance": 0.5 - }, "fields": [ - + { + "id": "condition", + "type": "enum", + "translate": "$condition.type", + "translateValue": "$condition.$type", + "default": "minecraft:random_chance", + "values": [ + "minecraft:random_chance", + "minecraft:random_chance_with_looting", + "minecraft:killed_by_player", + "minecraft:entity_properties", + "minecraft:entity_scores" + ] + }, + { + "id": "chance", + "type": "float", + "translate": "$condition.chance", + "require": [ + "minecraft:random_chance", + "minecraft:random_chance_with_looting" + ] + }, + { + "id": "looting_multiplier", + "type": "float", + "translate": "$condition.looting_multiplier", + "require": [ + "minecraft:random_chance_with_looting" + ] + }, + { + "id": "inverse", + "type": "boolean", + "translate": "$condition.inverted", + "default": false, + "require": [ + "minecraft:killed_by_player" + ] + }, + { + "id": "entity", + "type": "enum", + "translate": "$condition.entity", + "translateValue": "$source", + "default": "this", + "values": [ + "this", + "killer", + "killer_player" + ], + "require": [ + "minecraft:entity_properties", + "minecraft:entity_scores" + ] + }, + { + "id": "scores", + "type": "map", + "translate": "$condition.score", + "values": { + "type": "range" + }, + "require": [ + "minecraft:entity_scores" + ] + }, + { + "id": "predicate", + "type": "object", + "translate": "entity", + "value": "entity", + "require": [ + "minecraft:entity_properties" + ] + } + ] + }, + { + "id": "attribute_modifier", + "type": "object", + "color": "dark", + "fields": [ + { + "id": "attribute", + "type": "enum", + "translate": "$attribute_modifier.attribute", + "translateValue": "$attribute", + "default": "generic.attackDamage", + "values": [ + "generic.maxHealth", + "generic.followRange", + "generic.knockbackResistance", + "generic.movementSpeed", + "generic.attackDamage", + "generic.armor", + "generic.armorToughness", + "generic.attackSpeed", + "generic.luck", + "horse.jumpStrength", + "generic.attackKnockback", + "generic.flyingSpeed", + "zombie.spawnReinforcements" + ] + }, + { + "id": "name", + "type": "string", + "translate": "$attribute_modifier.name" + }, + { + "id": "amount", + "type": "float", + "translate": "$attribute_modifier.amount" + }, + { + "id": "operation", + "type": "enum", + "translate": "$attribute_modifier.operation", + "translateValue": "$attribute_modifier.$operation", + "default": "addition", + "values": [ + "addition", + "multiply_base", + "multiply_total" + ] + }, + { + "id": "slots", + "type": "set", + "translate": "$attribute_modifier.slots", + "translateValue": "$attribute_modifier.$slot", + "values": [ + "mainhand", + "offhand", + "head", + "chest", + "legs", + "feet" + ] + } + ] + }, + { + "id": "entity", + "type": "object", + "color": "dark", + "fields": [ + { + "id": "type", + "type": "enum", + "translate": "$entity.type", + "translateValue": "", + "unset": true, + "values": "entity_types" + }, + { + "id": "nbt", + "type": "nbt", + "translate": "$entity.nbt" + }, + { + "id": "location", + "type": "object", + "translate": "$entity.location", + "value": "location", + "collapse": true + }, + { + "id": "distance", + "type": "object", + "translate": "$entity.distance", + "value": "distance", + "collapse": true + }, + { + "id": "effects", + "type": "map", + "translate": "$entity.status_effect", + "values": { + "type": "object", + "value": "status_effect" + } + } + ] + }, + { + "id": "location", + "type": "object", + "color": "dark", + "fields": [ + { + "id": "position", + "type": "object", + "translate": "$location.position", + "color": "dark", + "collapse": true, + "fields": [ + { + "id": "x", + "type": "boundary", + "translate": "$location.$position.x" + }, + { + "id": "y", + "type": "boundary", + "translate": "$location.$position.y" + }, + { + "id": "z", + "type": "boundary", + "translate": "$location.$position.z" + } + ] + }, + { + "id": "biome", + "type": "enum", + "translate": "$location.biome", + "translateValue": "", + "unset": true, + "values": "biomes" + }, + { + "id": "feature", + "type": "enum", + "translate": "$location.feature", + "translateValue": "", + "unset": true, + "values": "structures" + }, + { + "id": "dimension", + "type": "enum", + "translate": "$location.dimension", + "translateValue": "$dimension", + "unset": true, + "values": "dimensions" + } + ] + }, + { + "id": "distance", + "type": "object", + "color": "dark", + "fields": [ + { + "id": "x", + "type": "boundary", + "translate": "$distance.x" + }, + { + "id": "y", + "type": "boundary", + "translate": "$distance.y" + }, + { + "id": "z", + "type": "boundary", + "translate": "$distance.z" + }, + { + "id": "absolute", + "type": "boundary", + "translate": "$distance.absolute" + }, + { + "id": "horizontal", + "type": "boundary", + "translate": "$distance.horizontal" + } + ] + }, + { + "id": "status_effect", + "type": "object", + "color": "dark", + "fields": [ + { + "id": "amplifier", + "type": "range", + "translate": "$status_effect.amplifier" + }, + { + "id": "duration", + "type": "range", + "translate": "$status_effect.duration" + }, + { + "id": "ambient", + "type": "boolean", + "translate": "$status_effect.ambient" + }, + { + "id": "visible", + "type": "boolean", + "translate": "$status_effect.visible" + } ] } - ] + ], + "collections": { + "entity_types": [ + "minecraft:area_effect_cloud", + "minecraft:armor_stand", + "minecraft:arrow", + "minecraft:bat", + "minecraft:blaze", + "minecraft:boat", + "minecraft:cat", + "minecraft:cave_spider", + "minecraft:chest_minecart", + "minecraft:chicken", + "minecraft:cod", + "minecraft:command_block_minecart", + "minecraft:cow", + "minecraft:creeper", + "minecraft:dolphin", + "minecraft:donkey", + "minecraft:dragon_fireball", + "minecraft:drowned", + "minecraft:egg", + "minecraft:elder_guardian", + "minecraft:end_crystal", + "minecraft:ender_dragon", + "minecraft:ender_pearl", + "minecraft:enderman", + "minecraft:endermite", + "minecraft:evoker", + "minecraft:evoker_fangs", + "minecraft:experience_bottle", + "minecraft:experience_orb", + "minecraft:eye_of_ender", + "minecraft:falling_block", + "minecraft:fireball", + "minecraft:firework_rocket", + "minecraft:fishing_bobber", + "minecraft:furnace_minecart", + "minecraft:ghast", + "minecraft:giant", + "minecraft:guardian", + "minecraft:hopper_minecart", + "minecraft:horse", + "minecraft:husk", + "minecraft:illusioner", + "minecraft:iron_golem", + "minecraft:item", + "minecraft:item_frame", + "minecraft:leash_knot", + "minecraft:lightning_bolt", + "minecraft:llama", + "minecraft:llama_spit", + "minecraft:magma_cube", + "minecraft:minecart", + "minecraft:mooshroom", + "minecraft:mule", + "minecraft:ocelot", + "minecraft:painting", + "minecraft:parrot", + "minecraft:phantom", + "minecraft:pig", + "minecraft:player", + "minecraft:polar_bear", + "minecraft:potion", + "minecraft:pufferfish", + "minecraft:rabbit", + "minecraft:salmon", + "minecraft:sheep", + "minecraft:shulker", + "minecraft:shulker_bullet", + "minecraft:silverfish", + "minecraft:skeleton", + "minecraft:skeleton_horse", + "minecraft:slime", + "minecraft:small_fireball", + "minecraft:snow_golem", + "minecraft:snowball", + "minecraft:spawner_minecart", + "minecraft:spectral_arrow", + "minecraft:spider", + "minecraft:squid", + "minecraft:stray", + "minecraft:tnt", + "minecraft:tnt_minecart", + "minecraft:trader_llama", + "minecraft:trident", + "minecraft:tropical_fish", + "minecraft:turtle", + "minecraft:vex", + "minecraft:villager", + "minecraft:vindicator", + "minecraft:wandering_trader", + "minecraft:witch", + "minecraft:wither", + "minecraft:wither_skeleton", + "minecraft:wither_skull", + "minecraft:wolf", + "minecraft:zombie", + "minecraft:zombie_horse", + "minecraft:zombie_pigman", + "minecraft:zombie_villager" + ], + "enchantments": [ + "minecraft:aqua_affinity", + "minecraft:bane_of_arthropods", + "minecraft:blast_protection", + "minecraft:channeling", + "minecraft:binding_curse", + "minecraft:vanishing_curse", + "minecraft:depth_strider", + "minecraft:efficiency", + "minecraft:feather_falling", + "minecraft:fire_aspect", + "minecraft:fire_protection", + "minecraft:flame", + "minecraft:fortune", + "minecraft:frost_walker", + "minecraft:impaling", + "minecraft:infinity", + "minecraft:knockback", + "minecraft:looting", + "minecraft:loyalty", + "minecraft:luck_of_the_sea", + "minecraft:lure", + "minecraft:mending", + "minecraft:multishot", + "minecraft:piercing", + "minecraft:power", + "minecraft:projectile_protection", + "minecraft:protection", + "minecraft:punch", + "minecraft:quick_charge", + "minecraft:respiration", + "minecraft:riptide", + "minecraft:sharpness", + "minecraft:silk_touch", + "minecraft:smite", + "minecraft:sweeping", + "minecraft:thorns", + "minecraft:unbreaking" + ], + "biomes": [ + "minecraft:badlands", + "minecraft:badlands_plateau", + "minecraft:bamboo_jungle", + "minecraft:bamboo_jungle_hills", + "minecraft:beach", + "minecraft:birch_forest", + "minecraft:birch_forest_hills", + "minecraft:cold_ocean", + "minecraft:dark_forest", + "minecraft:dark_forest_hills", + "minecraft:deep_cold_ocean", + "minecraft:deep_frozen_ocean", + "minecraft:deep_lukewarm_ocean", + "minecraft:deep_ocean", + "minecraft:deep_warm_ocean", + "minecraft:desert", + "minecraft:desert_hills", + "minecraft:desert_lakes", + "minecraft:end_barrens", + "minecraft:end_highlands", + "minecraft:end_midlands", + "minecraft:eroded_badlands", + "minecraft:flower_forest", + "minecraft:forest", + "minecraft:frozen_ocean", + "minecraft:frozen_river", + "minecraft:giant_spruce_taiga", + "minecraft:giant_spruce_taiga_hills", + "minecraft:giant_tree_taiga", + "minecraft:giant_tree_taiga_hills", + "minecraft:gravelly_mountains", + "minecraft:ice_spikes", + "minecraft:jungle", + "minecraft:jungle_edge", + "minecraft:jungle_hills", + "minecraft:lukewarm_ocean", + "minecraft:modified_badlands_plateau", + "minecraft:modified_gravelly_mountains", + "minecraft:modified_jungle", + "minecraft:modified_jungle_edge", + "minecraft:modified_wooded_badlands_plateau", + "minecraft:mountain_edge", + "minecraft:mountains", + "minecraft:mushroom_field_shore", + "minecraft:mushroom_fields", + "minecraft:nether", + "minecraft:ocean", + "minecraft:plains", + "minecraft:river", + "minecraft:savanna", + "minecraft:savanna_plateau", + "minecraft:shattered_savanna", + "minecraft:shattered_savanna_plateau", + "minecraft:small_end_islands", + "minecraft:snowy_beach", + "minecraft:snowy_mountains", + "minecraft:snowy_taiga", + "minecraft:snowy_taiga_hills", + "minecraft:snowy_taiga_mountains", + "minecraft:snowy_tundra", + "minecraft:stone_shore", + "minecraft:sunflower_plains", + "minecraft:swamp", + "minecraft:swamp_hills", + "minecraft:taiga", + "minecraft:taiga_hills", + "minecraft:taiga_mountains", + "minecraft:tall_birch_forest", + "minecraft:tall_birch_hills", + "minecraft:the_end", + "minecraft:the_void", + "minecraft:warm_ocean", + "minecraft:wooded_badlands_plateau", + "minecraft:wooded_hills", + "minecraft:wooded_mountains" + ], + "structures": [ + "pillager_outpost", + "mineshaft", + "mansion", + "jungle_pyramid", + "desert_pyramid", + "igloo", + "shipwreck", + "swamp_hut", + "stronghold", + "monument", + "ocean_ruin", + "fortress", + "endcity", + "buried_treasure", + "village" + ], + "dimensions": [ + "minecraft:overworld", + "minecraft:the_nether", + "minecraft:the_end" + ], + "status_effects": [ + "minecraft:speed", + "minecraft:slowness", + "minecraft:haste", + "minecraft:mining_fatigue", + "minecraft:strength", + "minecraft:instant_health", + "minecraft:instant_damage", + "minecraft:jump_boost", + "minecraft:nausea", + "minecraft:regeneration", + "minecraft:resistance", + "minecraft:fire_resistance", + "minecraft:water_breathing", + "minecraft:invisibility", + "minecraft:blindness", + "minecraft:night_vision", + "minecraft:hunger", + "minecraft:weakness", + "minecraft:poison", + "minecraft:wither", + "minecraft:health_boost", + "minecraft:absorption", + "minecraft:saturation", + "minecraft:glowing", + "minecraft:levitation", + "minecraft:luck", + "minecraft:unluck", + "minecraft:slow_falling", + "minecraft:conduit_power", + "minecraft:dolphins_grace", + "minecraft:bad_omen", + "minecraft:hero_of_the_village" + ] + } } diff --git a/schemas/1.14.json b/schemas/1.14.json index ce4f673e..245cad8e 100644 --- a/schemas/1.14.json +++ b/schemas/1.14.json @@ -39,7 +39,7 @@ "id": "bonus_rolls", "type": "random", "translate": "$pool.bonus_rolls", - "luck_based": true + "luckBased": true }, { "id": "entries", @@ -99,7 +99,7 @@ "id": "quality", "type": "random", "translate": "$entry.quality", - "luck_based": true + "luckBased": true }, { "id": "children", diff --git a/view.js b/view.js index 2565b724..d7b275a3 100644 --- a/view.js +++ b/view.js @@ -350,7 +350,7 @@ function generateObject(data, struct, header) { } function generateField(data, field, parent) { - if (!luckBased && field.luck_based) { + if (!luckBased && field.luckBased) { return false; } if (field.require) { From dc354c16425691c3ca7fa6dd0775605b03325bf7 Mon Sep 17 00:00:00 2001 From: Misode Date: Fri, 4 Oct 2019 20:09:06 +0200 Subject: [PATCH 33/44] Add Chinese lore translation --- locales/zh-CN.json | 1 + 1 file changed, 1 insertion(+) diff --git a/locales/zh-CN.json b/locales/zh-CN.json index 966ed72b..b7898f54 100644 --- a/locales/zh-CN.json +++ b/locales/zh-CN.json @@ -135,6 +135,7 @@ "count": "数量", "damage": "损伤值", "name": "名称", + "lore": "下标", "nbt": "NBT", "levels": "等级", "treasure": "宝藏型附魔", From ec64fb68c5c0cae778f529ee0bee06a93b29022f Mon Sep 17 00:00:00 2001 From: Misode Date: Fri, 4 Oct 2019 20:18:56 +0200 Subject: [PATCH 34/44] Fix margin in navbar --- index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index f521b2d0..4be1a1f8 100644 --- a/index.html +++ b/index.html @@ -12,7 +12,7 @@
- +
From 7bb3c21451de6710e799865e1b26309277057f40 Mon Sep 17 00:00:00 2001 From: Misode Date: Fri, 4 Oct 2019 20:28:28 +0200 Subject: [PATCH 35/44] Fix not being able to add pools --- index.html | 4 ++-- model.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 4be1a1f8..7432268d 100644 --- a/index.html +++ b/index.html @@ -31,9 +31,9 @@
-
+
- +
diff --git a/model.js b/model.js index 31cff8e6..3073ddd7 100644 --- a/model.js +++ b/model.js @@ -148,7 +148,7 @@ function copySource(el) { function getPath(el) { let $node = $(el).closest('[data-index]'); let index = $node.attr('data-index'); - if (index === 'pools') return ['pools']; + if (index === 'table') return []; let parent = getPath($node.parent()); parent.push(index); return parent; From 1e2d8723769d869f971e3750495cd2f6651e6a9a Mon Sep 17 00:00:00 2001 From: Misode Date: Fri, 4 Oct 2019 20:58:48 +0200 Subject: [PATCH 36/44] Hide table type dropdown for 1.13 + fix apply bonus formula translation --- index.html | 11 ++--------- schemas/1.14.json | 2 +- view.js | 17 ++++++++++++++--- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/index.html b/index.html index 7432268d..226ca6cb 100644 --- a/index.html +++ b/index.html @@ -34,17 +34,10 @@
-
+
- +
diff --git a/schemas/1.14.json b/schemas/1.14.json index 245cad8e..a0cc377b 100644 --- a/schemas/1.14.json +++ b/schemas/1.14.json @@ -321,7 +321,7 @@ "id": "formula", "type": "enum", "translate": "$function.formula", - "translateValues": "$function.$formula", + "translateValue": "$function.$formula", "default": "minecraft:uniform_bonus_count", "values": [ "minecraft:uniform_bonus_count", diff --git a/view.js b/view.js index d7b275a3..6ada525f 100644 --- a/view.js +++ b/view.js @@ -39,10 +39,21 @@ function updateView() { function generateTable() { $('#structure').removeClass('d-none').html(''); - if (!table.type) { - table.type = 'minecraft:empty'; + let type = structure.fields.find(e => e.id === 'type'); + if (type) { + $('.table-type').removeClass('d-none'); + if (!table.type) { + table.type = type.default; + } + $('#tableType').html(''); + for (let option of type.values) { + $('#tableType').append(setValueAndName($('