mirror of
https://github.com/haselkern/Minecraft-ArmorStand.git
synced 2025-05-17 15:05:33 +00:00
parent
b9ebbaf20c
commit
f02d189c5b
1 changed files with 29 additions and 7 deletions
36
js/main.js
36
js/main.js
|
@ -738,13 +738,18 @@ function getHeadItem(){
|
||||||
// Use input as url
|
// Use input as url
|
||||||
// Best reference: http://redd.it/24quwx
|
// Best reference: http://redd.it/24quwx
|
||||||
else if(equipCustomHeadMode == "url"){
|
else if(equipCustomHeadMode == "url"){
|
||||||
var uuid = generateUUID();
|
var base64Value = btoa('{"textures":{"SKIN":{"url":"'+equipHelmet+'"}}}');
|
||||||
var base64Value = btoa('{textures:{SKIN:{url:"'+equipHelmet+'"}}}');
|
|
||||||
|
|
||||||
if (mcVersion == "1.8" || mcVersion == "1.10" || mcVersion == "1.11") {
|
switch (mcVersion) {
|
||||||
return '{id:"skull",Count:1b,Damage:3b,tag:{SkullOwner:{Id:'+uuid+',Properties:{textures:[{Value:'+base64Value+'}]}}}}';
|
case "1.8":
|
||||||
} else {
|
case "1.9":
|
||||||
return '{id:"player_head",Count:1b,tag:{SkullOwner:{Id:'+uuid+',Properties:{textures:[{Value:'+base64Value+'}]}}}}';
|
case "1.11":
|
||||||
|
return '{id:"skull",Count:1b,Damage:3b,tag:{SkullOwner:{Id:"'+generateUUID()+'",Properties:{textures:[{Value:"'+base64Value+'"}]}}}}';
|
||||||
|
case "1.13":
|
||||||
|
case "1.14":
|
||||||
|
return '{id:"minecraft:player_head",Count:1b,tag:{SkullOwner:{Id:"'+generateUUID()+'",Properties:{textures:[{Value:"'+base64Value+'"}]}}}}';
|
||||||
|
default:
|
||||||
|
return '{id:"minecraft:player_head",Count:1b,tag:{SkullOwner:{Id:'+generateIntArray()+',Properties:{textures:[{Value:"'+base64Value+'"}]}}}}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -900,6 +905,23 @@ function generateUUID(){
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function generateIntArray() {
|
||||||
|
const buffer = new Uint32Array(4);
|
||||||
|
const UUID = new DataView(buffer.buffer);
|
||||||
|
const paddings = [8, 4, 4, 4, 12];
|
||||||
|
|
||||||
|
let hexUUID = generateUUID().split("-").map((val, i) => val.padStart(paddings[i], "0")).join("");
|
||||||
|
let ints = [];
|
||||||
|
|
||||||
|
for (let i = 0; i < 4; i++) {
|
||||||
|
num = Number("0x" + hexUUID.substring(i*8, (i+1)*8));
|
||||||
|
UUID.setInt32(i*4, num);
|
||||||
|
ints.push(UUID.getInt32(i*4));
|
||||||
|
}
|
||||||
|
|
||||||
|
return '[I;' + ints.join(",") + ']';
|
||||||
|
}
|
||||||
|
|
||||||
function getDecimalRGB(rgb){
|
function getDecimalRGB(rgb){
|
||||||
//The string has the format 'rgb(r, g, b)'
|
//The string has the format 'rgb(r, g, b)'
|
||||||
|
|
||||||
|
@ -1162,4 +1184,4 @@ function deleteSave(data) {
|
||||||
localStorage.removeItem(data);
|
localStorage.removeItem(data);
|
||||||
loadScreen();
|
loadScreen();
|
||||||
alert(`${data} has been deleted!`);
|
alert(`${data} has been deleted!`);
|
||||||
};
|
};
|
Loading…
Add table
Add a link
Reference in a new issue