Fix 'improved' menu icon PR

This commit is contained in:
Mike Primm 2020-08-17 19:41:33 -05:00
parent eccc6be278
commit 6e35b7e872

View File

@ -279,16 +279,25 @@ DynMap.prototype = {
} }
var worldName = wname; var worldName = wname;
if(wname.startsWith('world_')) { var mapName = mapindex;
worldName = wname.substring(6); if (worldName.endsWith('_nether') || (worldName == 'DIM-1')) {
worldName = 'nether';
mapName = (mapindex == 'nether') ? 'surface' : 'flat';
}
else if (worldName.endsWith('the_end') || (worldName == 'DIM1')) {
worldName = 'the_end';
mapName = (mapindex == 'the_end') ? 'surface' : 'flat';
}
else {
worldName = 'world';
mapName = [ 'surface', 'flat', 'biome', 'cave' ].includes(mapindex) ? mapindex : 'flat';
} }
map.element = $('<li/>') map.element = $('<li/>')
.addClass('map item') .addClass('map item')
.append($('<a/>') .append($('<a/>')
.attr({ title: map.options.title, href: '#' }) .attr({ title: map.options.title, href: '#' })
.addClass('maptype') .addClass('maptype')
.css({ backgroundImage: 'url(' + (map.options.icon || ('images/block_' + worldName + '_' + mapindex + '.png')) + ')' }) .css({ backgroundImage: 'url(' + (map.options.icon || ('images/block_' + worldName + '_' + mapName + '.png')) + ')' })
.text(map.options.title) .text(map.options.title)
) )
.click(function() { .click(function() {