mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-24 11:15:21 +01:00
Added default player-faces.
This commit is contained in:
parent
29517e9a24
commit
403a2acc53
@ -16,7 +16,7 @@ function blitImage(ctx, image, sx ,sy, sw, sh, dx, dy, dw, dh) {
|
||||
}
|
||||
}
|
||||
|
||||
function createMinecraftHead(player,completed) {
|
||||
function createMinecraftHead(player,completed,failed) {
|
||||
var skinImage = new Image();
|
||||
skinImage.onload = function() {
|
||||
var headCanvas = document.createElement('canvas');
|
||||
@ -27,6 +27,13 @@ function createMinecraftHead(player,completed) {
|
||||
blitImage(headContext, skinImage, 40,8,8,8, 0,0,8,8);
|
||||
completed(headCanvas);
|
||||
};
|
||||
skinImage.onerror = function() {
|
||||
if (skinImage.src == 'http://www.minecraft.net/img/char.png') {
|
||||
failed();
|
||||
} else {
|
||||
skinImage.src = 'http://www.minecraft.net/img/char.png';
|
||||
}
|
||||
};
|
||||
skinImage.src = 'http://www.minecraft.net/skin/' + player + '.png';
|
||||
}
|
||||
|
||||
@ -60,6 +67,8 @@ function getMinecraftHead(player,size,completed) {
|
||||
for(i=0;i<hooks.length;i++) {
|
||||
hooks[i].f(resizeImage(head,hooks[i].s));
|
||||
}
|
||||
}, function() {
|
||||
|
||||
});
|
||||
} else if (head.working) {
|
||||
//console.log('Other process working on head of ',player,', will add myself to hooks...');
|
||||
|
Loading…
Reference in New Issue
Block a user