mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-30 17:49:34 +00:00
Add collections
This commit is contained in:
11
model.js
11
model.js
@@ -277,6 +277,11 @@ function updateField(el) {
|
||||
if (isNaN(value)) {
|
||||
value = '';
|
||||
}
|
||||
} else if(type === 'enum') {
|
||||
if (value === 'unset') {
|
||||
console.log('set value to empty');
|
||||
value = '';
|
||||
}
|
||||
} else if (type === 'nbt') {
|
||||
|
||||
if (!value.startsWith('{')) {
|
||||
@@ -303,8 +308,14 @@ function updateField(el) {
|
||||
value = getBooleanValue(node[field], ($(el).val() === 'true'));
|
||||
}
|
||||
if (value === '') {
|
||||
console.log('delete', field);
|
||||
console.log(node);
|
||||
deleteField(node, field);
|
||||
console.log(node);
|
||||
} else {
|
||||
console.log('set', field);
|
||||
console.log(node);
|
||||
console.log(value);
|
||||
setField(node, field, value);
|
||||
}
|
||||
invalidated();
|
||||
|
||||
@@ -332,45 +332,7 @@
|
||||
"id": "enchantment",
|
||||
"type": "enum",
|
||||
"source": "enchantment",
|
||||
"values": [
|
||||
"minecraft:aqua_affinity",
|
||||
"minecraft:bane_of_arthropods",
|
||||
"minecraft:blast_protection",
|
||||
"minecraft:channeling",
|
||||
"minecraft:binding_curse",
|
||||
"minecraft:vanishing_curse",
|
||||
"minecraft:depth_strider",
|
||||
"minecraft:efficiency",
|
||||
"minecraft:feather_falling",
|
||||
"minecraft:fire_aspect",
|
||||
"minecraft:fire_protection",
|
||||
"minecraft:flame",
|
||||
"minecraft:fortune",
|
||||
"minecraft:frost_walker",
|
||||
"minecraft:impaling",
|
||||
"minecraft:infinity",
|
||||
"minecraft:knockback",
|
||||
"minecraft:looting",
|
||||
"minecraft:loyalty",
|
||||
"minecraft:luck_of_the_sea",
|
||||
"minecraft:lure",
|
||||
"minecraft:mending",
|
||||
"minecraft:multishot",
|
||||
"minecraft:piercing",
|
||||
"minecraft:power",
|
||||
"minecraft:projectile_protection",
|
||||
"minecraft:protection",
|
||||
"minecraft:punch",
|
||||
"minecraft:quick_charge",
|
||||
"minecraft:respiration",
|
||||
"minecraft:riptide",
|
||||
"minecraft:sharpness",
|
||||
"minecraft:silk_touch",
|
||||
"minecraft:smite",
|
||||
"minecraft:sweeping",
|
||||
"minecraft:thorns",
|
||||
"minecraft:unbreaking"
|
||||
],
|
||||
"values": "enchantments",
|
||||
"require": [
|
||||
"minecraft:apply_bonus"
|
||||
]
|
||||
@@ -500,45 +462,7 @@
|
||||
"id": "enchantment",
|
||||
"type": "enum",
|
||||
"source": "enchantment",
|
||||
"values": [
|
||||
"minecraft:aqua_affinity",
|
||||
"minecraft:bane_of_arthropods",
|
||||
"minecraft:blast_protection",
|
||||
"minecraft:channeling",
|
||||
"minecraft:binding_curse",
|
||||
"minecraft:vanishing_curse",
|
||||
"minecraft:depth_strider",
|
||||
"minecraft:efficiency",
|
||||
"minecraft:feather_falling",
|
||||
"minecraft:fire_aspect",
|
||||
"minecraft:fire_protection",
|
||||
"minecraft:flame",
|
||||
"minecraft:fortune",
|
||||
"minecraft:frost_walker",
|
||||
"minecraft:impaling",
|
||||
"minecraft:infinity",
|
||||
"minecraft:knockback",
|
||||
"minecraft:looting",
|
||||
"minecraft:loyalty",
|
||||
"minecraft:luck_of_the_sea",
|
||||
"minecraft:lure",
|
||||
"minecraft:mending",
|
||||
"minecraft:multishot",
|
||||
"minecraft:piercing",
|
||||
"minecraft:power",
|
||||
"minecraft:projectile_protection",
|
||||
"minecraft:protection",
|
||||
"minecraft:punch",
|
||||
"minecraft:quick_charge",
|
||||
"minecraft:respiration",
|
||||
"minecraft:riptide",
|
||||
"minecraft:sharpness",
|
||||
"minecraft:silk_touch",
|
||||
"minecraft:smite",
|
||||
"minecraft:sweeping",
|
||||
"minecraft:thorns",
|
||||
"minecraft:unbreaking"
|
||||
],
|
||||
"values": "enchantments",
|
||||
"require": [
|
||||
"minecraft:table_bonus"
|
||||
]
|
||||
@@ -697,7 +621,10 @@
|
||||
"fields": [
|
||||
{
|
||||
"id": "type",
|
||||
"type": "string"
|
||||
"type": "enum",
|
||||
"source": "entity",
|
||||
"unset": true,
|
||||
"values": "entity_types"
|
||||
},
|
||||
{
|
||||
"id": "nbt",
|
||||
@@ -722,5 +649,150 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
"collections": {
|
||||
"entity_types": [
|
||||
"minecraft:area_effect_cloud",
|
||||
"minecraft:armor_stand",
|
||||
"minecraft:arrow",
|
||||
"minecraft:bat",
|
||||
"minecraft:blaze",
|
||||
"minecraft:boat",
|
||||
"minecraft:cat",
|
||||
"minecraft:cave_spider",
|
||||
"minecraft:chest_minecart",
|
||||
"minecraft:chicken",
|
||||
"minecraft:cod",
|
||||
"minecraft:command_block_minecart",
|
||||
"minecraft:cow",
|
||||
"minecraft:creeper",
|
||||
"minecraft:dolphin",
|
||||
"minecraft:donkey",
|
||||
"minecraft:dragon_fireball",
|
||||
"minecraft:drowned",
|
||||
"minecraft:egg",
|
||||
"minecraft:elder_guardian",
|
||||
"minecraft:end_crystal",
|
||||
"minecraft:ender_dragon",
|
||||
"minecraft:ender_pearl",
|
||||
"minecraft:enderman",
|
||||
"minecraft:endermite",
|
||||
"minecraft:evoker",
|
||||
"minecraft:evoker_fangs",
|
||||
"minecraft:experience_bottle",
|
||||
"minecraft:experience_orb",
|
||||
"minecraft:eye_of_ender",
|
||||
"minecraft:falling_block",
|
||||
"minecraft:fireball",
|
||||
"minecraft:firework_rocket",
|
||||
"minecraft:fishing_bobber",
|
||||
"minecraft:fox",
|
||||
"minecraft:furnace_minecart",
|
||||
"minecraft:ghast",
|
||||
"minecraft:giant",
|
||||
"minecraft:guardian",
|
||||
"minecraft:hopper_minecart",
|
||||
"minecraft:horse",
|
||||
"minecraft:husk",
|
||||
"minecraft:illusioner",
|
||||
"minecraft:iron_golem",
|
||||
"minecraft:item",
|
||||
"minecraft:item_frame",
|
||||
"minecraft:leash_knot",
|
||||
"minecraft:lightning_bolt",
|
||||
"minecraft:llama",
|
||||
"minecraft:llama_spit",
|
||||
"minecraft:magma_cube",
|
||||
"minecraft:minecart",
|
||||
"minecraft:mooshroom",
|
||||
"minecraft:mule",
|
||||
"minecraft:ocelot",
|
||||
"minecraft:painting",
|
||||
"minecraft:panda",
|
||||
"minecraft:parrot",
|
||||
"minecraft:phantom",
|
||||
"minecraft:pig",
|
||||
"minecraft:pillager",
|
||||
"minecraft:player",
|
||||
"minecraft:polar_bear",
|
||||
"minecraft:potion",
|
||||
"minecraft:pufferfish",
|
||||
"minecraft:rabbit",
|
||||
"minecraft:ravager",
|
||||
"minecraft:salmon",
|
||||
"minecraft:sheep",
|
||||
"minecraft:shulker",
|
||||
"minecraft:shulker_bullet",
|
||||
"minecraft:silverfish",
|
||||
"minecraft:skeleton",
|
||||
"minecraft:skeleton_horse",
|
||||
"minecraft:slime",
|
||||
"minecraft:small_fireball",
|
||||
"minecraft:snow_golem",
|
||||
"minecraft:snowball",
|
||||
"minecraft:spawner_minecart",
|
||||
"minecraft:spectral_arrow",
|
||||
"minecraft:spider",
|
||||
"minecraft:squid",
|
||||
"minecraft:stray",
|
||||
"minecraft:tnt",
|
||||
"minecraft:tnt_minecart",
|
||||
"minecraft:trader_llama",
|
||||
"minecraft:trident",
|
||||
"minecraft:tropical_fish",
|
||||
"minecraft:turtle",
|
||||
"minecraft:vex",
|
||||
"minecraft:villager",
|
||||
"minecraft:vindicator",
|
||||
"minecraft:wandering_trader",
|
||||
"minecraft:witch",
|
||||
"minecraft:wither",
|
||||
"minecraft:wither_skeleton",
|
||||
"minecraft:wither_skull",
|
||||
"minecraft:wolf",
|
||||
"minecraft:zombie",
|
||||
"minecraft:zombie_horse",
|
||||
"minecraft:zombie_pigman",
|
||||
"minecraft:zombie_villager"
|
||||
],
|
||||
"enchantments": [
|
||||
"minecraft:aqua_affinity",
|
||||
"minecraft:bane_of_arthropods",
|
||||
"minecraft:blast_protection",
|
||||
"minecraft:channeling",
|
||||
"minecraft:binding_curse",
|
||||
"minecraft:vanishing_curse",
|
||||
"minecraft:depth_strider",
|
||||
"minecraft:efficiency",
|
||||
"minecraft:feather_falling",
|
||||
"minecraft:fire_aspect",
|
||||
"minecraft:fire_protection",
|
||||
"minecraft:flame",
|
||||
"minecraft:fortune",
|
||||
"minecraft:frost_walker",
|
||||
"minecraft:impaling",
|
||||
"minecraft:infinity",
|
||||
"minecraft:knockback",
|
||||
"minecraft:looting",
|
||||
"minecraft:loyalty",
|
||||
"minecraft:luck_of_the_sea",
|
||||
"minecraft:lure",
|
||||
"minecraft:mending",
|
||||
"minecraft:multishot",
|
||||
"minecraft:piercing",
|
||||
"minecraft:power",
|
||||
"minecraft:projectile_protection",
|
||||
"minecraft:protection",
|
||||
"minecraft:punch",
|
||||
"minecraft:quick_charge",
|
||||
"minecraft:respiration",
|
||||
"minecraft:riptide",
|
||||
"minecraft:sharpness",
|
||||
"minecraft:silk_touch",
|
||||
"minecraft:smite",
|
||||
"minecraft:sweeping",
|
||||
"minecraft:thorns",
|
||||
"minecraft:unbreaking"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
11
view.js
11
view.js
@@ -1,5 +1,6 @@
|
||||
let structure;
|
||||
let components;
|
||||
let collections;
|
||||
|
||||
changeVersion('1.14');
|
||||
function changeVersion(version) {
|
||||
@@ -7,6 +8,7 @@ function changeVersion(version) {
|
||||
$('#versionLabel').text(version);
|
||||
structure = json.root;
|
||||
components = json.components;
|
||||
collections = json.collections;
|
||||
updateView();
|
||||
});
|
||||
}
|
||||
@@ -128,7 +130,14 @@ function generateEnum(data, struct) {
|
||||
let $el = $('#components').find('[data-type="enum"]').clone();
|
||||
$el.attr('data-field', struct.id);
|
||||
$el.find('[data-name]').attr('data-i18n', struct.id);
|
||||
for (let value of struct.values) {
|
||||
let collection = struct.values;
|
||||
if (typeof struct.values === 'string') {
|
||||
collection = collections[struct.values].slice();
|
||||
}
|
||||
if (struct.unset) {
|
||||
collection.splice(0, 0, 'unset');
|
||||
}
|
||||
for (let value of collection) {
|
||||
$el.find('select').append(setValueAndName($('<option/>'), value, struct.source));
|
||||
}
|
||||
$el.find('select').val(data);
|
||||
|
||||
Reference in New Issue
Block a user