From 763fe4349d832c7800a68157b6ac7ca400dc970c Mon Sep 17 00:00:00 2001 From: Lars Martens Date: Wed, 20 Jul 2016 17:49:31 +0200 Subject: [PATCH 01/19] Updated README.md That file was almost antique, and had wrong information in it. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b5244b1..ad0fe56 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,6 @@ Minecraft Armor Stand ###[Try it out](http://haselkern.github.io/Minecraft-ArmorStand) -This thing is pretty self explanatory. If you have any suggestions, feel free to fork this, open an issue or write in the [reddit thread](http://redd.it/2dyzfc). +In Minecraft 1.8 Armorstands were introduced. Unfortunately, the syntax to summon one is quite confusing and not very intuitive, especially when you're trying to create an awesome pose. This tool provides a graphical interface, so that you can focus on the looks and not worry about code. -**Please note**: Some rotation values do not properly map to those in Minecraft. If you know how to fix that, please submit a pull request. +If you would like to see a feature implemented, feel free to open an issue or submit a pull request. From 7a8ca68a516d7e6fd4ea63115cc414b950aad2a6 Mon Sep 17 00:00:00 2001 From: Ryan Hecht Date: Tue, 26 Jul 2016 16:27:28 -0400 Subject: [PATCH 02/19] fixed leather armor color not applying if there were no boots on the ArmorStand --- js/main.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/main.js b/js/main.js index 606a6f7..a9a75cc 100644 --- a/js/main.js +++ b/js/main.js @@ -485,14 +485,14 @@ function getShoesItem(){ function getLeggingsItem(){ if(equipLeggings == "") return "{}"; return "{id:\""+equipLeggings+"\",Count:1b" - +getLeatherColorString($("#leggingscolor"), isLeatherArmor(equipShoes)) + +getLeatherColorString($("#leggingscolor"), isLeatherArmor(equipLeggings)) +"}"; } function getChestplateItem(){ if(equipChestplate == "") return "{}"; return "{id:\""+equipChestplate+"\",Count:1b" - +getLeatherColorString($("#chestplatecolor"), isLeatherArmor(equipShoes)) + +getLeatherColorString($("#chestplatecolor"), isLeatherArmor(equipChestplate)) +"}"; } @@ -502,7 +502,7 @@ function getHeadItem(){ // Use input as item if(equipCustomHeadMode == "item"){ return "{id:\""+equipHelmet+"\",Count:1b" - +getLeatherColorString($("#helmetcolor"), isLeatherArmor(equipShoes)) + +getLeatherColorString($("#helmetcolor"), isLeatherArmor(equipHelmet)) +"}"; } From 2117cdb891136441aef092d00511a985034e8746 Mon Sep 17 00:00:00 2001 From: Lars Martens Date: Wed, 23 Nov 2016 14:47:37 +0100 Subject: [PATCH 03/19] Small syntax change for Minecraft 1.11 --- js/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/main.js b/js/main.js index a9a75cc..6aa4783 100644 --- a/js/main.js +++ b/js/main.js @@ -379,7 +379,7 @@ function updateUI(){ } function generateCode(){ - var code = "/summon ArmorStand ~ ~ ~ {"; + var code = "/summon armor_stand ~ ~ ~ {"; var tags = []; From 6e97790ca3a8d78d715f3f773c3c18273fd23c44 Mon Sep 17 00:00:00 2001 From: Lars Martens Date: Wed, 23 Nov 2016 15:05:19 +0100 Subject: [PATCH 04/19] Easier equipment Removed modes for different versions of minecraft. --- index.htm | 7 ++----- js/main.js | 32 ++++++-------------------------- 2 files changed, 8 insertions(+), 31 deletions(-) diff --git a/index.htm b/index.htm index 082cb78..45d9a68 100644 --- a/index.htm +++ b/index.htm @@ -99,11 +99,8 @@ - + +
Enter the text id of an item (for example stone or iron_sword) into the appropriate slots. You can enter an arbitrary item for the head or hand, but the other slots must contain an appropriate item. diff --git a/js/main.js b/js/main.js index 6aa4783..490ad55 100644 --- a/js/main.js +++ b/js/main.js @@ -37,7 +37,7 @@ var noGravity = false; var showArms = false; var small = false; -var equipmentMode; +var useEquipment; var equipHandRight; var equipHandLeft; var equipShoes; @@ -265,7 +265,7 @@ function handleInput(){ showArms = getCheckBoxInput("showarms"); small = getCheckBoxInput("small"); - equipmentMode = $("#equipmode").val(); // use direct jQuery for dropdowns + useEquipment = getCheckBoxInput("useequipment"); equipHandRight = getInput("equipHandRight"); equipHandLeft = getInput("equipHandLeft"); equipShoes = getInput("equipShoes"); @@ -313,18 +313,10 @@ function updateUI(){ else $("#inputarms").slideUp(); - if(equipmentMode != "none"){ + if(useEquipment) $("#customequipment").slideDown(); - if(equipmentMode == "1.9"){ - $("#equipHandLeft").show(); - } - else{ - $("#equipHandLeft").hide(); - } - } - else{ + else $("#customequipment").slideUp(); - } //Different colorinputs for armorparts if(isLeatherArmor(equipShoes)) @@ -403,20 +395,8 @@ function generateCode(){ if(rotation != 0) tags.push("Rotation:["+rotation+"f]"); - //1.8 Equipment - if(equipmentMode == "1.8"){ - var equip = []; - - equip.push(getHandRightItem()); - equip.push(getShoesItem()); - equip.push(getLeggingsItem()); - equip.push(getChestplateItem()); - equip.push(getHeadItem()); - - tags.push("Equipment:["+equip.join(",")+"]"); - } - // 1.9 Equipment - else if(equipmentMode == "1.9"){ + // Equipment + if(useEquipment){ var armor = []; armor.push(getShoesItem()); From 57d0cd3e9ca97d27e84a4b05c722f844fcae8988 Mon Sep 17 00:00:00 2001 From: Lars Martens Date: Wed, 23 Nov 2016 17:15:38 +0100 Subject: [PATCH 05/19] Support for custom name --- index.htm | 4 ++++ js/main.js | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/index.htm b/index.htm index 45d9a68..32baea3 100644 --- a/index.htm +++ b/index.htm @@ -130,6 +130,10 @@

+ + +
+
diff --git a/js/main.js b/js/main.js index 490ad55..57fc848 100644 --- a/js/main.js +++ b/js/main.js @@ -50,6 +50,9 @@ var equipColorLeggings; var equipColorChestplate; var equipColorHelmet; +var customName; +var showCustomName; + var useDisabledSlots; //The rotation values are all in degrees. @@ -279,6 +282,9 @@ function handleInput(){ equipColorChestplate = $("#chestplatecolor").css("background-color"); equipColorHelmet = $("#helmetcolor").css("background-color"); + customName = getInput("customname"); + showCustomName = getCheckBoxInput("showcustomname"); + useDisabledSlots = getCheckBoxInput("usedisabledslots"); @@ -414,6 +420,12 @@ function generateCode(){ tags.push("HandItems:["+hands.join(",")+"]"); } + // Custom name + if(customName != "" && customName != null) + tags.push("CustomName:\""+customName+"\""); + if(showCustomName) + tags.push("CustomNameVisible:1b"); + //DisabledSlots if(useDisabledSlots){ tags.push("DisabledSlots:"+calculateDisabledSlotsFlag()); From 2c80abc37c6bf4f29b8c472086fe473898601f5f Mon Sep 17 00:00:00 2001 From: Lars Martens Date: Wed, 23 Nov 2016 18:21:13 +0100 Subject: [PATCH 06/19] CSS overhaul I think it's pretty sweet. --- images/haselkern.png | Bin 0 -> 16201 bytes index.htm | 91 +++++++++++++++++++++++++------------------ js/main.js | 5 ++- style.css | 7 +++- 4 files changed, 64 insertions(+), 39 deletions(-) create mode 100644 images/haselkern.png diff --git a/images/haselkern.png b/images/haselkern.png new file mode 100644 index 0000000000000000000000000000000000000000..eb73269a1801584f48628e6e37e9bdd2a889729f GIT binary patch literal 16201 zcmeI3dsGv57RM*NB51%DplEFxUqwhJPe{fjibR280wSwGsm+j?z(`0!GMIo^QCh9m zbz4NSXb+TDxAj<>YJIdEX-*HqDYf|6mexlVAN5_qTG7_3J4txN0cPFP?%97P2a??1 z{eAEK&F6RTFZ0i=OVuQ>f+B(d0AM90s?vzh*{=U#0mS<*tne)H5ok`#v;shMvg@C* zL$T#U0FYhA(lhW3^?XQYD&WD0DF@}*3(Ul90FckJn_*o(inDXjT+FE8bT)j!VPlAb zvsj|$tIhFf9+p^QK^K;2(sd>IIvK*5r3{kWAtFEliots)m-Z(1Ms*zXaQ=(t%Oc6sLq^c!cEpZ(-0~9+(RZN_C&4j%RT6N3kn8JZN=v< zBM|f;9aL#eFE*oK8frBaS#;>!WyGaS9_;FIOy9pbPegKghFm*p$A*x(JRX_56g)d5 zC$1HWx1ca?vZR|#2BoLUQhO1yC&frLWu7+y2UF^CRAU>ts`DBg3u z;vhOmZ?Y7?xDqRXb5YQ2%$0-vgI+WH>I#ZC8B7*pS*TJZ2L~JWQn_mlN-|n;*r-F3 zR7zrihhYd5Ba?~+d<5a5XlyK3nj;o)r6?@m!XiC_B6^_^(FxrU)oO3~fY2(FuE^Cd zJ)sdIG@?UtL{hz&s}t(=+}Ip3%7t@;Qm#lK)l2v>d{GQcEZnm)FZqDbDHe=4>tKV| z9M|gq+Z2O@8IURwvl10r>{Yo${kl)Hg=pcEqrDCT=026ou*HhHdQQRVZMwc=tnZX^ zY23XF!8+G@rqsDw0!8HD6Qljh>QnZ}uz?%+bd){uz2rmZu;rmfs)q7}a?ct%h}ERW zZLkH6%Oz^!>AKw$_emi+fgE)G0vNFW!B$w|Wq)oXp01PrPtAk%Q!6 zvLY3;qlOF>Mx4J^*QpXC?$MAPg9D-p=Xr1-6QTa!MUK$q( z2(?M$qUJ;L(zr-Ks7)FdH6N0f#zg``ZBpV2>VJ3>H4;y3+K5Lp%dR#j5s!7Ub%|+e z04SLX0A=L>@Y`eJ^BMpY@d4nv7672F01$4fc=_-=0Py=UNfnoFKXr54x%{z<$F|IB zm=>y=Q2ym;&YY-KFN}KYQP4QYqMG#8Z$9*GTHCl;{`~9g>)Td;7d|(#G6uU={wDL? zeHRvv+;_P0+ni&}&CPEH?LV$^q;0}4-giuQd@4F%Z96oExhy0*qq|LZWqG6M-dXF> zGm)wVDn;^JP*nhf<#Ro|`og2=u|eQs$-M6#TwsuM24^vnjk$k^W@clD^8^!DE9*aXx4l4~f<6rk` zd*`uE+tnXKPfsXsj(ELn5hM2UFzvf6>CF-EAA5Gp%O4d#SDVnhv~tgHqaDYLuXiq< z=gfD)9iRE&i9Vd$D>59>GZ+N{j?9s%`Fp>aQ#Lgu!@qR+&9>u~#uxb?wL+t^f=gL9 zkHDI}3mx2}>&x^V^EKrkPd&du%hEU-w=25q&pSXd<5|YqIX^9FR{nkB=p%8%@-|I8 zG`FkMZ1%ZK8q_y`}Re><~O^;q1Ep@+2hP7U9^nU#3ydE&oL`J9Y=OI%DfD z-nh51NvnCa+ZU9_W&10EEs?j*3Xgww{n~@qnzWo+-*Me$WytnlCw|Y((Vg{eaWvIU zt8Llz(3jD2hmjJk$nvRPwRci*3gT$2>2g}b^4dop3zqYthMiwERla>yGI=L+cEg%7 zW61u7G{bveJHyj%MO2*oY3%7!ypZf4BYe6`49PFq9&-cl7k_#7mBji&g?~Hu&Jq^m zVE{8!yVm!Qtd1o?Gw&_^{?@pY&ozE}|96RBwm^E2g+r~KRiXQNGiS8Fb0PVS&h
    !=Mo%eEH&WwmjSEfYD*0kAL z8^YFUPP~^LBvHMwF;E?KW8(6MaoTh^KOL`F8gOI7CVZ*StqD>5q+;g?2Xm_i&dsWS zr|=SEOVD>KSd0TBf~%3AHG6)Gay)bJZT_UF69-=Ty?};q*gA>vOoY#tlAE8`or1Dw zpX^+f3uNr#uDe?z{Uc%8p42@FhOFDaW-VQ9YPBFmQ2gD{%_&76WEzgxJH~C!n2+9` z%vgG-e2+2z#QD0bBLccsHeEU7oawX!BR4qhr`q7G52VAgr#!YSa0Gn(?U6LaE5eG49SMFH4U2Z{YDquWk$n{I z`riNa#ohTuV=A(iv@YnX^7~g)&e*8%>qY3UgcCD9=69{vK0o2c#<<|*m32qLm=pJl zXC5oO{d0JJ?Zsc-aaN_ZwN{s5x4#>INzZ(w&6&^@%Ab2bWZKTA?wF{9huMHOu&Z(R z;lkVvZ8H4msFlrEYJbSS;2X_rk8T`aU3J&)cYpi!2anY0A+b0kW#Z>4W#^_`g*&Ey tcv*u=-Uy4RX>0#XJS=Zy>XlzCz`hPfLBrkYV_XlrC(YHU>gQ-z{~N5FYM=lB literal 0 HcmV?d00001 diff --git a/index.htm b/index.htm index 32baea3..11cc92b 100644 --- a/index.htm +++ b/index.htm @@ -26,24 +26,17 @@
    - -

    MINECRAFT ARMORSTAND

    -
    + +
    +

    MINECRAFT ARMORSTAND

    GitHub Twitter + haselkern.com
    -
    - - + Troubleshooting - -
    - This thing uses WebGL! If you don't see anything on the left enable WebGL in your browser or visit the official WebGL website to troubleshoot problems. -
    -
    - +



    @@ -51,7 +44,9 @@


    +
    +
    @@ -98,45 +93,49 @@
    Rotation:
    - - +
    + +

    -
    +

    Enter the text id of an item (for example stone or iron_sword) into the appropriate slots. You can enter an arbitrary item for the head or hand, but the other slots must contain an appropriate item. +

    - - + + - -
    + +
    - -
    + +
    - -
    + +
    - -
    + +
    -
    Helmet specifies - -
    +
    Helmet specifies +
    -
    +
    +

    +
    +
    -
    +
      @@ -171,16 +170,19 @@
    -
    -
    +
    + Please note: + This command is too long to be executed from chat. You need to place it inside a command block. (see below) +
    +
    - + + Obtain a command block
    @@ -193,5 +195,20 @@
    + + +
    + + + Troubleshooting + +
    +

    + This thing uses WebGL! + If you don't see anything on the left enable WebGL in your browser or visit the official WebGL website to troubleshoot problems. +

    +
    +
    + + diff --git a/js/main.js b/js/main.js index 57fc848..db7b992 100644 --- a/js/main.js +++ b/js/main.js @@ -350,7 +350,10 @@ function updateUI(){ $("#code").text(generateCode()); if(generateCode().length > 100){ - $("#codeinfo").html("Please note: This command is too long to be executed from chat. You need to place it inside a command block. (see below)"); + $("#codeinfo").slideDown(); + } + else{ + $("#codeinfo").slideUp(); } diff --git a/style.css b/style.css index 8772948..f8d4c11 100644 --- a/style.css +++ b/style.css @@ -43,6 +43,7 @@ a{ box-shadow: 0 2px 4px #555555; margin: 0.5em; border-radius: 3px; + padding: 1em; } .right{ @@ -50,7 +51,11 @@ a{ } .padding{ - padding: 0.5em; + padding: 1em; +} + +.underline{ + border-bottom: 1px dashed #ddd; } .code{ From c20f7df61efe625f1a78d599da9f98ddf322d1df Mon Sep 17 00:00:00 2001 From: Lars Martens Date: Thu, 24 Nov 2016 20:16:56 +0100 Subject: [PATCH 07/19] Support for multiple MC Versions Apparently this is very important for many people. --- index.htm | 8 ++++++++ js/main.js | 57 ++++++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 53 insertions(+), 12 deletions(-) diff --git a/index.htm b/index.htm index 11cc92b..f574b45 100644 --- a/index.htm +++ b/index.htm @@ -36,6 +36,14 @@
+
+ +
+


diff --git a/js/main.js b/js/main.js index db7b992..c31bfdd 100644 --- a/js/main.js +++ b/js/main.js @@ -29,6 +29,9 @@ var armorstand, armorstandWrapper; //Group all the other elements //DATA -> Stuff that we'll use to generate the command. Fetched from the controls. + +var mcVersion; + var invisible = false; var invulnerable = false; var persistencerequired = false; @@ -86,7 +89,7 @@ $(document).ready(function(){ $("input").on("input", function(){ handleInput(); }); - $(':checkbox, #equipCustomHeadMode, #equipmode').change(function() { + $(':checkbox, #equipCustomHeadMode, #equipmode, #mcversion').change(function() { handleInput(); }); @@ -260,6 +263,8 @@ function setup(){ // Write stuff from input into variables function handleInput(){ + mcVersion = $("#mcversion").val(); + invisible = getCheckBoxInput("invisible"); invulnerable = getCheckBoxInput("invulnerable"); persistencerequired = getCheckBoxInput("persistencerequired"); @@ -319,8 +324,16 @@ function updateUI(){ else $("#inputarms").slideUp(); - if(useEquipment) + if(useEquipment){ $("#customequipment").slideDown(); + // Hide left hand item input for minecraft 1.8 + if(mcVersion == "1.8"){ + $("#equipHandLeft").hide(); + } + else{ + $("#equipHandLeft").show(); + } + } else $("#customequipment").slideUp(); @@ -382,6 +395,11 @@ function updateUI(){ function generateCode(){ var code = "/summon armor_stand ~ ~ ~ {"; + // Old entity name + if(mcVersion == "1.8" || mcVersion == "1.9"){ + code = "/summon ArmorStand ~ ~ ~ {"; + } + var tags = []; //CheckBoxes @@ -406,21 +424,36 @@ function generateCode(){ // Equipment if(useEquipment){ - var armor = []; + // Old 1.8 Equipment format + if(mcVersion == "1.8"){ + var armor = []; - armor.push(getShoesItem()); - armor.push(getLeggingsItem()); - armor.push(getChestplateItem()); - armor.push(getHeadItem()); + armor.push(getHandRightItem()); + armor.push(getShoesItem()); + armor.push(getLeggingsItem()); + armor.push(getChestplateItem()); + armor.push(getHeadItem()); - tags.push("ArmorItems:["+armor.join(",")+"]"); + tags.push("Equipment:["+armor.join(",")+"]"); + } + // New 1.9+ Equipment format + else{ + var armor = []; - var hands = []; + armor.push(getShoesItem()); + armor.push(getLeggingsItem()); + armor.push(getChestplateItem()); + armor.push(getHeadItem()); - hands.push(getHandRightItem()); - hands.push(getHandLeftItem()); + tags.push("ArmorItems:["+armor.join(",")+"]"); - tags.push("HandItems:["+hands.join(",")+"]"); + var hands = []; + + hands.push(getHandRightItem()); + hands.push(getHandLeftItem()); + + tags.push("HandItems:["+hands.join(",")+"]"); + } } // Custom name From a0b7cc4a2f64ad8147e01cabffb65790425de978 Mon Sep 17 00:00:00 2001 From: Lars Martens Date: Thu, 24 Nov 2016 21:03:09 +0100 Subject: [PATCH 08/19] Nicer input elements --- index.htm | 2 +- style.css | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/index.htm b/index.htm index f574b45..45cabfd 100644 --- a/index.htm +++ b/index.htm @@ -135,7 +135,7 @@
- +
diff --git a/style.css b/style.css index f8d4c11..a379918 100644 --- a/style.css +++ b/style.css @@ -30,6 +30,18 @@ a{ color: #000000; } +input[type="text"], select{ + border: 1px solid #aaa; + border-radius: 3px; + padding: 0.5em; +} +input[type="text"]:not(:last-child){ + margin-bottom: 0.5em; +} +#customname{ + margin-bottom: 0; +} + #gl{ width: 60%; height: 100%; From 67361632923ecc43de32be929fe8242e527235e2 Mon Sep 17 00:00:00 2001 From: Lars Martens Date: Thu, 2 Feb 2017 15:48:30 +0100 Subject: [PATCH 09/19] added marker tag --- index.htm | 1 + js/main.js | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/index.htm b/index.htm index 45cabfd..297f6de 100644 --- a/index.htm +++ b/index.htm @@ -52,6 +52,7 @@


+
diff --git a/js/main.js b/js/main.js index c31bfdd..dfc2d06 100644 --- a/js/main.js +++ b/js/main.js @@ -39,6 +39,7 @@ var noBasePlate = false; var noGravity = false; var showArms = false; var small = false; +var marker = false; var useEquipment; var equipHandRight; @@ -272,6 +273,7 @@ function handleInput(){ noGravity = getCheckBoxInput("nogravity"); showArms = getCheckBoxInput("showarms"); small = getCheckBoxInput("small"); + marker = getCheckBoxInput("marker"); useEquipment = getCheckBoxInput("useequipment"); equipHandRight = getInput("equipHandRight"); @@ -417,6 +419,8 @@ function generateCode(){ tags.push("ShowArms:1b"); if(small) tags.push("Small:1b"); + if(marker) + tags.push("Marker:1b"); //Sliders if(rotation != 0) From a31b074f9c9e1789363ac22748379f2102d12822 Mon Sep 17 00:00:00 2001 From: Lars Martens Date: Mon, 10 Apr 2017 14:23:43 +0200 Subject: [PATCH 10/19] Fixed markdown in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ad0fe56..609fb32 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Minecraft Armor Stand ================= -###[Try it out](http://haselkern.github.io/Minecraft-ArmorStand) +### [Try it out](http://haselkern.github.io/Minecraft-ArmorStand) In Minecraft 1.8 Armorstands were introduced. Unfortunately, the syntax to summon one is quite confusing and not very intuitive, especially when you're trying to create an awesome pose. This tool provides a graphical interface, so that you can focus on the looks and not worry about code. From 81e5fdd0edb5a8cf2698818c35cdcfd641a0c782 Mon Sep 17 00:00:00 2001 From: Lars Martens Date: Sat, 13 May 2017 18:49:07 +0200 Subject: [PATCH 11/19] Use CloudFlare CDN for THREE.js --- index.htm | 2 +- js/three.js | 35842 -------------------------------------------------- 2 files changed, 1 insertion(+), 35843 deletions(-) delete mode 100644 js/three.js diff --git a/index.htm b/index.htm index 297f6de..6d2fc12 100644 --- a/index.htm +++ b/index.htm @@ -8,7 +8,7 @@ - + + (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ + (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), + m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) + })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); + ga('create', 'UA-71932800-2', 'auto'); + ga('send', 'pageview'); + From 1473d3cebc743afa827c673ae110ad25070361b2 Mon Sep 17 00:00:00 2001 From: Lars Martens Date: Tue, 13 Jun 2017 10:13:47 +0200 Subject: [PATCH 15/19] Give codes can now be parsed --- index.htm | 1 + js/main.js | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/index.htm b/index.htm index b0a1899..fc8fe28 100644 --- a/index.htm +++ b/index.htm @@ -159,6 +159,7 @@ +
diff --git a/js/main.js b/js/main.js index bdd672a..661ad78 100644 --- a/js/main.js +++ b/js/main.js @@ -556,6 +556,30 @@ function getHeadItem(){ return '{id:"skull",Count:1b,Damage:3b,tag:{SkullOwner:{Id:'+uuid+',Properties:{textures:[{Value:'+base64Value+'}]}}}}'; } + + // Parse give code + else if(equipCustomHeadMode == "givecode"){ + var skullOwnerRaw = equipHelmet.substring(equipHelmet.indexOf("SkullOwner")); + var parsed = ""; + var bracketCounter = 0; + var bracketsStarted = false; + + for(var i = 0; i < skullOwnerRaw.length; i++){ + var c = skullOwnerRaw[i]; + + if(c == "{"){ + bracketsStarted = true; + bracketCounter++; + } + if(c == "}") bracketCounter--; + + parsed += c; + if(bracketCounter == 0 && bracketsStarted) break; + } + + return '{id:"skull",Count:1b,Damage:3b,tag:{'+parsed+'}}'; + } + } function calculateDisabledSlotsFlag() { From 7ab69d7a426560b91d6421997dcc9906c0acf32b Mon Sep 17 00:00:00 2001 From: Lars Martens Date: Wed, 14 Jun 2017 09:47:14 +0200 Subject: [PATCH 16/19] Partnering with minecraft-heads.com --- index.htm | 7 +++++++ js/main.js | 44 +++++++++++++++++++++++++++++++------------- 2 files changed, 38 insertions(+), 13 deletions(-) diff --git a/index.htm b/index.htm index fc8fe28..6a667d5 100644 --- a/index.htm +++ b/index.htm @@ -161,6 +161,13 @@ + +
+
+ Shop for some nice heads and then copy the Give Code into the helmet field: +
+ minecraft-heads.com +
diff --git a/js/main.js b/js/main.js index 661ad78..2b594c5 100644 --- a/js/main.js +++ b/js/main.js @@ -362,12 +362,21 @@ function updateUI(){ else $("#helmetcolor").slideUp(); + // Link to minecraft-heads.com + if(equipCustomHeadMode == "givecode"){ + $("#minecraft-heads").slideDown(); + } + else{ + $("#minecraft-heads").slideUp(); + } + // Show disabled slots if(useDisabledSlots) $("#disabledslots").slideDown(); else $("#disabledslots").slideUp(); + // Generate code $("#code").text(generateCode()); if(generateCode().length > 100){ $("#codeinfo").slideDown(); @@ -559,25 +568,34 @@ function getHeadItem(){ // Parse give code else if(equipCustomHeadMode == "givecode"){ - var skullOwnerRaw = equipHelmet.substring(equipHelmet.indexOf("SkullOwner")); - var parsed = ""; - var bracketCounter = 0; - var bracketsStarted = false; - for(var i = 0; i < skullOwnerRaw.length; i++){ - var c = skullOwnerRaw[i]; + // Give Code in this format: /give @p skull 1 3 {display:{Name:"Some Name"},SkullOwner:{Id:"a74719ce... + if(equipHelmet.indexOf("SkullOwner:{") >= 0){ + var skullOwnerRaw = equipHelmet.substring(equipHelmet.indexOf("SkullOwner")); + var parsed = ""; + var bracketCounter = 0; + var bracketsStarted = false; - if(c == "{"){ - bracketsStarted = true; - bracketCounter++; + for(var i = 0; i < skullOwnerRaw.length; i++){ + var c = skullOwnerRaw[i]; + + if(c == "{") bracketCounter++; + if(c == "}") bracketCounter--; + + parsed += c; + if(bracketCounter == 0 && bracketsStarted) break; + if(c == ":") bracketsStarted = true; } - if(c == "}") bracketCounter--; - parsed += c; - if(bracketCounter == 0 && bracketsStarted) break; + return '{id:"skull",Count:1b,Damage:3b,tag:{'+parsed+'}}'; + } + // Give Code in this format: /give @p skull 1 3 {SkullOwner:"playername"} (quotes optional) + else{ + var skullOwnerRaw = equipHelmet.substring(equipHelmet.indexOf("SkullOwner:")); + skullOwnerRaw = skullOwnerRaw.substring(0, skullOwnerRaw.indexOf("}")); + return '{id:"skull",Count:1b,Damage:3b,tag:{'+skullOwnerRaw+'}}'; } - return '{id:"skull",Count:1b,Damage:3b,tag:{'+parsed+'}}'; } } From 99bc954931feeae572c7b53fb52b148ccfca55f6 Mon Sep 17 00:00:00 2001 From: Lars Martens Date: Wed, 14 Jun 2017 10:07:03 +0200 Subject: [PATCH 17/19] Click to copy code --- index.htm | 5 ++++- js/main.js | 31 +++++++++++++++++++++++++++++++ style.css | 7 +++++++ 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/index.htm b/index.htm index 6a667d5..2ee1c32 100644 --- a/index.htm +++ b/index.htm @@ -217,7 +217,10 @@ -
+
+
click to copy
+
+
Please note: This command is too long to be executed from chat. You need to place it inside a command block. (see below) diff --git a/js/main.js b/js/main.js index 2b594c5..76842cf 100644 --- a/js/main.js +++ b/js/main.js @@ -80,6 +80,32 @@ Point = { y:null }; +jQuery.fn.selectAndCopyText = function(){ + // https://stackoverflow.com/a/9976413/1456971 + this.find('input').each(function() { + if($(this).prev().length == 0 || !$(this).prev().hasClass('p_copy')) { + $('

').insertBefore($(this)); + } + $(this).prev().html($(this).val()); + }); + + var doc = document; + var element = this[0]; + if (doc.body.createTextRange) { + var range = document.body.createTextRange(); + range.moveToElementText(element); + range.select(); + } else if (window.getSelection) { + var selection = window.getSelection(); + var range = document.createRange(); + range.selectNodeContents(element); + selection.removeAllRanges(); + selection.addRange(range); + } + + document.execCommand("copy"); +}; + $(document).ready(function(){ //Init setup(); @@ -90,6 +116,11 @@ $(document).ready(function(){ window.onbeforeunload = function(){ return "Changes will NOT be saved. Exit anyways?"; }; + + // Copy code on click + $(".code").click(function(){ + $("#code").selectAndCopyText(); + }); //Stuff to handle and update input $("input").on("input", function(){ diff --git a/style.css b/style.css index a379918..8250b95 100644 --- a/style.css +++ b/style.css @@ -78,6 +78,13 @@ input[type="text"]:not(:last-child){ border-radius: 3px; color: #ffffff; } +#code-copy-hint{ + font-family: sans-serif; + font-style: italic; + font-size: 0.8em; + text-align: right; + opacity: 0.6; +} #disabledslots{ display: block; From 0085f983303cac7a6bae204197969fa5f8bcc27b Mon Sep 17 00:00:00 2001 From: Lars Martens Date: Fri, 16 Jun 2017 11:50:42 +0200 Subject: [PATCH 18/19] Rewording --- index.htm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.htm b/index.htm index 2ee1c32..babe01d 100644 --- a/index.htm +++ b/index.htm @@ -164,7 +164,7 @@

- Shop for some nice heads and then copy the Give Code into the helmet field: + You can find lots of different heads here. Pick one and copy the Give-Code into the helmet field:
minecraft-heads.com
From c6fb3236bd25945d5f2258bef52f6b42d53cea3c Mon Sep 17 00:00:00 2001 From: Lars Martens Date: Wed, 28 Jun 2017 12:45:58 +0200 Subject: [PATCH 19/19] Removed whitespace in title --- index.htm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.htm b/index.htm index babe01d..ab96bdd 100644 --- a/index.htm +++ b/index.htm @@ -1,7 +1,7 @@ - Minecraft Armor Stand + Minecraft Armorstand