diff --git a/index.html b/index.html
index 1bfb8682..decb7c33 100644
--- a/index.html
+++ b/index.html
@@ -102,19 +102,19 @@
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($('
'), value.value, struct.source));
+ $el.find('select').append(setValueAndName($('
'), value.value, struct.translateValue));
}
} else {
- $el.find('select').append(setValueAndName($('
'), value, struct.source));
+ $el.find('select').append(setValueAndName($('
'), value, struct.translateValue));
}
}
$el.find('select').val(data);
@@ -171,21 +171,21 @@ function generateEnum(data, struct) {
function generateSet(data, struct) {
let $el = $('#components').find('[data-type="set"]').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];
}
for (let value of collection) {
let $item = $('
');
- setValueAndName($item, value, struct.source);
+ setValueAndName($item, value, struct.translateValue);
$el.find('.dropdown-menu').append($item);
}
if (data) {
let $setContainer = $('
');
for (let option of data) {
let $item = $('
').addClass('btn btn-outline-danger bg-light btn-sm mr-2 mt-2');
- setValueAndName($item, option, struct.source);
+ setValueAndName($item, option, struct.translateValue);
$setContainer.append($item);
}
$el.append($setContainer);
@@ -196,12 +196,13 @@ function generateSet(data, struct) {
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.id);
- $el.find('[data-name="2"]').attr('data-i18n', 'add_' + struct.id);
+ $el.find('[data-name="1"]').attr('data-i18n', struct.translate);
+ $el.find('[data-name="2"]').attr('data-i18n', struct.translateValue + '_add');
$el.find('input').keypress((e) => {if (e.which == 13) addToMap(e.target);});
if (data) {
for (let key of Object.keys(data)) {
- let $item = generateComponent(data[key], {id: key, type: struct.values.type});
+ console.log(data[key]);
+ let $item = generateComponent(data[key], {id: key, type: struct.values.type, translate: key});
$item.append('
');
$el.append($item);
}
@@ -210,7 +211,8 @@ function generateMap(data, struct) {
}
function setValueAndName($el, value, source) {
- let option = value.split(':').slice(-1);
+ let option = value.split(':').slice(-1)[0];
+ option.replace(/\./, '_');
let name = (source) ? source + '.' + option : option;
return $el.attr('value', value).attr('data-i18n', name);
}
@@ -218,7 +220,7 @@ function setValueAndName($el, value, source) {
function generateJson(data, struct) {
let $el = $('#components').find('[data-type="json"]').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 !== 'string') {
data = JSON.stringify(data);
}
@@ -229,7 +231,7 @@ function generateJson(data, struct) {
function generateJsonList(data, struct) {
let $el = $('#components').find('[data-type="json-list"]').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 jsonList = "";
if (data) {
for (let j = 0; j < data.length; j += 1) {
@@ -250,7 +252,7 @@ function generateJsonList(data, struct) {
function generateNbt(data, struct) {
let $el = $('#components').find('[data-type="nbt"]').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);
$el.find('textarea').val(data).keydown(e => preventNewline(e));
return $el;
}
@@ -288,7 +290,7 @@ function generateObject(data, struct, header) {
let $header = $('');
if (header) {
$header.appendTo($el);
- $header.append('
');
+ $header.append('
');
}
let $body = $('
').appendTo($el);
if (!struct.fields) {
@@ -299,7 +301,7 @@ function generateObject(data, struct, header) {
for (let field of struct.fields) {
let $field;
if (field.collapse) {
- $body.append('
');
+ $body.append('
');
if (data[field.id] === undefined) {
$body.append('
');
continue;
@@ -319,10 +321,10 @@ function generateObject(data, struct, header) {
color = components.find(e => e.id === field.values).color;
}
if (header && field.button === 'header') {
- $header.append('
');
+ $header.append('
');
}
if (field.button === 'field') {
- $body.append('
');
+ $body.append('
');
}
}
$body.append($field);