diff --git a/index.html b/index.html
index d3aafdfd..5b6c4d42 100644
--- a/index.html
+++ b/index.html
@@ -28,6 +28,7 @@
diff --git a/locales/en.json b/locales/en.json
index 8895e6bd..3d56ede5 100644
--- a/locales/en.json
+++ b/locales/en.json
@@ -129,6 +129,7 @@
"fill_player_head": "Fill Player Head",
"copy_name": "Copy Name",
"copy_nbt": "Copy NBT",
+ "copy_state": "Copy Block States",
"apply_bonus": "Apply Bonus",
"exploration_map": "Exploration Map Properties",
"set_stew_effect": "Set Stew Effect"
@@ -143,6 +144,8 @@
"levels": "Levels",
"treasure": "Treasure",
"limit": "Limit",
+ "block": "Block",
+ "properties": "Properties",
"entity": "Entity",
"source": "Source",
"replace": "Replace",
diff --git a/locales/ru.json b/locales/ru.json
index 8999af85..16424159 100644
--- a/locales/ru.json
+++ b/locales/ru.json
@@ -140,6 +140,7 @@
"levels": "Уровень",
"treasure": "Чары-сокровища",
"limit": "Ограничение",
+ "block": "Блок",
"entity": "Сущность",
"source": "Источник",
"replace": "Заменить старое",
diff --git a/locales/zh-CN.json b/locales/zh-CN.json
index 9699652f..33edd3bd 100644
--- a/locales/zh-CN.json
+++ b/locales/zh-CN.json
@@ -140,6 +140,7 @@
"levels": "等级",
"treasure": "宝藏型附魔",
"limit": "限制",
+ "block": "方块",
"entity": "实体",
"source": "源",
"replace": "覆盖",
diff --git a/model.js b/model.js
index b2cbb8f7..b04b39e5 100644
--- a/model.js
+++ b/model.js
@@ -283,7 +283,7 @@ function updateField(el) {
let type = getType(el);
let value = undefined;
- if (type === 'string' || type === 'int' || type === 'float' || type === 'enum' || type === 'json' || type === 'nbt' || type === 'chance-list') {
+ if (type === 'string' || type === 'int' || type === 'float' || type === 'enum' || type === 'json' || type === 'nbt' || type === 'string-list' || type === 'chance-list') {
value = $(el).val();
}
if (type === 'int') {
@@ -296,19 +296,21 @@ function updateField(el) {
if (isNaN(value)) {
value = '';
}
- } else if (type === 'chance-list') {
- value = '[' + value + ']';
- try {
- value = JSON.parse(value);
- for (let i = 0; i < value.length; i += 1) {
+ } else if (type === 'string-list' || type === 'chance-list') {
+ value = value.split(',');
+ for (let i = 0; i < value.length; i += 1) {
+ value[i] = value[i].trim();
+ if (type === 'chance-list') {
+ if (isNaN(value[i])) {
+ value = [];
+ break;
+ }
if (value[i] > 1) {
value[i] = 1;
} else if (value[i] < 0) {
value[i] = 0;
}
}
- } catch(e) {
- value = [];
}
} else if (type === 'enum') {
if (value === 'unset') {
diff --git a/schemas/1.15.json b/schemas/1.15.json
index b35b1e23..c489f27e 100644
--- a/schemas/1.15.json
+++ b/schemas/1.15.json
@@ -174,6 +174,7 @@
"minecraft:fill_player_head",
"minecraft:copy_name",
"minecraft:copy_nbt",
+ "minecraft:copy_state",
"minecraft:apply_bonus",
"minecraft:exploration_map",
"minecraft:set_stew_effect"
@@ -306,6 +307,22 @@
"minecraft:set_stew_effect"
]
},
+ {
+ "id": "block",
+ "type": "string",
+ "translate": "$function.block",
+ "require": [
+ "minecraft:copy_state"
+ ]
+ },
+ {
+ "id": "properties",
+ "type": "string-list",
+ "translate": "$function.properties",
+ "require": [
+ "minecraft:copy_state"
+ ]
+ },
{
"id": "entity",
"type": "enum",
diff --git a/view.js b/view.js
index 7062ab23..0357089e 100644
--- a/view.js
+++ b/view.js
@@ -70,6 +70,7 @@ function generateComponent(data, struct) {
case 'string': return generateString(data, struct);
case 'int': return generateString(data, struct);
case 'float': return generateString(data, struct);
+ case 'string-list': return generateString(data, struct);
case 'chance-list': return generateString(data, struct);
case 'boolean': return generateBoolean(data, struct);
case 'random': return generateRandom(data, struct);