1
0
Fork 0
mirror of https://github.com/haselkern/Minecraft-ArmorStand.git synced 2025-12-19 22:54:07 +00:00

Compare commits

..

No commits in common. "7bd46b452836e2e9ebcc9a7fef791fd1f45b5edd" and "6413875cd0a4c9c78ff66f5fe2e72dd17aa43620" have entirely different histories.

2 changed files with 4 additions and 43 deletions

View file

@ -32,8 +32,7 @@
<div class="padding underline">
<select id="mcversion">
<option value="1.21.5">Minecraft 1.21.5 and above</option>
<option value="1.21">Minecraft 1.21 to 1.21.4</option>
<option value="1.21">Minecraft 1.21 and above</option>
<option value="1.20.5">Minecraft 1.20.5 &amp; 1.20.6</option>
<option value="1.16">Minecraft 1.16 to 1.20.4</option>
<option value="1.14">Minecraft 1.14 &amp; 1.15</option>

View file

@ -357,8 +357,7 @@ const MC_VERSION = Object.freeze({
v1_14: 4,
v1_16: 5,
v1_20_5: 6,
v1_21: 7,
v1_21_5: 8,
v1_21: 7
});
function getMcVersion() {
@ -573,18 +572,6 @@ function updateUI(){
mSkull.visible = equipHelmet != "";
}
function pruneEmpty(obj) {
for (const key in obj) {
const value = obj[key];
if (Object.keys(value).length === 0) {
delete obj[key];
}
}
return obj;
}
function generateCode() {
const tags = {
Invisible: invisible || null,
@ -596,7 +583,7 @@ function generateCode() {
Small: small || null,
Marker: marker || null,
Rotation: (rotation != 0) ? [ new NBTFloat(rotation), new NBTFloat(0) ] : null,
Rotation: (rotation != 0) ? [ new NBTFloat(rotation) ] : null,
CustomNameVisible: showCustomName || null,
CustomName: (customName) ? generateCustomName() : null,
@ -612,7 +599,7 @@ function generateCode() {
// Equipment: [ RightHand, Boots, Leggings, Chestplate, Helmet ]
const rightHandItem = generateHandItems()[0];
tags.Equipment = [rightHandItem, ...generateArmorItems()];
} else if (mcVersion >= MC_VERSION.v1_9 && mcVersion < MC_VERSION.v1_21_5) {
} else {
// New 1.9+ Equipment format
if (equipShoes != "" || equipLeggings != "" || equipChestplate != "" || equipHelmet != "") {
tags.ArmorItems = generateArmorItems();
@ -621,25 +608,6 @@ function generateCode() {
if (equipHandRight != "" || equipHandLeft != "") {
tags.HandItems = generateHandItems();
}
} else {
// Since 1.21.5, The ArmorItems and HandItems fields have been merged into an equipment field.
// Reference: https://minecraft.wiki/w/Java_Edition_1.21.5
let [feetArmor, legsArmor, chestArmor, headArmor] = generateArmorItems();
let [mainHand, offHand] = generateHandItems();
let equipments = pruneEmpty({
mainhand: mainHand,
offhand: offHand,
head: headArmor,
chest: chestArmor,
legs: legsArmor,
feet: feetArmor,
});
if (Object.keys(equipments).length > 0) {
tags.equipment = equipments;
}
}
}
@ -723,12 +691,6 @@ function generateCustomName() {
if (nameObfuscated) {
props.obfuscated = nameObfuscated;
}
if (mcVersion >= MC_VERSION.v1_21_5) {
// Since 1.21.5+, text components are no longer stored as JSON wrapped by a string.
// So just return the props object instead
return props
}
let stringified = JSON.stringify(props);
if (mcVersion < MC_VERSION.v1_14) {