mirror of
https://github.com/misode/misode.github.io.git
synced 2026-05-04 22:51:47 +00:00
Merge branch 'master' of https://github.com/misode/loot-table into dev/validate
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 Misode
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
+1
-1
@@ -23,7 +23,7 @@
|
||||
background-color: #eee !important;
|
||||
}
|
||||
|
||||
.card.term, .card.terms {
|
||||
.card.bg-info .card.bg-info {
|
||||
background-color: #7cb6bf !important;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
const lngs = [
|
||||
['en', 'English'],
|
||||
['ru', 'Русский'],
|
||||
['zh-CN', '简体中文']
|
||||
]
|
||||
|
||||
lngs.forEach(v => $('#lngList').append(`<a class="dropdown-item" onclick="changeLng('${v[0]}')">${v[1]}</a>`))
|
||||
|
||||
i18next
|
||||
.use(i18nextBrowserLanguageDetector)
|
||||
.use(i18nextXHRBackend)
|
||||
.init({
|
||||
backend: { loadPath: 'locales/{{lng}}.json' },
|
||||
fallbackLng: 'en',
|
||||
whitelist: lngs.map(v => v[0])
|
||||
})
|
||||
.then(() => {
|
||||
jqueryI18next.init(i18next, $, { parseDefaultValueFromContent: false })
|
||||
$('html').localize()
|
||||
})
|
||||
|
||||
function changeLng(code) {
|
||||
i18next.changeLanguage(code).then(() => {
|
||||
$('html').localize()
|
||||
})
|
||||
}
|
||||
+591
-521
File diff suppressed because it is too large
Load Diff
+302
@@ -0,0 +1,302 @@
|
||||
{
|
||||
"$condition": {
|
||||
"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"
|
||||
},
|
||||
"$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"
|
||||
},
|
||||
"$dimension": {
|
||||
"overworld": "Overworld",
|
||||
"the_nether": "The Nether",
|
||||
"the_end": "The End"
|
||||
},
|
||||
"$enchantment": {
|
||||
"aqua_affinity": "Aqua Affinity",
|
||||
"bane_of_arthropods": "Bane of Arthropods",
|
||||
"blast_protection": "Blast Protection",
|
||||
"channeling": "Channeling",
|
||||
"binding_curse": "Curse of Binding",
|
||||
"vanishing_curse": "Curse of Vanishing",
|
||||
"depth_strider": "Depth Strider",
|
||||
"efficiency": "Efficiency",
|
||||
"feather_falling": "Feather Falling",
|
||||
"fire_aspect": "Fire Aspect",
|
||||
"fire_protection": "Fire Protection",
|
||||
"flame": "Flame",
|
||||
"fortune": "Fortune",
|
||||
"frost_walker": "Frost Walker",
|
||||
"impaling": "Impaling",
|
||||
"infinity": "Infinity",
|
||||
"knockback": "Knockback",
|
||||
"looting": "Looting",
|
||||
"loyalty": "Loyalty",
|
||||
"luck_of_the_sea": "Luck of the Sea",
|
||||
"lure": "Lure",
|
||||
"mending": "Mending",
|
||||
"multishot": "Multishot",
|
||||
"piercing": "Piercing",
|
||||
"power": "Power",
|
||||
"projectile_protection": "Projectile Protection",
|
||||
"protection": "Protection",
|
||||
"punch": "Punch",
|
||||
"quick_charge": "Quick Charge",
|
||||
"respiration": "Respiration",
|
||||
"riptide": "Riptide",
|
||||
"sharpness": "Sharpness",
|
||||
"silk_touch": "Silk Touch",
|
||||
"smite": "Smite",
|
||||
"sweeping": "Sweeping Edge",
|
||||
"thorns": "Thorns",
|
||||
"unbreaking": "Unbreaking"
|
||||
},
|
||||
"$entry": {
|
||||
"name": "Name",
|
||||
"type": "Type",
|
||||
"$type": {
|
||||
"empty": "Empty",
|
||||
"item": "Item",
|
||||
"tag": "Item Tag",
|
||||
"loot_table": "Loot Table",
|
||||
"alternatives": "Alternatives",
|
||||
"sequence": "Sequence",
|
||||
"group": "Group",
|
||||
"dynamic": "Dynamic"
|
||||
},
|
||||
"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"
|
||||
},
|
||||
"$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"
|
||||
},
|
||||
"$bonus_extra": {
|
||||
"extra": "Extra"
|
||||
},
|
||||
"$bonus_probability": {
|
||||
"probability": "Propability"
|
||||
}
|
||||
},
|
||||
"$modifier": {
|
||||
"attribute": "Attribute",
|
||||
"generic_maxHealth": "Max Health",
|
||||
"generic_followRange": "Follow Range",
|
||||
"generic_knockbackResistance": "Knockback Resistance",
|
||||
"generic_movementSpeed": "Movement Speed",
|
||||
"generic_attackDamage": "Attack Damage",
|
||||
"generic_armor": "Armor",
|
||||
"generic_armorToughness": "Armor Toughness",
|
||||
"generic_attackSpeed": "Attack Speed",
|
||||
"generic_luck": "Luck",
|
||||
"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"
|
||||
},
|
||||
"$operation": {
|
||||
"source": "Source",
|
||||
"target": "Target",
|
||||
"operation": "Operation",
|
||||
"$operation": {
|
||||
"replace": "Replace",
|
||||
"append": "Append",
|
||||
"merge": "Merge"
|
||||
}
|
||||
},
|
||||
"$pool": {
|
||||
"rolls": "Rolls",
|
||||
"bonus_rolls": "Bonus Rolls"
|
||||
},
|
||||
"$range": {
|
||||
"exact": "Exact",
|
||||
"range": "Range",
|
||||
"$range": {
|
||||
"min": "Min",
|
||||
"max": "Max"
|
||||
},
|
||||
"binomial": "Binomial",
|
||||
"$binomial": {
|
||||
"n": "n",
|
||||
"p": "p"
|
||||
}
|
||||
},
|
||||
"$slot": {
|
||||
"mainhand": "Mainhand",
|
||||
"offhand": "Offhand",
|
||||
"head": "Head",
|
||||
"chest": "Chest",
|
||||
"legs": "Legs",
|
||||
"feet": "Feet"
|
||||
},
|
||||
"$source": {
|
||||
"block_entity": "Block Entity",
|
||||
"this": "This",
|
||||
"killer": "Killer",
|
||||
"killer_player": "Killer Player"
|
||||
},
|
||||
"$table": {
|
||||
"type": "Type",
|
||||
"$type": {
|
||||
"empty": "Empty",
|
||||
"entity": "Entity",
|
||||
"block": "Block",
|
||||
"chest": "Chest",
|
||||
"fishing": "Fishing",
|
||||
"generic": "Generic"
|
||||
}
|
||||
},
|
||||
"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",
|
||||
"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 1.14",
|
||||
"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",
|
||||
"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",
|
||||
"z": "Z"
|
||||
}
|
||||
+302
@@ -0,0 +1,302 @@
|
||||
{
|
||||
"$condition": {
|
||||
"alternative": "Выбор",
|
||||
"inverted": "Инвертирование",
|
||||
"entity_properties": "Свойства сущности",
|
||||
"block_state_propery": "Свойства блока",
|
||||
"match_tool": "Свойства инструмента",
|
||||
"damage_source_properties": "Источник урона",
|
||||
"location_check": "Местоположение",
|
||||
"weather_check": "Погода",
|
||||
"entity_scores": "Счёты сущности",
|
||||
"random_chance": "Случайность",
|
||||
"random_chance_with_looting": "Случайность с «Добычей»",
|
||||
"table_bonus": "Бонус таблицы",
|
||||
"killed_by_player": "Убит игроком",
|
||||
"survives_explosion": "Переживает взрыв"
|
||||
},
|
||||
"$damage": {
|
||||
"damage_type": "Тип урона",
|
||||
"projectile": "Снаряд",
|
||||
"explosion": "Взрыв",
|
||||
"fire": "Огонь",
|
||||
"magic": "Магия",
|
||||
"lightning": "Молния",
|
||||
"starvation": "Голод",
|
||||
"void": "Бездна",
|
||||
"bypass_armor": "Обход брони",
|
||||
"dealt": "Нанесено",
|
||||
"taken": "Получено",
|
||||
"blocked": "Заблокирован"
|
||||
},
|
||||
"$dimension": {
|
||||
"overworld": "Обычный мир",
|
||||
"the_nether": "Незер",
|
||||
"the_end": "Энд"
|
||||
},
|
||||
"$enchantment": {
|
||||
"aqua_affinity": "Подводник",
|
||||
"bane_of_arthropods": "Бич членистоногих",
|
||||
"blast_protection": "Взрывоустойчивость",
|
||||
"channeling": "Громовержец",
|
||||
"binding_curse": "Проклятие несъёмности",
|
||||
"vanishing_curse": "Проклятие утраты",
|
||||
"depth_strider": "Подводная ходьба",
|
||||
"efficiency": "Эффективность",
|
||||
"feather_falling": "Невесомость",
|
||||
"fire_aspect": "Заговор огня",
|
||||
"fire_protection": "Огнеупорность",
|
||||
"flame": "Горящая стрела",
|
||||
"fortune": "Удача",
|
||||
"frost_walker": "Ледоход",
|
||||
"impaling": "Пронзатель",
|
||||
"infinity": "Бесконечность",
|
||||
"knockback": "Отдача",
|
||||
"looting": "Добыча",
|
||||
"loyalty": "Верность",
|
||||
"luck_of_the_sea": "Везучий рыбак",
|
||||
"lure": "Приманка",
|
||||
"mending": "Починка",
|
||||
"multishot": "Тройной выстрел",
|
||||
"piercing": "Пронзающая стрела",
|
||||
"power": "Сила",
|
||||
"projectile_protection": "Защита от снарядов",
|
||||
"protection": "Защита",
|
||||
"punch": "Откидывание",
|
||||
"quick_charge": "Быстрая перезарядка",
|
||||
"respiration": "Подводное дыхание",
|
||||
"riptide": "Тягун",
|
||||
"sharpness": "Острота",
|
||||
"silk_touch": "Шёлковое касание",
|
||||
"smite": "Небесная кара",
|
||||
"sweeping": "Разящий клинок",
|
||||
"thorns": "Шипы",
|
||||
"unbreaking": "Прочность"
|
||||
},
|
||||
"$entry": {
|
||||
"name": "ID",
|
||||
"type": "Тип",
|
||||
"$type": {
|
||||
"empty": "Ничего",
|
||||
"item": "Предмет",
|
||||
"tag": "Тег предметов",
|
||||
"loot_table": "Таблица добычи",
|
||||
"alternatives": "Выбор",
|
||||
"sequence": "Последовательность",
|
||||
"group": "Группа",
|
||||
"dynamic": "Динамический"
|
||||
},
|
||||
"weight": "Вес",
|
||||
"quality": "Качество"
|
||||
},
|
||||
"$function": {
|
||||
"set_count": "Задать количество",
|
||||
"set_damage": "Задать повреждение",
|
||||
"set_name": "Задать имя",
|
||||
"set_lore": "Задать описание",
|
||||
"set_nbt": "Задать NBT",
|
||||
"set_attributes": "Задать атрибуты",
|
||||
"set_contents": "Задать содержимое",
|
||||
"enchant_randomly": "Наложить случайные чары",
|
||||
"enchant_with_levels": "Наложить чары с уровнем",
|
||||
"looting_enchant": "Чары «Добыча»",
|
||||
"limit_count": "Ограничить количество",
|
||||
"furnace_smelt": "Расплавить в печи",
|
||||
"explosion_decay": "Разрушить взрывом",
|
||||
"fill_player_head": "Задать скин голове игрока",
|
||||
"copy_name": "Скопировать имя",
|
||||
"copy_nbt": "Скопировать NBT",
|
||||
"apply_bonus": "Применить бонус",
|
||||
"$damage": {
|
||||
"damage": "Повреждение"
|
||||
},
|
||||
"$ench_rand": {
|
||||
"ench": "Чары"
|
||||
},
|
||||
"$limit": {
|
||||
"limit": "Ограничение"
|
||||
},
|
||||
"$name": {
|
||||
"name": "Имя"
|
||||
},
|
||||
"$lore_replace": {
|
||||
"replace": "Заменить старое"
|
||||
},
|
||||
"$entity": {
|
||||
"entity": "Сущность"
|
||||
},
|
||||
"$operations": {
|
||||
"add_op": "Добавить действие"
|
||||
},
|
||||
"$formula": {
|
||||
"formula": "Формула",
|
||||
"uniform_bonus_count": "Равномерное распределение",
|
||||
"binomial_with_bonus_count": "Биноминальное распределение",
|
||||
"ore_drops": "Добыча руд"
|
||||
},
|
||||
"$bonus_multiplier": {
|
||||
"multiplier": "Множитель"
|
||||
},
|
||||
"$bonus_extra": {
|
||||
"extra": "Дополнительное значение"
|
||||
},
|
||||
"$bonus_probability": {
|
||||
"probability": "Вероятность"
|
||||
}
|
||||
},
|
||||
"$modifier": {
|
||||
"attribute": "Атрибут",
|
||||
"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": "Подкрепление зомби",
|
||||
"name": "Имя",
|
||||
"amount": "Количество",
|
||||
"operation": "Действие",
|
||||
"$operation": {
|
||||
"addition": "Прибавление",
|
||||
"multiply_base": "Умножение базового",
|
||||
"multiply_total": "Умножение общего"
|
||||
},
|
||||
"slots": "Ячейки"
|
||||
},
|
||||
"$operation": {
|
||||
"source": "Источник",
|
||||
"target": "Цель",
|
||||
"operation": "Действие",
|
||||
"$operation": {
|
||||
"replace": "Замена",
|
||||
"append": "Добавление",
|
||||
"merge": "Объединение"
|
||||
}
|
||||
},
|
||||
"$pool": {
|
||||
"rolls": "Бросков",
|
||||
"bonus_rolls": "Бонусных бросков"
|
||||
},
|
||||
"$range": {
|
||||
"exact": "Число",
|
||||
"range": "Диапазон",
|
||||
"$range": {
|
||||
"min": "Мин.",
|
||||
"max": "Макс."
|
||||
},
|
||||
"binomial": "Биномиальное распределение",
|
||||
"$binomial": {
|
||||
"n": "n",
|
||||
"p": "p"
|
||||
}
|
||||
},
|
||||
"$slot": {
|
||||
"mainhand": "Ведущая рука",
|
||||
"offhand": "Вторая рука",
|
||||
"head": "Голова",
|
||||
"chest": "Тело",
|
||||
"legs": "Ноги",
|
||||
"feet": "Стопы"
|
||||
},
|
||||
"$source": {
|
||||
"block_entity": "Блок-сущность",
|
||||
"this": "Текущая",
|
||||
"killer": "Убийца",
|
||||
"killer_player": "Игрок-убийца"
|
||||
},
|
||||
"$table": {
|
||||
"type": "Тип",
|
||||
"$type": {
|
||||
"empty": "Ничего",
|
||||
"entity": "Сущность",
|
||||
"block": "Блок",
|
||||
"chest": "Сундук",
|
||||
"fishing": "Рыбалка",
|
||||
"generic": "Общий"
|
||||
}
|
||||
},
|
||||
"2_spaces": "2 пробела",
|
||||
"4_spaces": "4 пробела",
|
||||
"add_block_state": "Добавить состояние блока",
|
||||
"add_child": "Добавить потомка",
|
||||
"add_condition": "Добавить условие",
|
||||
"add_enchantment": "Добавить чары",
|
||||
"add_entry": "Добавить запись",
|
||||
"add_function": "Добавить функцию",
|
||||
"add_modifier": "Добавить модификатор",
|
||||
"add_operation": "Добавить действие",
|
||||
"add_pool": "Добавить пул",
|
||||
"add_score": "Добавить счёт",
|
||||
"add_term": "Добавить выражение",
|
||||
"author": "Автор: Misode",
|
||||
"biome": "Биом",
|
||||
"block": "Блок",
|
||||
"block_state": "состояние блока",
|
||||
"chance": "Шанс",
|
||||
"chance_plural": "Шансы",
|
||||
"child": "Потомок",
|
||||
"condition": "Условие",
|
||||
"copy": "Скопировать",
|
||||
"count": "Количество",
|
||||
"description": "Генератор таблицы добычи для Minecraft 1.14",
|
||||
"dimension": "Измерение",
|
||||
"direct_entity": "Сущность-причина урона",
|
||||
"durability": "Прочность",
|
||||
"enchantment": "Чары",
|
||||
"entity": "Сущность",
|
||||
"entry": "Запись",
|
||||
"false": "Нет",
|
||||
"feature": "Строение",
|
||||
"function": "Функция",
|
||||
"hide_source": "Скрыть источник",
|
||||
"inverted": "Инвертировать",
|
||||
"item": "Предмет",
|
||||
"level_plural": "Уровень",
|
||||
"location": "Местоположение",
|
||||
"looting_multiplier": "Множитель «Добычи»",
|
||||
"luck_based": "Основано на удаче",
|
||||
"modifier": "Модификатор",
|
||||
"more": "Больше",
|
||||
"name": "ID",
|
||||
"nbt": "NBT",
|
||||
"objective": "Задача",
|
||||
"operation": "Действие",
|
||||
"pool": "Пул",
|
||||
"position": "Позиция",
|
||||
"potion": "Зелье",
|
||||
"raining": "Дождь",
|
||||
"remove": "Удалить",
|
||||
"remove_block_state": "Удалить состояние блока",
|
||||
"remove_condition": "Удалить условие",
|
||||
"remove_enchantment": "Удалить чары",
|
||||
"remove_entry": "Удалить запись",
|
||||
"remove_function": "Удалить функцию",
|
||||
"remove_modifier": "Удалить модификатор",
|
||||
"remove_operation": "Удалить действие",
|
||||
"remove_pool": "Удалить пул",
|
||||
"remove_score": "Удалить счёт",
|
||||
"remove_term": "Удалить выражение",
|
||||
"score": "Счёт",
|
||||
"share": "Поделиться",
|
||||
"show_source": "Показать источник",
|
||||
"source": "Источник",
|
||||
"source_entity": "Сущность-источник урона",
|
||||
"tabs": "Табуляция",
|
||||
"tag": "Тег",
|
||||
"term": "Выражение",
|
||||
"thundering": "Гроза",
|
||||
"title": "Генератор таблицы добычи",
|
||||
"treasure": "Чары-сокровища",
|
||||
"true": "Да",
|
||||
"type": "Тип",
|
||||
"unset": "Не задано",
|
||||
"x": "X",
|
||||
"y": "Y",
|
||||
"z": "Z"
|
||||
}
|
||||
@@ -0,0 +1,302 @@
|
||||
{
|
||||
"$condition": {
|
||||
"alternative": "析取范式",
|
||||
"inverted": "取反",
|
||||
"entity_properties": "实体属性",
|
||||
"block_state_propery": "方块属性",
|
||||
"match_tool": "工具属性",
|
||||
"damage_source_properties": "伤害源",
|
||||
"location_check": "位置",
|
||||
"weather_check": "天气",
|
||||
"entity_scores": "实体分数",
|
||||
"random_chance": "随机概率",
|
||||
"random_chance_with_looting": "受抢夺附魔影响的随机概率",
|
||||
"table_bonus": "附魔奖励",
|
||||
"killed_by_player": "被玩家击杀",
|
||||
"survives_explosion": "未被爆炸破坏"
|
||||
},
|
||||
"$damage": {
|
||||
"damage_type": "伤害类型",
|
||||
"projectile": "弹射物",
|
||||
"explosion": "爆炸",
|
||||
"fire": "燃烧",
|
||||
"magic": "魔法",
|
||||
"lightning": "雷击",
|
||||
"starvation": "饥饿",
|
||||
"void": "虚空",
|
||||
"bypass_armor": "破甲",
|
||||
"dealt": "被防御前的伤害",
|
||||
"taken": "实际造成的伤害",
|
||||
"blocked": "被盾牌阻挡"
|
||||
},
|
||||
"$dimension": {
|
||||
"overworld": "主世界",
|
||||
"the_nether": "下界",
|
||||
"the_end": "末路之地"
|
||||
},
|
||||
"$enchantment": {
|
||||
"aqua_affinity": "水下速掘",
|
||||
"bane_of_arthropods": "节肢杀手",
|
||||
"blast_protection": "爆炸保护",
|
||||
"channeling": "引雷",
|
||||
"binding_curse": "绑定诅咒",
|
||||
"vanishing_curse": "消失诅咒",
|
||||
"depth_strider": "深海探索者",
|
||||
"efficiency": "效率",
|
||||
"feather_falling": "摔落保护",
|
||||
"fire_aspect": "火焰附加",
|
||||
"fire_protection": "火焰保护",
|
||||
"flame": "火矢",
|
||||
"fortune": "时运",
|
||||
"frost_walker": "冰霜行者",
|
||||
"impaling": "穿刺",
|
||||
"infinity": "无限",
|
||||
"knockback": "击退",
|
||||
"looting": "抢夺",
|
||||
"loyalty": "忠诚",
|
||||
"luck_of_the_sea": "海之眷顾",
|
||||
"lure": "饵钓",
|
||||
"mending": "经验修补",
|
||||
"multishot": "多重射击",
|
||||
"piercing": "穿透",
|
||||
"power": "力量",
|
||||
"projectile_protection": "弹射物保护",
|
||||
"protection": "保护",
|
||||
"punch": "冲击",
|
||||
"quick_charge": "快速装填",
|
||||
"respiration": "水下呼吸",
|
||||
"riptide": "激流",
|
||||
"sharpness": "锋利",
|
||||
"silk_touch": "精准采集",
|
||||
"smite": "亡灵杀手",
|
||||
"sweeping": "横扫之刃",
|
||||
"thorns": "荆棘",
|
||||
"unbreaking": "耐久"
|
||||
},
|
||||
"$entry": {
|
||||
"name": "名称",
|
||||
"type": "类型",
|
||||
"$type": {
|
||||
"empty": "空",
|
||||
"item": "物品",
|
||||
"tag": "物品标签",
|
||||
"loot_table": "战利品表",
|
||||
"alternatives": "析取范式",
|
||||
"sequence": "序列",
|
||||
"group": "组",
|
||||
"dynamic": "动态"
|
||||
},
|
||||
"weight": "权重",
|
||||
"quality": "每级幸运对权重的影响"
|
||||
},
|
||||
"$function": {
|
||||
"set_count": "设置物品数量",
|
||||
"set_damage": "设置损伤值",
|
||||
"set_name": "设置物品名",
|
||||
"set_lore": "设置下标",
|
||||
"set_nbt": "设置 NBT",
|
||||
"set_attributes": "设置属性",
|
||||
"set_contents": "设置内容物",
|
||||
"enchant_randomly": "随机附魔",
|
||||
"enchant_with_levels": "给予等价于经验等级的随机附魔",
|
||||
"looting_enchant": "根据抢夺附魔调整物品数量",
|
||||
"limit_count": "限制堆叠数量",
|
||||
"furnace_smelt": "熔炉熔炼",
|
||||
"explosion_decay": "爆炸损耗",
|
||||
"fill_player_head": "填充玩家头颅",
|
||||
"copy_name": "复制方块实体显示名",
|
||||
"copy_nbt": "复制 NBT",
|
||||
"apply_bonus": "应用奖励公式",
|
||||
"$damage": {
|
||||
"damage": "损伤值"
|
||||
},
|
||||
"$ench_rand": {
|
||||
"ench": "可选附魔"
|
||||
},
|
||||
"$limit": {
|
||||
"limit": "限制"
|
||||
},
|
||||
"$name": {
|
||||
"name": "名称"
|
||||
},
|
||||
"$lore_replace": {
|
||||
"replace": "覆盖"
|
||||
},
|
||||
"$entity": {
|
||||
"entity": "实体"
|
||||
},
|
||||
"$operations": {
|
||||
"add_op": "添加操作"
|
||||
},
|
||||
"$formula": {
|
||||
"formula": "公式",
|
||||
"uniform_bonus_count": "带奖励数量的均匀分布",
|
||||
"binomial_with_bonus_count": "带奖励数量的二项分布",
|
||||
"ore_drops": "矿物掉落"
|
||||
},
|
||||
"$bonus_multiplier": {
|
||||
"multiplier": "乘数"
|
||||
},
|
||||
"$bonus_extra": {
|
||||
"extra": "额外值"
|
||||
},
|
||||
"$bonus_probability": {
|
||||
"probability": "概率"
|
||||
}
|
||||
},
|
||||
"$modifier": {
|
||||
"attribute": "属性",
|
||||
"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": "连带生成新僵尸的可能性",
|
||||
"name": "名称",
|
||||
"amount": "数额",
|
||||
"operation": "运算模式",
|
||||
"$operation": {
|
||||
"addition": "加减数额",
|
||||
"multiply_base": "乘以数额",
|
||||
"multiply_total": "乘以(数额 + 1)"
|
||||
},
|
||||
"slots": "栏位"
|
||||
},
|
||||
"$operation": {
|
||||
"source": "复制源",
|
||||
"target": "复制目标",
|
||||
"operation": "操作类型",
|
||||
"$operation": {
|
||||
"replace": "替换",
|
||||
"append": "追加",
|
||||
"merge": "合并"
|
||||
}
|
||||
},
|
||||
"$pool": {
|
||||
"rolls": "抽取次数",
|
||||
"bonus_rolls": "每级幸运增加的抽取次数"
|
||||
},
|
||||
"$range": {
|
||||
"exact": "精确值",
|
||||
"range": "范围",
|
||||
"$range": {
|
||||
"min": "最小值",
|
||||
"max": "最大值"
|
||||
},
|
||||
"binomial": "二项分布",
|
||||
"$binomial": {
|
||||
"n": "n",
|
||||
"p": "p"
|
||||
}
|
||||
},
|
||||
"$slot": {
|
||||
"mainhand": "主手",
|
||||
"offhand": "副手",
|
||||
"head": "头",
|
||||
"chest": "胸",
|
||||
"legs": "腿",
|
||||
"feet": "脚"
|
||||
},
|
||||
"$source": {
|
||||
"block_entity": "方块实体",
|
||||
"this": "自身",
|
||||
"killer": "击杀者",
|
||||
"killer_player": "击杀者玩家"
|
||||
},
|
||||
"$table": {
|
||||
"type": "战利品表类型",
|
||||
"$type": {
|
||||
"empty": "空",
|
||||
"entity": "实体",
|
||||
"block": "方块",
|
||||
"chest": "箱子",
|
||||
"fishing": "钓鱼",
|
||||
"generic": "通用"
|
||||
}
|
||||
},
|
||||
"2_spaces": "2 空格缩进",
|
||||
"4_spaces": "4 空格缩进",
|
||||
"add_block_state": "添加方块状态",
|
||||
"add_child": "添加子项目",
|
||||
"add_condition": "添加条件",
|
||||
"add_enchantment": "添加附魔",
|
||||
"add_entry": "添加项目",
|
||||
"add_function": "添加函数",
|
||||
"add_modifier": "添加属性修饰器",
|
||||
"add_operation": "添加操作",
|
||||
"add_pool": "添加随机池",
|
||||
"add_score": "添加分数",
|
||||
"add_term": "添加条件",
|
||||
"author": "作者 @Misode",
|
||||
"biome": "生物群系",
|
||||
"block": "方块",
|
||||
"block_state": "方块状态",
|
||||
"chance": "机率",
|
||||
"chance_plural": "机率",
|
||||
"child": "子项目",
|
||||
"condition": "条件",
|
||||
"copy": "复制",
|
||||
"count": "数量",
|
||||
"description": "适用于 Minecraft 1.14 的战利品表生成器",
|
||||
"dimension": "维度",
|
||||
"direct_entity": "直接来源实体",
|
||||
"durability": "耐久度",
|
||||
"enchantment": "附魔",
|
||||
"entity": "实体",
|
||||
"entry": "项目",
|
||||
"false": "否",
|
||||
"feature": "结构",
|
||||
"function": "函数",
|
||||
"hide_source": "隐藏源代码",
|
||||
"inverted": "取反",
|
||||
"item": "物品",
|
||||
"level_plural": "等级",
|
||||
"location": "位置",
|
||||
"looting_multiplier": "每级抢夺附魔增加的数",
|
||||
"luck_based": "受幸运等级影响",
|
||||
"modifier": "属性修饰器",
|
||||
"more": "更多选项",
|
||||
"name": "名称",
|
||||
"nbt": "NBT",
|
||||
"objective": "计分项",
|
||||
"operation": "操作",
|
||||
"pool": "随机池",
|
||||
"position": "位置",
|
||||
"potion": "药水",
|
||||
"raining": "下雨",
|
||||
"remove": "移除",
|
||||
"remove_block_state": "移除方块状态",
|
||||
"remove_condition": "移除条件",
|
||||
"remove_enchantment": "移除附魔",
|
||||
"remove_entry": "移除项目",
|
||||
"remove_function": "移除函数",
|
||||
"remove_modifier": "移除属性修饰器",
|
||||
"remove_operation": "移除操作",
|
||||
"remove_pool": "移除随机池",
|
||||
"remove_score": "移除分数",
|
||||
"remove_term": "移除条件",
|
||||
"score": "分数",
|
||||
"share": "分享",
|
||||
"show_source": "显示源代码",
|
||||
"source": "源",
|
||||
"source_entity": "根本来源实体",
|
||||
"tabs": "Tab 缩进",
|
||||
"tag": "标签",
|
||||
"term": "条件",
|
||||
"thundering": "雷雨",
|
||||
"title": "战利品表生成器",
|
||||
"treasure": "宝藏型附魔",
|
||||
"true": "是",
|
||||
"type": "类型",
|
||||
"unset": "未指定",
|
||||
"x": "X 坐标",
|
||||
"y": "Y 坐标",
|
||||
"z": "Z 坐标"
|
||||
}
|
||||
@@ -6,7 +6,6 @@ $('#indentationSelect').val("2");
|
||||
|
||||
let indentation = 2;
|
||||
let luck_based = false;
|
||||
const nodes = '.loot-table, .pool, .entry, .child, .term, .terms, .function, .condition, .modifier, .operation, .predicate, .location, .source-entity, .direct-entity';
|
||||
let table = {
|
||||
type: "minecraft:generic",
|
||||
pools: []
|
||||
@@ -16,8 +15,14 @@ addEntry($('#structure .pool').get());
|
||||
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
if (params.has('q')) {
|
||||
$('#source').val(params.get('q'));
|
||||
updateSouce();
|
||||
$('#source').val(atob(params.get('q')));
|
||||
updateSource();
|
||||
$('.container').removeClass('d-none');
|
||||
} else if (params.has('s')) {
|
||||
let short = params.get('s').slice(0, -7);
|
||||
window.location = 'https://zws.im/' + short;
|
||||
} else {
|
||||
$('.container').removeClass('d-none');
|
||||
}
|
||||
|
||||
function updateTableType() {
|
||||
@@ -42,21 +47,34 @@ function showSource() {
|
||||
$('#showSourceButton').addClass('d-none');
|
||||
}
|
||||
|
||||
function linkSource() {
|
||||
let link = window.location.origin + window.location.pathname + '?q=' + JSON.stringify(table);
|
||||
$('#copyTextarea').removeClass('d-none').val(link);
|
||||
async function linkSource() {
|
||||
let site = window.location.origin + window.location.pathname;
|
||||
let url = site + '?q=' + btoa(JSON.stringify(table));
|
||||
if (url.length <= 500) {
|
||||
let shortener = 'https://us-central1-zero-width-shortener.cloudfunctions.net/shortenURL?url=';
|
||||
let response = await fetch(shortener + url);
|
||||
let json = await response.json();
|
||||
let id = Math.random().toString(36).substring(2, 9);
|
||||
url = site + '?s=' + json.short + id;
|
||||
}
|
||||
$('#copyContainer').removeClass('d-none');
|
||||
$('#copyTextarea').val(url);
|
||||
$('#copyTextarea').get()[0].select();
|
||||
}
|
||||
|
||||
function copyLink() {
|
||||
$('#copyTextarea').get()[0].select();
|
||||
document.execCommand('copy');
|
||||
setTimeout(() => {
|
||||
$('#copyTextarea').addClass('d-none');
|
||||
}, 2000);
|
||||
$('#copyContainer').addClass('d-none');
|
||||
}, 100);
|
||||
}
|
||||
|
||||
function updateSouce() {
|
||||
function updateSource() {
|
||||
$('#source').removeClass('invalid');
|
||||
try {
|
||||
table = JSON.parse($('#source').val());
|
||||
} catch {
|
||||
} catch(e) {
|
||||
if ($('#source').val().length > 0) {
|
||||
$('#source').addClass('invalid');
|
||||
return;
|
||||
@@ -77,46 +95,64 @@ function copySource(el) {
|
||||
}
|
||||
|
||||
function getParent(el) {
|
||||
let $parent = $(el).closest(nodes);
|
||||
let index = $parent.attr('data-index');
|
||||
if ($parent.hasClass('loot-table')) {
|
||||
let $node = $(el).closest('[data-field]');
|
||||
let fields = $node.attr('data-field').split('.');
|
||||
if (fields.length === 1 && fields[0] === 'table') {
|
||||
return table;
|
||||
} else if ($parent.hasClass('pool')) {
|
||||
return getParent($parent.parent()).pools[index];
|
||||
} else if ($parent.hasClass('entry')) {
|
||||
return getParent($parent.parent()).entries[index];
|
||||
} else if ($parent.hasClass('child')) {
|
||||
return getParent($parent.parent()).children[index];
|
||||
} else if ($parent.hasClass('term')) {
|
||||
return getParent($parent.parent()).term;
|
||||
} else if ($parent.hasClass('terms')) {
|
||||
return getParent($parent.parent()).terms[index];
|
||||
} else if ($parent.hasClass('function')) {
|
||||
return getParent($parent.parent()).functions[index];
|
||||
} else if ($parent.hasClass('condition')) {
|
||||
return getParent($parent.parent()).conditions[index];
|
||||
} else if ($parent.hasClass('modifier')) {
|
||||
return getParent($parent.parent()).modifiers[index];
|
||||
} else if ($parent.hasClass('operation')) {
|
||||
return getParent($parent.parent()).ops[index];
|
||||
} else if ($parent.hasClass('predicate')) {
|
||||
return getParent($parent.parent()).predicate;
|
||||
} else if ($parent.hasClass('location')) {
|
||||
return getParent($parent.parent()).location;
|
||||
} else if ($parent.hasClass('source-entity')) {
|
||||
return getParent($parent.parent()).source_entity;
|
||||
} else if ($parent.hasClass('direct-entity')) {
|
||||
return getParent($parent.parent()).direct_entity;
|
||||
}
|
||||
if ($node.attr('data-type')) {
|
||||
fields = fields.slice(0, -1);
|
||||
}
|
||||
let node = getParent($node.parent());
|
||||
for (let f of fields) {
|
||||
if (f.endsWith('[]')) {
|
||||
f = f.slice(0, -2);
|
||||
let index = $node.attr('data-index');
|
||||
node = node[f][index];
|
||||
} else {
|
||||
if (node[f] === undefined) {
|
||||
node[f] = {};
|
||||
}
|
||||
node = node[f];
|
||||
}
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
function getSuperParent(el) {
|
||||
let $parent = $(el).closest(nodes);
|
||||
let $parent = $(el).closest('[data-field]');
|
||||
return getParent($parent.parent());
|
||||
}
|
||||
|
||||
function setField(node, field, value) {
|
||||
let fields = field.split('.');
|
||||
let last = fields.splice(-1)[0];
|
||||
for (let f of fields) {
|
||||
node = node[f];
|
||||
}
|
||||
node[last] = value;
|
||||
}
|
||||
|
||||
function deleteField(node, field) {
|
||||
let fields = field.split('.');
|
||||
let last = fields.splice(-1)[0];
|
||||
for (let f of fields) {
|
||||
node = node[f];
|
||||
}
|
||||
delete node[last];
|
||||
}
|
||||
|
||||
function getField(node, field) {
|
||||
let fields = field.split('.');
|
||||
let last = fields.splice(-1)[0];
|
||||
for (let f of fields) {
|
||||
node = node[f];
|
||||
}
|
||||
return node[last];
|
||||
}
|
||||
|
||||
function getIndex(el) {
|
||||
let $parent = $(el).closest(nodes);
|
||||
let $parent = $(el).closest('[data-field]');
|
||||
return parseInt($parent.attr('data-index'));
|
||||
}
|
||||
|
||||
@@ -130,16 +166,6 @@ function addPool(el) {
|
||||
invalidated();
|
||||
}
|
||||
|
||||
function removePool(el) {
|
||||
let parent = getSuperParent(el);
|
||||
let index = getIndex(el);
|
||||
parent.pools.splice(index, 1);
|
||||
if (parent.pools.length === 0) {
|
||||
delete parent.pools;
|
||||
}
|
||||
invalidated();
|
||||
}
|
||||
|
||||
function addEntry(el) {
|
||||
let pool = getParent(el);
|
||||
if (!pool.entries) {
|
||||
@@ -152,16 +178,6 @@ function addEntry(el) {
|
||||
invalidated();
|
||||
}
|
||||
|
||||
function removeEntry(el) {
|
||||
let parent = getSuperParent(el);
|
||||
let index = getIndex(el);
|
||||
parent.entries.splice(index, 1);
|
||||
if (parent.entries.length === 0) {
|
||||
delete parent.entries;
|
||||
}
|
||||
invalidated();
|
||||
}
|
||||
|
||||
function addChild(el) {
|
||||
let entry = getParent(el);
|
||||
if (!entry.children) {
|
||||
@@ -174,16 +190,6 @@ function addChild(el) {
|
||||
invalidated();
|
||||
}
|
||||
|
||||
function removeChild(el) {
|
||||
let parent = getSuperParent(el);
|
||||
let index = getIndex(el);
|
||||
parent.children.splice(index, 1);
|
||||
if (parent.children.length === 0) {
|
||||
delete parent.children;
|
||||
}
|
||||
invalidated();
|
||||
}
|
||||
|
||||
function addFunction(el) {
|
||||
let entry = getParent(el);
|
||||
if (!entry.functions) {
|
||||
@@ -195,15 +201,6 @@ function addFunction(el) {
|
||||
invalidated();
|
||||
}
|
||||
|
||||
function removeFunction(el) {
|
||||
let parent = getSuperParent(el);
|
||||
parent.functions.splice(getIndex(el), 1);
|
||||
if (parent.functions.length === 0) {
|
||||
delete parent.functions;
|
||||
}
|
||||
invalidated();
|
||||
}
|
||||
|
||||
function addCondition(el) {
|
||||
let parent = getParent(el);
|
||||
if (!parent.conditions) {
|
||||
@@ -216,161 +213,115 @@ function addCondition(el) {
|
||||
invalidated();
|
||||
}
|
||||
|
||||
function removeCondition(el) {
|
||||
let parent = getSuperParent(el);
|
||||
if (parent.conditions) {
|
||||
parent.conditions.splice(getIndex(el), 1);
|
||||
if (parent.conditions.length === 0) {
|
||||
delete parent.conditions;
|
||||
function updateField(el) {
|
||||
let $field = $(el).closest('[data-field]');
|
||||
let fields = $field.attr('data-field');
|
||||
let field = fields.split('.').slice(-1)[0];
|
||||
let type = $field.attr('data-type');
|
||||
let node = getParent(el);
|
||||
let value = undefined;
|
||||
|
||||
if (type === 'string' || type === 'int' || type === 'float' || type === 'enum' || type === 'json' || type === 'nbt') {
|
||||
value = $(el).val();
|
||||
}
|
||||
if (type === 'int') {
|
||||
value = parseInt(value);
|
||||
if (isNaN(value)) {
|
||||
value = '';
|
||||
}
|
||||
} else {
|
||||
parent.terms.splice(getIndex(el), 1);
|
||||
if (parent.terms.length === 0) {
|
||||
delete parent.terms;
|
||||
} else if (type === 'float') {
|
||||
value = parseFloat(value);
|
||||
if (isNaN(value)) {
|
||||
value = '';
|
||||
}
|
||||
} else if (type === 'nbt') {
|
||||
|
||||
if (!value.startsWith('{')) {
|
||||
value = '{' + value;
|
||||
}
|
||||
if (!value.endsWith('}')) {
|
||||
value = value + '}';
|
||||
}
|
||||
} else if (type === 'json') {
|
||||
value = parseJSONValue(value)
|
||||
} else if (type === 'range') {
|
||||
value = getRangeValue($field, node[field]);
|
||||
} else if (type === 'checkbox') {
|
||||
value = $(el).prop('checked');
|
||||
} else if (type === 'boolean') {
|
||||
value = getBooleanValue(node[field], ($(el).val() === 'true'));
|
||||
}
|
||||
invalidated();
|
||||
}
|
||||
|
||||
function updateValue(root, field, value) {
|
||||
let f = field.split('.');
|
||||
if (f.length === 1) return root[f[0]] = value;
|
||||
if (!root[f[0]]) root[f[0]] = {};
|
||||
if (f.length === 2) return root[f[0]][f[1]] = value;
|
||||
if (!root[f[0]][f[1]]) root[f[0]][f[1]] = {};
|
||||
if (f.length === 3) return root[f[0]][f[1]][f[2]] = value;
|
||||
if (!root[f[0]][f[1]][f[2]]) root[f[0]][f[1]][f[2]] = {};
|
||||
if (f.length === 4) return root[f[0]][f[1]][f[2]][f[3]] = value;
|
||||
if (!root[f[0]][f[1]][f[2]][f[3]]) root[f[0]][f[1]][f[2]][f[3]] = {};
|
||||
if (f.length === 5) return root[f[0]][f[1]][f[2]][f[3]][f[4]] = value;
|
||||
if (!root[f[0]][f[1]][f[2]][f[3]][f[4]]) root[f[0]][f[1]][f[2]][f[3]][f[4]] = {};
|
||||
if (f.length === 6) return root[f[0]][f[1]][f[2]][f[3]][f[4]][f[5]] = value;
|
||||
}
|
||||
|
||||
function deleteValue(root, field) {
|
||||
let f = field.split('.');
|
||||
if (f.length === 1) delete root[f[0]];
|
||||
if (f.length === 2) delete root[f[0]][f[1]];
|
||||
if (f.length === 3) delete root[f[0]][f[1]][f[2]];
|
||||
if (f.length === 4) delete root[f[0]][f[1]][f[2]][f[3]];
|
||||
if (f.length === 5) delete root[f[0]][f[1]][f[2]][f[3]][f[4]];
|
||||
if (f.length === 6) delete root[f[0]][f[1]][f[2]][f[3]][f[4]][f[6]];
|
||||
}
|
||||
|
||||
function getValue(root, field) {
|
||||
let f = field.split('.');
|
||||
if (f.length === 1) return root[f[0]];
|
||||
if (f.length === 2) return root[f[0]][f[1]];
|
||||
if (f.length === 3) return root[f[0]][f[1]][f[2]];
|
||||
if (f.length === 4) return root[f[0]][f[1]][f[2]][f[3]];
|
||||
if (f.length === 5) return root[f[0]][f[1]][f[2]][f[3]][f[4]];
|
||||
if (f.length === 6) return root[f[0]][f[1]][f[2]][f[3]][f[4]][f[6]];
|
||||
}
|
||||
|
||||
function updateField(el, field) {
|
||||
updateValue(getParent(el), field, $(el).val());
|
||||
invalidated();
|
||||
}
|
||||
|
||||
function updateJSONField(el, field) {
|
||||
let value = parseJSONValue($(el).val());
|
||||
updateValue(getParent(el), field, value);
|
||||
invalidated();
|
||||
}
|
||||
|
||||
function updateIntField(el, field) {
|
||||
let value = parseInt($(el).val());
|
||||
if (isNaN(value)) {
|
||||
deleteValue(getParent(el), field);
|
||||
if (value === '') {
|
||||
deleteField(node, field);
|
||||
} else {
|
||||
updateValue(getParent(el), field, value);
|
||||
setField(node, field, value);
|
||||
}
|
||||
invalidated();
|
||||
}
|
||||
|
||||
function updateFloatField(el, field) {
|
||||
let value = parseFloat($(el).val());
|
||||
if (isNaN(value)) {
|
||||
deleteValue(getParent(el), field);
|
||||
} else {
|
||||
updateValue(getParent(el), field, value);
|
||||
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 updateCheckedField(el, field) {
|
||||
getParent(el)[field] = $(el).prop('checked');
|
||||
invalidated();
|
||||
}
|
||||
|
||||
function updateRangeType(el, field, type) {
|
||||
function updateRangeType(el) {
|
||||
let $field = $(el).closest('[data-field]');
|
||||
let field = $field.attr('data-field');
|
||||
let type = $(el).attr('value');
|
||||
if (type === 'range') {
|
||||
updateValue(getParent(el), field, {});
|
||||
setField(getParent(el), field, {});
|
||||
} else if (type === 'binomial') {
|
||||
updateValue(getParent(el), field, {type: "minecraft:binomial"});
|
||||
setField(getParent(el), field, {type: "minecraft:binomial"});
|
||||
} else {
|
||||
updateValue(getParent(el), field, 0);
|
||||
setField(getParent(el), field, 0);
|
||||
}
|
||||
updateRangeField(el, field);
|
||||
updateField(el);
|
||||
}
|
||||
|
||||
function updateRangeField(el, field) {
|
||||
let parent = getParent(el);
|
||||
let data = getValue(parent, field);
|
||||
let $range = $(el).closest('[data-type="range"]');
|
||||
function getRangeValue($field, data) {
|
||||
console.log(data);
|
||||
if (typeof data === 'object') {
|
||||
console.log('object');
|
||||
if (data.type && data.type.match(/(minecraft:)?binomial/)) {
|
||||
let n = $range.find('.binomial.n').val();
|
||||
let p = $range.find('.binomial.p').val();
|
||||
if (n) {
|
||||
data.n = parseInt(n);
|
||||
} else {
|
||||
delete data.n;
|
||||
}
|
||||
if (p) {
|
||||
data.p = parseFloat(p);
|
||||
} else {
|
||||
delete data.min;
|
||||
}
|
||||
let n = $field.find('.binomial.n').val();
|
||||
let p = $field.find('.binomial.p').val();
|
||||
if (n) data.n = parseInt(n);
|
||||
else delete data.n;
|
||||
if (p) data.p = parseFloat(p);
|
||||
else delete data.p;
|
||||
} else {
|
||||
let min = $range.find('.range.min').val();
|
||||
let max = $range.find('.range.max').val();
|
||||
if (min) {
|
||||
data.min = parseFloat(min);
|
||||
} else {
|
||||
delete data.min;
|
||||
}
|
||||
if (max) {
|
||||
data.max = parseFloat(max);
|
||||
} else {
|
||||
delete data.max;
|
||||
}
|
||||
let min = $field.find('.range.min').val();
|
||||
let max = $field.find('.range.max').val();
|
||||
if (min) data.min = parseFloat(min);
|
||||
else delete data.min;
|
||||
if (max) data.max = parseFloat(max);
|
||||
else delete data.max;
|
||||
}
|
||||
} else {
|
||||
data = parseFloat($range.find('.exact').val());
|
||||
console.log('else');
|
||||
data = parseFloat($field.find('.exact').val());
|
||||
if (isNaN(data)) {
|
||||
data = '';
|
||||
}
|
||||
}
|
||||
updateValue(parent, field, data);
|
||||
invalidated();
|
||||
return data;
|
||||
}
|
||||
|
||||
function updateRadioField(el, field) {
|
||||
let parent = getParent(el);
|
||||
let value = $(el).val();
|
||||
let oldvalue = getValue(parent, field);
|
||||
if (value === 'true') {
|
||||
if (oldvalue === true) {
|
||||
deleteValue(parent, field);
|
||||
} else {
|
||||
updateValue(getParent(el), field, true);
|
||||
}
|
||||
} else if (value === 'false') {
|
||||
if (oldvalue === false) {
|
||||
deleteValue(parent, field);
|
||||
} else {
|
||||
updateValue(getParent(el), field, false);
|
||||
}
|
||||
function getBooleanValue(oldvalue, newvalue) {
|
||||
if (oldvalue === newvalue) {
|
||||
return '';
|
||||
} else if (newvalue) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
invalidated();
|
||||
}
|
||||
|
||||
function addEnchantment(el) {
|
||||
@@ -411,30 +362,21 @@ function addModifier(el) {
|
||||
invalidated();
|
||||
}
|
||||
|
||||
function removeModifier(el) {
|
||||
let index = parseInt($(el).closest('.modifier').attr('data-index'));
|
||||
getSuperParent(el).modifiers.splice(index, 1);
|
||||
invalidated();
|
||||
}
|
||||
|
||||
function addModifierSlot(el) {
|
||||
let modifier = getParent(el);
|
||||
if (!modifier.slots) {
|
||||
modifier.slots = [];
|
||||
if (!modifier.slot) {
|
||||
modifier.slot = [];
|
||||
}
|
||||
modifier.slots.push($(el).attr('data-slot'));
|
||||
modifier.slot.push($(el).attr('data-slot'));
|
||||
invalidated();
|
||||
}
|
||||
|
||||
function removeModifierSlot(el) {
|
||||
let modifier = getParent(el);
|
||||
let slot = $(el).attr('data-slot');
|
||||
let index = modifier.slots.indexOf(slot);
|
||||
let index = modifier.slot.indexOf(slot);
|
||||
if (index > -1) {
|
||||
modifier.slots.splice(index, 1);
|
||||
if (modifier.slots.length === 0) {
|
||||
delete modifier.slots;
|
||||
}
|
||||
modifier.slot.splice(index, 1);
|
||||
invalidated();
|
||||
}
|
||||
}
|
||||
@@ -499,7 +441,7 @@ function parseJSONValue(value) {
|
||||
if (value.startsWith('"') || value.startsWith('{') || value.startsWith('[')) {
|
||||
try {
|
||||
return JSON.parse(value);
|
||||
} catch {
|
||||
} catch(e) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
@@ -591,23 +533,23 @@ function toggleEntityLocation(el) {
|
||||
|
||||
function updateItemType(el, type) {
|
||||
let $predicate = $(el).closest('.predicate');
|
||||
if (type === 'name') {
|
||||
$predicate.find('.name').removeClass('d-none');
|
||||
if (type === 'item') {
|
||||
$predicate.find('.item').removeClass('d-none');
|
||||
$predicate.find('.tag').addClass('d-none');
|
||||
} else {
|
||||
$predicate.find('.tag').removeClass('d-none');
|
||||
$predicate.find('.name').addClass('d-none');
|
||||
$predicate.find('.item').addClass('d-none');
|
||||
}
|
||||
}
|
||||
|
||||
function updateItemField(el, type) {
|
||||
let parent = getParent(el);
|
||||
if (type === 'name') {
|
||||
parent.name = $(el).closest('.predicate').find('input.name').val();
|
||||
if (type === 'item') {
|
||||
parent.item = $(el).closest('.predicate').find('input.item').val();
|
||||
delete parent.tag;
|
||||
} else {
|
||||
parent.tag = $(el).closest('.predicate').find('input.tag').val();
|
||||
delete parent.name;
|
||||
delete parent.item;
|
||||
}
|
||||
invalidated();
|
||||
}
|
||||
@@ -652,8 +594,20 @@ function updateChancesField(el) {
|
||||
parent.chances[i] = 1;
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
} catch(e) {
|
||||
parent.chances = [];
|
||||
}
|
||||
invalidated();
|
||||
}
|
||||
|
||||
function addConditionEnchantment(el) {
|
||||
let condition = getParent(el);
|
||||
if (!condition.enchantments) {
|
||||
condition.enchantments = [];
|
||||
}
|
||||
condition.enchantments.push({
|
||||
enchantment: 'minecraft:silk_touch',
|
||||
level: 1
|
||||
});
|
||||
invalidated();
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ function generateEntry(entry, i, size) {
|
||||
if (entry.children) {
|
||||
for (let j = 0; j < entry.children.length; j += 1) {
|
||||
let $child = generateEntry(entry.children[j], j, entry.children.length);
|
||||
$child.removeClass('entry').addClass('child');
|
||||
$child.attr('data-field', 'children[]');
|
||||
$entry.children('.card-body').append($child);
|
||||
}
|
||||
}
|
||||
@@ -216,8 +216,8 @@ function generateFunction(func, i) {
|
||||
delete func.treasure;
|
||||
}
|
||||
|
||||
if (func.function === 'minecraft:looting_enchant' || func.function === 'minecraft:looting_enchant' || func.function === 'minecraft:limit_count') {
|
||||
if (func.function === 'minecraft:looting_enchant' || func.function === 'minecraft:limit_count') {
|
||||
if (func.function === 'minecraft:looting_enchant' || func.function === 'minecraft:limit_count') {
|
||||
if (func.function === 'minecraft:looting_enchant') {
|
||||
$function.find('.function-limit').removeClass('d-none');
|
||||
$function.find('.function-limit input').val(func.limit);
|
||||
} else {
|
||||
@@ -317,7 +317,7 @@ function generateFunction(func, i) {
|
||||
|
||||
if (func.function === 'minecraft:apply_bonus') {
|
||||
$function.find('.function-enchantment').removeClass('d-none');
|
||||
$function.find('.function-entity input').val(func.enchantment);
|
||||
$function.find('.function-enchantment input').val(func.enchantment);
|
||||
} else {
|
||||
delete func.enchantment;
|
||||
}
|
||||
@@ -392,8 +392,8 @@ function generateModifier(modifier, i) {
|
||||
generateRange($modifier.find('.modifier-amount'), modifier.amount);
|
||||
$modifier.find('.modifier-operation').val(modifier.operation);
|
||||
|
||||
if (modifier.slots) {
|
||||
for (let s of modifier.slots) {
|
||||
if (modifier.slot) {
|
||||
for (let s of modifier.slot) {
|
||||
let item = $modifier.find('.dropdown-item[data-slot="' + s + '"]');
|
||||
item.addClass('d-none');
|
||||
let html = '<button type="button" class="btn btn-outline-danger bg-light btn-sm mr-2 mt-2" data-slot="' + s + '" onclick="removeModifierSlot(this)">' + item.text() + '</button>';
|
||||
@@ -423,7 +423,7 @@ function generateCondition(condition, i) {
|
||||
$condition.find('.condition-type').val(condition.condition);
|
||||
|
||||
if (table.type === 'minecraft:generic') {
|
||||
$condition.find('option[value="minecraft:blockstate_propery"]').addClass('d-none');
|
||||
$condition.find('option[value="minecraft:block_state_propery"]').addClass('d-none');
|
||||
$condition.find('option[value="minecraft:match_tool"]').addClass('d-none');
|
||||
$condition.find('option[value="minecraft:damage_source_properties"]').addClass('d-none');
|
||||
$condition.find('option[value="minecraft:survives_explosion"]').addClass('d-none');
|
||||
@@ -431,17 +431,17 @@ function generateCondition(condition, i) {
|
||||
} else if (table.type === 'minecraft:block') {
|
||||
$condition.find('option[value="minecraft:damage_source_properties"]').addClass('d-none');
|
||||
} else if (table.type === 'minecraft:fishing') {
|
||||
$condition.find('option[value="minecraft:blockstate_propery"]').addClass('d-none');
|
||||
$condition.find('option[value="minecraft:block_state_propery"]').addClass('d-none');
|
||||
$condition.find('option[value="minecraft:damage_source_properties"]').addClass('d-none');
|
||||
$condition.find('option[value="minecraft:survives_explosion"]').addClass('d-none');
|
||||
$condition.find('option[value="minecraft:table_bonus"]').addClass('d-none');
|
||||
} else if (table.type === 'minecraft:entity') {
|
||||
$condition.find('option[value="minecraft:blockstate_propery"]').addClass('d-none');
|
||||
$condition.find('option[value="minecraft:block_state_propery"]').addClass('d-none');
|
||||
$condition.find('option[value="minecraft:survives_explosion"]').addClass('d-none');
|
||||
$condition.find('option[value="minecraft:table_bonus"]').addClass('d-none');
|
||||
$condition.find('option[value="minecraft:match_tool"]').addClass('d-none');
|
||||
} else if (table.type === 'minecraft:chest') {
|
||||
$condition.find('option[value="minecraft:blockstate_propery"]').addClass('d-none');
|
||||
$condition.find('option[value="minecraft:block_state_propery"]').addClass('d-none');
|
||||
$condition.find('option[value="minecraft:damage_source_properties"]').addClass('d-none');
|
||||
$condition.find('option[value="minecraft:survives_explosion"]').addClass('d-none');
|
||||
$condition.find('option[value="minecraft:table_bonus"]').addClass('d-none');
|
||||
@@ -488,7 +488,7 @@ function generateCondition(condition, i) {
|
||||
delete condition.entity;
|
||||
}
|
||||
|
||||
if (condition.condition === 'minecraft:blockstate_propery') {
|
||||
if (condition.condition === 'minecraft:block_state_propery') {
|
||||
$condition.find('.condition-block').removeClass('d-none');
|
||||
$condition.find('.condition-block input').val(condition.block);
|
||||
$condition.find('.condition-block-properties').removeClass('d-none');
|
||||
@@ -623,7 +623,7 @@ function generateCondition(condition, i) {
|
||||
|
||||
if (condition.term) {
|
||||
let $term = generateCondition(condition.term, 0);
|
||||
$term.removeClass('condition').addClass('term');
|
||||
$term.attr('data-field', 'term');
|
||||
$term.find('.card-header').remove();
|
||||
$condition.children('.card-body').append($term);
|
||||
}
|
||||
@@ -631,7 +631,7 @@ function generateCondition(condition, i) {
|
||||
if (condition.terms) {
|
||||
for (let j = 0; j < condition.terms.length; j += 1) {
|
||||
let $term = generateCondition(condition.terms[j], j);
|
||||
$term.removeClass('condition').addClass('terms');
|
||||
$term.attr('data-field', 'terms[]');
|
||||
$condition.children('.card-body').append($term);
|
||||
}
|
||||
}
|
||||
@@ -693,7 +693,7 @@ function generateEntity(entity) {
|
||||
}
|
||||
if (entity.location) {
|
||||
let $location = generateLocation(entity.location);
|
||||
$location.removeClass('predicate').addClass('location');
|
||||
$location.attr('data-field', 'location');
|
||||
$entity.children('.card-body').append($location);
|
||||
}
|
||||
if (entity.nbt) {
|
||||
@@ -733,14 +733,14 @@ function generateItem(item) {
|
||||
if (item.tag) {
|
||||
$item.find('.tag').removeClass('d-none').val(item.tag);
|
||||
} else {
|
||||
$item.find('.name').removeClass('d-none').val(item.name);
|
||||
$item.find('.item').removeClass('d-none').val(item.item);
|
||||
}
|
||||
generateRange($item.find('.item-count'), item.count);
|
||||
generateRange($item.find('.item-durability'), item.durability);
|
||||
$item.find('.nbt').val(item.nbt).keydown(e => preventNewline(e));
|
||||
$item.find('.potion').val(item.potion);
|
||||
if (item.name === '') {
|
||||
delete item.name;
|
||||
if (item.item === '') {
|
||||
delete item.item;
|
||||
}
|
||||
if (item.tag === '') {
|
||||
delete item.tag;
|
||||
@@ -752,11 +752,18 @@ function generateItem(item) {
|
||||
delete item.nbt;
|
||||
}
|
||||
|
||||
if (item.enchantments) {
|
||||
for (let j = 0; j < item.enchantments.length; j += 1) {
|
||||
let $enchantment = generateEnchantment(item.enchantments[j], j);
|
||||
$item.children('.card-body').append($enchantment);
|
||||
}
|
||||
}
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
function generateDamage(damage) {
|
||||
let $damage = $('#damageTemplate').clone().removeAttr('id').addClass('predicate');
|
||||
let $damage = $('#damageTemplate').clone().removeAttr('id');
|
||||
if (!damage) {
|
||||
damage = {};
|
||||
}
|
||||
@@ -774,12 +781,12 @@ function generateDamage(damage) {
|
||||
|
||||
if (damage.source_entity) {
|
||||
let $entity = generateEntity(damage.source_entity);
|
||||
$entity.removeClass('predicate');
|
||||
$entity.attr('data-field', 'source_entity');
|
||||
$damage.find('.source-entity').append($entity);
|
||||
}
|
||||
if (damage.direct_entity) {
|
||||
let $entity = generateEntity(damage.direct_entity);
|
||||
$entity.removeClass('predicate');
|
||||
$entity.attr('data-field', 'direct_entity');
|
||||
$damage.find('.direct-entity').append($entity);
|
||||
}
|
||||
|
||||
@@ -796,3 +803,13 @@ function generateDamage(damage) {
|
||||
|
||||
return $damage;
|
||||
}
|
||||
|
||||
function generateEnchantment(enchantment, i) {
|
||||
let $enchantment = $('#enchantmentTemplate').clone();
|
||||
$enchantment.removeAttr('id').attr('data-index', i);
|
||||
|
||||
$enchantment.find('.enchantment-id').val(enchantment.enchantment);
|
||||
generateRange($enchantment.find('.enchantment-levels'), enchantment.levels);
|
||||
|
||||
return $enchantment;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user