From 11f1eb6d57e1e4741f4bb33b2d86d94d44c9766d Mon Sep 17 00:00:00 2001 From: haselkern Date: Wed, 20 Aug 2014 18:05:01 +0200 Subject: [PATCH] Lock Certain Slots --- ic/slots.png | Bin 0 -> 570 bytes index.htm | 74 +++++++++++++++++++++++++++++++++------------------ main.js | 56 +++++++++++++++++++++++++++++++++----- style.css | 24 +++++++++++++++++ 4 files changed, 122 insertions(+), 32 deletions(-) create mode 100644 ic/slots.png diff --git a/ic/slots.png b/ic/slots.png new file mode 100644 index 0000000000000000000000000000000000000000..f356b15eea172c6d5d21c4441b549b169f9fc374 GIT binary patch literal 570 zcmV-A0>%A_P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02*{fSaefwW^{L9 za%BKeVQFr3E>1;MAa*k@H7+qQF!XYv00050Nkl*XciVAGK@YZp7@dipp_K&hk}7BEJ%@zp~wP>yDcf#G})cvhc;3UY5`Q-Oc} zu&F>HJ^x7s-k8%9+zKvKfGH}7^aL0&h$d(C8#3UAi6(_w2n=7|2l^JA7eso3i(J9a z6=2ebG*=*UZlh0l1L3Fu&3jI+M209Vpk+N2Ac!U>@Sc+IKVY?5^`c4RL5Tgb-|yQC ze3)ZX!5;{BUDrc99niEg;mu}qENKc0gn3aoHiv;Pm~_K{FM%eH!|TgqzkYiff|U4s zQU&4n^>g1X?uUS`pjsm1u(E|cG`G_f4E3K)YJ*moRxq1=0B)&rG_8NLMF0Q*07*qo IM6N<$f`-E5`Tzg` literal 0 HcmV?d00001 diff --git a/index.htm b/index.htm index 22249af..2903ba1 100644 --- a/index.htm +++ b/index.htm @@ -17,7 +17,7 @@
-

MINECRAFT ARMOR STAND

+

MINECRAFT ARMOR STAND

GitHub @@ -33,16 +33,16 @@
-
+




-
+

- Rotation: + Rotation:
Head: @@ -83,8 +83,47 @@
+
-
+ + +
+
+   + + + + + +
+ +
+ Remove + + + + + +
+
+ Replace + + + + + +
+
+ Place + + + + + +
+
+ +
@@ -92,35 +131,18 @@
- - + Tips and Tricks for your Armor Stand + + + Obtain a command block
-
- +
If your command is longer than 100 characters, it needs to be executed with a command block. Obtain one by typing:
/give @p command_block
- -
-
- If you are a mapmaker you might not want players to take items out of the armor stand. If you want to lock all slots, replace n with 1 (or 0 if you want to unlock it).
- If you want to disable specific slots, you have to add the numbers in following table up, and replace n with your result. - - - - - - -
Boots 2
Leggings 4
Chestplate 8
Helmet/Block16
Sword/Block Not working :(
-
-
- /entitydata @e[r=2,ArmorStand] {DisabledSlots:n} -
- + \ No newline at end of file diff --git a/main.js b/main.js index 696f0a9..2ccb49b 100644 --- a/main.js +++ b/main.js @@ -40,6 +40,8 @@ var equipChestplate; var equipHelmet; var equipCustomHead; +var useDisabledSlots; + //The rotation values are all in degrees. var head = new THREE.Vector3(0,0,0); var body = new THREE.Vector3(0,0,0); @@ -93,8 +95,12 @@ $(document).ready(function(){ }); //Hide elements - $("#tipsntricks").hide(); + $("#getcommandblock").hide(); $("#troubleshooting").hide(); + $("#inputarms").hide(); + $("#customequipment").hide(); + $("#disabledslots").hide(); + }); function setup(){ @@ -244,6 +250,8 @@ function handleInput(){ equipHelmet = getInput("equipHelmet"); equipCustomHead = getCheckBoxInput("equipCustomHead"); + useDisabledSlots = getCheckBoxInput("usedisabledslots"); + body.set(getRangeInput("bodyX"), getRangeInput("bodyY"), getRangeInput("bodyZ")); head.set(getRangeInput("headX"), getRangeInput("headY"), getRangeInput("headZ")); @@ -270,16 +278,21 @@ function getInput(name){ function updateUI(){ //Hide/Show different inputs if(showArms) - $("#inputarms").show(); + $("#inputarms").slideDown(); else - $("#inputarms").hide(); + $("#inputarms").slideUp(); if(useCustomEquipment) - $("#customequipment").show(); + $("#customequipment").slideDown(); else - $("#customequipment").hide(); + $("#customequipment").slideUp(); + if(useDisabledSlots) + $("#disabledslots").slideDown(); + else + $("#disabledslots").slideUp(); + $("#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 tips and tricks below.)"); + $("#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)"); } @@ -359,6 +372,11 @@ function generateCode(){ tags.push("Equipment:["+equip.join(",")+"]"); } + //DisabledSlots + if(useDisabledSlots){ + tags.push("DisabledSlots:"+calculateDisabledSlotsFlag()); + } + //Now the pose var pose = []; if(!isZero(body)) @@ -385,6 +403,32 @@ function generateCode(){ return code; } +function calculateDisabledSlotsFlag() { + var dH = $("#dH").is(":checked") ? 1 << (4) : 0; + var dC = $("#dC").is(":checked") ? 1 << (3) : 0; + var dL = $("#dL").is(":checked") ? 1 << (2) : 0; + var dB = $("#dB").is(":checked") ? 1 << (1) : 0; + var dW = $("#dW").is(":checked") ? 1 << (0) : 0; + var dR = dH + dC + dL + dB + dW; + + var rH = $("#rH").is(":checked") ? 1 << (4 + 8) : 0; + var rC = $("#rC").is(":checked") ? 1 << (3 + 8) : 0; + var rL = $("#rL").is(":checked") ? 1 << (2 + 8) : 0; + var rB = $("#rB").is(":checked") ? 1 << (1 + 8) : 0; + var rW = $("#rW").is(":checked") ? 1 << (0 + 8) : 0; + var rR = rH + rC + rL + rB + rW; + + var pH = $("#pH").is(":checked") ? 1 << (4 + 16) : 0; + var pC = $("#pC").is(":checked") ? 1 << (3 + 16) : 0; + var pL = $("#pL").is(":checked") ? 1 << (2 + 16) : 0; + var pB = $("#pB").is(":checked") ? 1 << (1 + 16) : 0; + var pW = $("#pW").is(":checked") ? 1 << (0 + 16) : 0; + var pR = pH + pC + pL + pB + pW; + + var result = dR + rR + pR; + return result; +} + function isZero(vector){ return vector.x == 0 && vector.y == 0 && vector.z == 0; } diff --git a/style.css b/style.css index dae587f..206615a 100644 --- a/style.css +++ b/style.css @@ -65,4 +65,28 @@ a{ #customequipment input[type=text]{ width: 100%; +} + +#disabledslots{ + display: block; +} + +#disabledslots .first{ + width: 60px; + display: inline-block; + clear: left; +} + +#disabledslots span{ + width: 16px; + height: 16px; + display: inline-block; +} + +#disabledslots .sprite{ + background-repeat: no-repeat; + background-image: url("ic/slots.png"); + width: 16px; + height: 16px; + display: inline-block; } \ No newline at end of file