mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-24 23:56:51 +00:00
Add default dimension type and prevent duplicates
This commit is contained in:
25
js/view.js
25
js/view.js
@@ -1,6 +1,8 @@
|
||||
|
||||
const themes = ["light", "dark"];
|
||||
|
||||
let preventDuplicateDimensionType = [false, false, false, false];
|
||||
|
||||
themes.forEach(v => $('#themeList').append(`<a class="dropdown-item" onclick="changeTheme('${v}')" data-i18n="theme.${v}"></a>`));
|
||||
|
||||
addListener(updateView);
|
||||
@@ -205,7 +207,28 @@ function generateEnum(data, struct) {
|
||||
if (struct.help) {
|
||||
$el.append(generateTooltip(struct.translateValue + '.' + data.replace(/.*:/, '')));
|
||||
}
|
||||
return {out: data, component: $el};
|
||||
let out = data;
|
||||
if (struct.translate === 'dimension.type') {
|
||||
const i = struct.values.indexOf(data)
|
||||
if (i !== -1 ) {
|
||||
if (preventDuplicateDimensionType[i]) {
|
||||
data = 'minecraft:default';
|
||||
} else {
|
||||
preventDuplicateDimensionType[i] = true;
|
||||
}
|
||||
}
|
||||
if (data === 'minecraft:default') {
|
||||
out = {
|
||||
"ultrawarm": false,
|
||||
"natural": true,
|
||||
"shrunk": false,
|
||||
"ambient_light": 0,
|
||||
"has_skylight": true,
|
||||
"has_ceiling": false
|
||||
};
|
||||
}
|
||||
}
|
||||
return {out: out, component: $el};
|
||||
}
|
||||
|
||||
function generateSet(data, struct) {
|
||||
|
||||
Reference in New Issue
Block a user