Support placeholders in maps

This commit is contained in:
SPGoding
2019-12-25 09:38:59 -06:00
parent fedc9ad6ff
commit 2dcfaf8323
4 changed files with 22 additions and 1 deletions

View File

@@ -273,6 +273,12 @@
"nbt_operation.target": "Target",
"nbt_operation_add": "Add Operation",
"nbt_operation_remove": "Remove Operation",
"placeholder.advancement": "An advancement ID",
"placeholder.block_state": "A block state key",
"placeholder.effect": "An status effect ID",
"placeholder.fluid_state": "A fluid state key",
"placeholder.objective": "An scoreboard objective",
"placeholder.recipe": "An recipe ID",
"pool.bonus_rolls": "Bonus Rolls",
"pool.rolls": "Rolls",
"pool_add": "Add Pool",

View File

@@ -270,6 +270,12 @@
"nbt_operation.target": "复制目标",
"nbt_operation_add": "添加操作",
"nbt_operation_remove": "移除操作",
"placeholder.advancement": "一个进度 ID",
"placeholder.block_state": "一个方块状态键",
"placeholder.effect": "一个状态效果 ID",
"placeholder.fluid_state": "一个流体状态键",
"placeholder.objective": "一个记分项",
"placeholder.recipe": "一个配方 ID",
"pool.bonus_rolls": "每级幸运增加的抽取次数",
"pool.rolls": "抽取次数",
"pool_add": "添加随机池",

View File

@@ -638,6 +638,7 @@
"id": "properties",
"type": "map",
"translate": "condition.block_state",
"translatePlaceholder": "placeholder.block_state",
"values": {
"type": "string"
},
@@ -649,6 +650,7 @@
"id": "scores",
"type": "map",
"translate": "condition.score",
"translatePlaceholder": "placeholder.objective",
"values": {
"type": "range"
},
@@ -967,6 +969,7 @@
"id": "advancements",
"type": "map",
"translate": "entity.player.advancements",
"translatePlaceholder": "placeholder.advancement",
"values": {
"type": "boolean"
}
@@ -975,6 +978,7 @@
"id": "recipes",
"type": "map",
"translate": "entity.player.recipes",
"translatePlaceholder": "placeholder.recipe",
"values": {
"type": "boolean"
}
@@ -992,6 +996,7 @@
"id": "effects",
"type": "map",
"translate": "entity.status_effect",
"translatePlaceholder": "placeholder.effect",
"values": {
"type": "object",
"value": "status_effect"
@@ -1091,6 +1096,7 @@
"id": "state",
"type": "map",
"translate": "location.block.state",
"translatePlaceholder": "placeholder.block_state",
"values": {
"type": "string"
}
@@ -1118,6 +1124,7 @@
"id": "state",
"type": "map",
"translate": "location.fluid.state",
"translatePlaceholder": "placeholder.fluid_state",
"values": {
"type": "string"
}

View File

@@ -253,11 +253,13 @@ function generateSet(data, struct) {
function generateMap(data, struct) {
let $el = $('#components').find('[data-type="map"]').clone();
let $input = $el.find('input')
let out;
$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.translate + '_add');
$el.find('input').keypress((e) => {if (e.which == 13) addToMap(e.target);});
$input.attr('data-i18n', `[placeholder]${struct.translatePlaceholder}`);
$input.keypress((e) => {if (e.which == 13) addToMap(e.target);});
if (data) {
for (let key of Object.keys(data)) {
out = out || {}