Show player markers in the center of the current block
This commit is contained in:
parent
de5be31030
commit
652a63e278
@ -576,9 +576,10 @@ export default {
|
||||
sort: player.sort || 0,
|
||||
hidden: !world,
|
||||
location: {
|
||||
x: player.x || 0,
|
||||
y: player.y || 0,
|
||||
z: player.z || 0,
|
||||
//Add 0.5 to position in the middle of a block
|
||||
x: !isNaN(player.x) ? player.x + 0.5 : 0,
|
||||
y: !isNaN(player.y) ? player.y : 0,
|
||||
z: !isNaN(player.z) ? player.z + 0.5 : 0,
|
||||
world: world,
|
||||
}
|
||||
});
|
||||
|
@ -75,6 +75,7 @@ export class PlayerIcon extends DivIcon {
|
||||
}
|
||||
|
||||
const player = this._player;
|
||||
let offset = 8;
|
||||
|
||||
this._container = document.createElement('div');
|
||||
|
||||
@ -93,12 +94,15 @@ export class PlayerIcon extends DivIcon {
|
||||
if (this.options.smallFace) {
|
||||
this._playerImage = smallImage.cloneNode() as HTMLImageElement;
|
||||
size = '16';
|
||||
offset = 8;
|
||||
} else if(this.options.showBody) {
|
||||
this._playerImage = bodyImage.cloneNode() as HTMLImageElement;
|
||||
size = 'body';
|
||||
offset = 16;
|
||||
} else {
|
||||
this._playerImage = largeImage.cloneNode() as HTMLImageElement;
|
||||
size = '32';
|
||||
offset = 16;
|
||||
}
|
||||
|
||||
Util.getMinecraftHead(player, size).then(head => {
|
||||
@ -133,6 +137,9 @@ export class PlayerIcon extends DivIcon {
|
||||
this._playerName.classList.add('playerNameNoHealth');
|
||||
}
|
||||
|
||||
this._container.style.marginTop = `-${offset}px`;
|
||||
this._container.style.marginLeft = `-${offset}px`;
|
||||
|
||||
return this._container;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user