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

Merge pull request #37 from githubcatw/give_patch

Add support for /give commands
This commit is contained in:
thelennylord 2020-12-29 20:32:47 +05:30 committed by GitHub
commit 4ad39b87f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 7 deletions

View file

@ -221,6 +221,7 @@
<div class="padding">
<!-- THANK YOU to reddit user Oozebull for this part. -->
<label><input type="checkbox" id="slashgive" name="slashgive">Make /give</label>
<label><input type="checkbox" name="usedisabledslots">Lock Slot Interaction</label>
<div id="disabledslots">
<div>

View file

@ -41,6 +41,7 @@ var showArms = false;
var small = false;
var marker = false;
var centercorrected = false;
var give = false;
var useEquipment;
var equipHandRight;
@ -372,7 +373,7 @@ function handleInput(){
nameStrikethrough = getCheckBoxInput("namestrikethrough");
useDisabledSlots = getCheckBoxInput("usedisabledslots");
give = getCheckBoxInput("slashgive");
body.set(getRangeInput("bodyX"), getRangeInput("bodyY"), getRangeInput("bodyZ"));
head.set(getRangeInput("headX"), getRangeInput("headY"), getRangeInput("headZ"));
@ -526,13 +527,21 @@ function updateUI(){
function generateCode(){
var code = "/summon armor_stand ~ ~ ~ {" //in 1.13, positions are no longer center-corrected. Adding .5 makes it centered. However for players it is already center-corrected
// Old entity name
if(mcVersion == "1.8" || mcVersion == "1.9"){
code = "/summon ArmorStand ~ ~ ~ {";
} else if (mcVersion == "1.11") {
code = "/summon armor_stand ~ ~ ~ {";
if (!give) {
// Old entity name
if(mcVersion == "1.8" || mcVersion == "1.9"){
code = "/summon ArmorStand ~ ~ ~ {";
} else if (mcVersion == "1.11") {
code = "/summon armor_stand ~ ~ ~ {";
} else {
centercorrected ? code = "/summon armor_stand ~ ~-0.5 ~ {" : code = "/summon armor_stand ~ ~ ~ {"
}
} else {
centercorrected ? code = "/summon armor_stand ~ ~-0.5 ~ {" : code = "/summon armor_stand ~ ~ ~ {"
if(mcVersion == "1.8" || mcVersion == "1.9" || mcVersion == "1.11"){
code = "/give @p minecraft:armor_stand 1 0 {EntityTag:{";
} else {
code = "/give @p armor_stand{EntityTag:{"
}
}
var tags = [];
@ -682,6 +691,12 @@ function generateCode(){
code += tags.join(",");
code += "}";
if (give) {
code += "}";
if (mcVersion != "1.8" && mcVersion != "1.9" && mcVersion != "1.11") {
code += " 1"
}
}
return code;
}