1
0
Fork 0
mirror of https://github.com/haselkern/Minecraft-ArmorStand.git synced 2025-05-17 15:05:33 +00:00

main.js updated

- Added Selector Functionality:
     If left blank, it will show up as @p (nearest player)
This commit is contained in:
agentdid127 2019-01-05 23:43:44 -05:00 committed by GitHub
parent f8c5f6dea3
commit 12f53a0f13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -35,8 +35,11 @@ var mcVersion;
var justgivehead = false;
var skullMode;
var selectorInput = "";
var headType = "";
var invisible = false;
var invulnerable = false;
var persistencerequired = false;
@ -338,8 +341,10 @@ function handleInput(){
equipChestplate = getInput("equipChestplate");
equipHelmet = getInput("equipHelmet");
headType = getInput("skullInput");
selectorInput = getInput("selectorInput");
equipCustomHeadMode = $("#equipCustomHeadMode").val();
skullMode = $("#skullMode").val();
equipColorShoes = $("#shoecolor").css("background-color");
equipColorLeggings = $("#leggingscolor").css("background-color");
@ -487,14 +492,15 @@ function updateUI(){
function generateCode(){
if(justgivehead){
var code = "give @p minecraft:skull 1 3 {"
var selector = getSelector();
var code = "give "+selector+" minecraft:skull 1 3 {"
if(mcVersion == "1.8" || mcVersion == "1.9"){
code = "/give @p skull 1 3 {";
code = "/give "+selector+" skull 1 3 {";
} else if (mcVersion == "1.11") {
code = "/give @p minecraft:skull 1 3 {";
code = "/give "+selector+" minecraft:skull 1 3 {";
} else if (mcVersion == "1.13") {
centercorrected ? code = "/give @p player_head {" : code = "/give @p player_head {"
centercorrected ? code = "/give "+selector+" player_head {" : code = "/give "+selector+" player_head {"
}
var tags = [];
tags.push(getSkullItem());
@ -772,6 +778,12 @@ function getSkullItem(){
}
function getSelector(){
if(selectorInput == "") return "@p";
return selectorInput;
}
function getName() {
if (!customName) return ""
return `\\"text\\":\\"${customName}\\"`