mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-28 01:08:47 +00:00
Add maps of objects + add entity effect property
This commit is contained in:
@@ -29,8 +29,7 @@
|
||||
"block_state": "Block State",
|
||||
"block_state_add": "Add Block State",
|
||||
"block_state_remove": "Remove Block State",
|
||||
"objective": "Objective",
|
||||
"score": "Score",
|
||||
"score": "Objective",
|
||||
"score_add": "Add Score",
|
||||
"score_remove": "Remove Score",
|
||||
"location": "Location",
|
||||
@@ -234,7 +233,10 @@
|
||||
"$entity": {
|
||||
"type": "Entity",
|
||||
"nbt": "NBT",
|
||||
"location": "Location"
|
||||
"location": "Location",
|
||||
"status_effect": "Effects",
|
||||
"status_effect_add": "Add Effect",
|
||||
"status_effect_remove": "Remove Effect"
|
||||
},
|
||||
"$location": {
|
||||
"position": "Position",
|
||||
@@ -247,6 +249,12 @@
|
||||
"feature": "Feature",
|
||||
"dimension": "Dimension"
|
||||
},
|
||||
"$status_effect": {
|
||||
"amplifier": "Amplifier",
|
||||
"duration": "Duration",
|
||||
"ambient": "Ambient",
|
||||
"visible": "Visible"
|
||||
},
|
||||
"$item": {
|
||||
"name": "Item ID",
|
||||
"tag": "Item Tag",
|
||||
|
||||
3
model.js
3
model.js
@@ -242,6 +242,8 @@ function addToMap(el) {
|
||||
node[map][key] = 0;
|
||||
} else if (type === 'boolean') {
|
||||
node[map][key] = false;
|
||||
} else if (type === 'object') {
|
||||
node[map][key] = {};
|
||||
} else {
|
||||
node[map][key] = "";
|
||||
}
|
||||
@@ -275,7 +277,6 @@ function toggleCollapseObject(el) {
|
||||
|
||||
function updateField(el) {
|
||||
let path = getPath(el);
|
||||
console.log(path);
|
||||
let $field = $(el).closest('[data-index]');
|
||||
let field = path.pop();
|
||||
let node = getNode(path);
|
||||
|
||||
@@ -505,7 +505,6 @@
|
||||
"id": "properties",
|
||||
"type": "map",
|
||||
"translate": "$condition.block_state",
|
||||
"translateValue": "$condition.block_state",
|
||||
"values": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -516,8 +515,7 @@
|
||||
{
|
||||
"id": "scores",
|
||||
"type": "map",
|
||||
"translate": "$condition.objective",
|
||||
"translateValue": "$condition.score",
|
||||
"translate": "$condition.score",
|
||||
"values": {
|
||||
"type": "range"
|
||||
},
|
||||
@@ -703,6 +701,15 @@
|
||||
"translate": "$entity.location",
|
||||
"value": "location",
|
||||
"collapse": true
|
||||
},
|
||||
{
|
||||
"id": "effects",
|
||||
"type": "map",
|
||||
"translate": "$entity.status_effect",
|
||||
"values": {
|
||||
"type": "object",
|
||||
"value": "status_effect"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -761,6 +768,33 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "status_effect",
|
||||
"type": "object",
|
||||
"color": "dark",
|
||||
"fields": [
|
||||
{
|
||||
"id": "amplifier",
|
||||
"type": "range",
|
||||
"translate": "$status_effect.amplifier"
|
||||
},
|
||||
{
|
||||
"id": "duration",
|
||||
"type": "range",
|
||||
"translate": "$status_effect.duration"
|
||||
},
|
||||
{
|
||||
"id": "ambient",
|
||||
"type": "boolean",
|
||||
"translate": "$status_effect.ambient"
|
||||
},
|
||||
{
|
||||
"id": "visible",
|
||||
"type": "boolean",
|
||||
"translate": "$status_effect.visible"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "item",
|
||||
"type": "object",
|
||||
@@ -1104,6 +1138,40 @@
|
||||
"minecraft:overworld",
|
||||
"minecraft:the_nether",
|
||||
"minecraft:the_end"
|
||||
],
|
||||
"status_effects": [
|
||||
"minecraft:speed",
|
||||
"minecraft:slowness",
|
||||
"minecraft:haste",
|
||||
"minecraft:mining_fatigue",
|
||||
"minecraft:strength",
|
||||
"minecraft:instant_health",
|
||||
"minecraft:instant_damage",
|
||||
"minecraft:jump_boost",
|
||||
"minecraft:nausea",
|
||||
"minecraft:regeneration",
|
||||
"minecraft:resistance",
|
||||
"minecraft:fire_resistance",
|
||||
"minecraft:water_breathing",
|
||||
"minecraft:invisibility",
|
||||
"minecraft:blindness",
|
||||
"minecraft:night_vision",
|
||||
"minecraft:hunger",
|
||||
"minecraft:weakness",
|
||||
"minecraft:poison",
|
||||
"minecraft:wither",
|
||||
"minecraft:health_boost",
|
||||
"minecraft:absorption",
|
||||
"minecraft:saturation",
|
||||
"minecraft:glowing",
|
||||
"minecraft:levitation",
|
||||
"minecraft:luck",
|
||||
"minecraft:unluck",
|
||||
"minecraft:slow_falling",
|
||||
"minecraft:conduit_power",
|
||||
"minecraft:dolphins_grace",
|
||||
"minecraft:bad_omen",
|
||||
"minecraft:hero_of_the_village"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
18
view.js
18
view.js
@@ -197,13 +197,23 @@ 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.translate);
|
||||
$el.find('[data-name="2"]').attr('data-i18n', struct.translateValue + '_add');
|
||||
$el.find('[data-name="2"]').attr('data-i18n', struct.translate + '_add');
|
||||
$el.find('input').keypress((e) => {if (e.which == 13) addToMap(e.target);});
|
||||
if (data) {
|
||||
for (let key of Object.keys(data)) {
|
||||
console.log(data[key]);
|
||||
let $item = generateComponent(data[key], {id: key, type: struct.values.type, translate: key});
|
||||
$item.append('<div class="input-group-append"><button class="btn btn-outline-danger bg-light" type="button" onclick="removeFromMap(this)" data-i18n="remove"></button></div>');
|
||||
let field = struct.values;
|
||||
field.id = key;
|
||||
field.translate = key;
|
||||
let $item = generateComponent(data[key], field);;
|
||||
if (field.type === 'object') {
|
||||
let $header = $('<div class="card-header pb-1"></div>');
|
||||
$header.append(('<span class="input-group-text mr-3 mb-2 float-left" data-i18n="' + field.translate + '"></span>'));
|
||||
$header.append('<button type="button" class="btn btn-danger mb-2 float-right" onclick="removeFromMap(this)" data-i18n="' + struct.translate + '_remove"></button>');
|
||||
$item.prepend($header);
|
||||
} else {
|
||||
$item.append('<div class="input-group-append"><button class="btn btn-outline-danger bg-light" type="button" onclick="removeFromMap(this)" data-i18n="remove"></button></div>');
|
||||
}
|
||||
$item.attr('data-index', field.id);
|
||||
$el.append($item);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user