mirror of
https://github.com/haselkern/Minecraft-ArmorStand.git
synced 2025-05-17 15:05:33 +00:00
Major Version
It now generates a full command, and has a lot of fancy additions.
This commit is contained in:
parent
d7ea813432
commit
df326d9c9d
4 changed files with 126 additions and 17 deletions
BIN
icon.png
Normal file
BIN
icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 360 B |
65
index.htm
65
index.htm
|
@ -2,7 +2,9 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Minecraft Armor Stand</title>
|
<title>Minecraft Armor Stand</title>
|
||||||
|
<meta charset="utf-8">
|
||||||
<link rel="stylesheet" href="style.css">
|
<link rel="stylesheet" href="style.css">
|
||||||
|
<link rel="icon" type="image/png" href="icon.png">
|
||||||
<link href='http://fonts.googleapis.com/css?family=Oswald:700' rel='stylesheet' type='text/css'>
|
<link href='http://fonts.googleapis.com/css?family=Oswald:700' rel='stylesheet' type='text/css'>
|
||||||
<link href='http://fonts.googleapis.com/css?family=Roboto+Condensed:700' rel='stylesheet' type='text/css'>
|
<link href='http://fonts.googleapis.com/css?family=Roboto+Condensed:700' rel='stylesheet' type='text/css'>
|
||||||
<script src="three.js"></script>
|
<script src="three.js"></script>
|
||||||
|
@ -13,12 +15,15 @@
|
||||||
|
|
||||||
<div id="gl"></div>
|
<div id="gl"></div>
|
||||||
|
|
||||||
<div id="controls">
|
<div id="card">
|
||||||
|
|
||||||
<h1>MINECRAFT ARMOR STAND<br>Please note:</h1>
|
<h1>MINECRAFT ARMOR STAND</h1>
|
||||||
This thing is nowhere near complete, I just wanted to upload it so I don't lose my work if my local copy messes up.
|
<center>
|
||||||
|
<a href="https://github.com/haselkern/Minecraft-ArmorStand" target="_blank">Check it on GitHub</a>
|
||||||
|
<!-- TODO <a href="#">Or on Reddit</a> -->
|
||||||
|
</center>
|
||||||
|
|
||||||
<div id="inputsection">
|
<div id="inputsection" class="padding">
|
||||||
|
|
||||||
<input type="checkbox" name="invisible">Invisible<br>
|
<input type="checkbox" name="invisible">Invisible<br>
|
||||||
<input type="checkbox" name="invulnerable">Invulnerable<br>
|
<input type="checkbox" name="invulnerable">Invulnerable<br>
|
||||||
|
@ -45,8 +50,58 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="code"></div>
|
<div id="code" class="code"></div>
|
||||||
|
<div id="codeinfo" class="padding"></div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="card">
|
||||||
|
<span class="padding" style="cursor: pointer;" onclick="javascript:$('#tipsntricks').slideToggle();">
|
||||||
|
+ Tips and Tricks for your Armor Stand
|
||||||
|
</span>
|
||||||
|
<br>
|
||||||
|
<div id="tipsntricks">
|
||||||
|
|
||||||
|
<div class="padding">
|
||||||
|
If your command is longer than 100 characters, it needs to be executed with a <b>command block</b>. Obtain one by typing:
|
||||||
|
</div>
|
||||||
|
<div class="code">
|
||||||
|
/give @p command_block
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="padding">
|
||||||
|
<br>
|
||||||
|
You can give the armor stand a <b>custom player head</b>! Just replace <i>Notch</i> with an username of your choice.
|
||||||
|
</div>
|
||||||
|
<div class="code">
|
||||||
|
/give @p skull 1 3 {SkullOwner:"Notch"}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="padding">
|
||||||
|
<br>
|
||||||
|
You can use the following command to <b>fully customise the equipment</b> of your armorstand.<br>
|
||||||
|
In order for it to work, you have to put a command block close to the armorstand you want to edit. (Notice the <i>r=2</i>, where the r is radius.)
|
||||||
|
</div>
|
||||||
|
<div class="code">
|
||||||
|
/entitydata @e[r=2,ArmorStand] {Equipment:[{id:"iron_sword",Count:1b},{id:"iron_boots",Count:1b},{id:"iron_leggings",Count:1b},{id:"iron_chestplate",Count:1b},{id:"iron_helmet",Count:1b}]}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="padding">
|
||||||
|
<br>
|
||||||
|
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).<br>
|
||||||
|
If you want to <b>disable specific slots</b>, you have to add the numbers in following table up, and replace n with your result.
|
||||||
|
<table>
|
||||||
|
<tr><td>Boots</td> <td>2</td></tr>
|
||||||
|
<tr><td>Leggings</td> <td>4</td></tr>
|
||||||
|
<tr><td>Chestplate</td> <td>8</td></tr>
|
||||||
|
<tr><td>Helmet/Block</td><td>16</td></tr>
|
||||||
|
<tr><td>Sword/Block</td> <td>Not working :(</td></tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="code">
|
||||||
|
/entitydata @e[r=2,ArmorStand] {DisabledSlots:n}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
42
main.js
42
main.js
|
@ -39,6 +39,7 @@ var rightLeg = new THREE.Vector3(0,0,0);
|
||||||
var leftArm = new THREE.Vector3(0,0,0);
|
var leftArm = new THREE.Vector3(0,0,0);
|
||||||
var rightArm = new THREE.Vector3(0,0,0);
|
var rightArm = new THREE.Vector3(0,0,0);
|
||||||
var rotation = 0;
|
var rotation = 0;
|
||||||
|
var vec0 = new THREE.Vector3(0,0,0); // We use this to determine if we want a pose in the command.
|
||||||
|
|
||||||
//Stuff for mouse movements
|
//Stuff for mouse movements
|
||||||
var mouseDownX;
|
var mouseDownX;
|
||||||
|
@ -53,10 +54,12 @@ Point = {
|
||||||
};
|
};
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
//Init
|
||||||
setup();
|
setup();
|
||||||
updateUI();
|
updateUI();
|
||||||
render();
|
render();
|
||||||
|
|
||||||
|
//Stuff to handle input
|
||||||
$("input").on("input", function(){
|
$("input").on("input", function(){
|
||||||
handleInput();
|
handleInput();
|
||||||
});
|
});
|
||||||
|
@ -64,6 +67,7 @@ $(document).ready(function(){
|
||||||
handleInput();
|
handleInput();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Handle rotating with mouse
|
||||||
$("#gl")
|
$("#gl")
|
||||||
.mousedown(function(event){
|
.mousedown(function(event){
|
||||||
mouseDownX = event.pageX;
|
mouseDownX = event.pageX;
|
||||||
|
@ -79,6 +83,9 @@ $(document).ready(function(){
|
||||||
mouseDownX = null;
|
mouseDownX = null;
|
||||||
mouseDownY = null;
|
mouseDownY = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Tips and tricks
|
||||||
|
$("#tipsntricks").hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
function setup(){
|
function setup(){
|
||||||
|
@ -246,6 +253,9 @@ function updateUI(){
|
||||||
else
|
else
|
||||||
$("#inputarms").hide();
|
$("#inputarms").hide();
|
||||||
$("#code").text(generateCode());
|
$("#code").text(generateCode());
|
||||||
|
if(generateCode().length > 100){
|
||||||
|
$("#codeinfo").html("<b>Please note:</b> This command is too long to be executed from chat. You need to place it inside a command block. (See tips and tricks below.)");
|
||||||
|
}
|
||||||
|
|
||||||
// Rotate 3D Stuff
|
// Rotate 3D Stuff
|
||||||
// y and z rotation needs to be inverted
|
// y and z rotation needs to be inverted
|
||||||
|
@ -267,6 +277,7 @@ function generateCode(){
|
||||||
|
|
||||||
var tags = [];
|
var tags = [];
|
||||||
|
|
||||||
|
//CheckBoxes
|
||||||
if(invisible)
|
if(invisible)
|
||||||
tags.push("Invisible:1b");
|
tags.push("Invisible:1b");
|
||||||
if(invulnerable)
|
if(invulnerable)
|
||||||
|
@ -280,12 +291,43 @@ function generateCode(){
|
||||||
if(small)
|
if(small)
|
||||||
tags.push("Small:1b");
|
tags.push("Small:1b");
|
||||||
|
|
||||||
|
//Sliders
|
||||||
|
if(rotation != 0)
|
||||||
|
tags.push("Rotation:["+rotation+"f]");
|
||||||
|
|
||||||
|
//Now the pose
|
||||||
|
var pose = [];
|
||||||
|
if(!isZero(body))
|
||||||
|
pose.push("Body:"+getJSONArray(body));
|
||||||
|
if(!isZero(head))
|
||||||
|
pose.push("Head:"+getJSONArray(head));
|
||||||
|
if(!isZero(leftLeg))
|
||||||
|
pose.push("LeftLeg:"+getJSONArray(leftLeg));
|
||||||
|
if(!isZero(rightLeg))
|
||||||
|
pose.push("RightLeg:"+getJSONArray(rightLeg));
|
||||||
|
if(showArms){
|
||||||
|
if(!isZero(leftArm))
|
||||||
|
pose.push("LeftArm:"+getJSONArray(leftArm));
|
||||||
|
if(!isZero(rightArm))
|
||||||
|
pose.push("LeftArm:"+getJSONArray(rightArm));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(pose.length > 0)
|
||||||
|
tags.push("Pose:{"+pose.join(",")+"}");
|
||||||
|
|
||||||
code += tags.join(",");
|
code += tags.join(",");
|
||||||
code += "}";
|
code += "}";
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isZero(vector){
|
||||||
|
return vector.x == 0 && vector.y == 0 && vector.z == 0;
|
||||||
|
}
|
||||||
|
function getJSONArray(vector){
|
||||||
|
return "["+vector.x+"f,"+vector.y+"f,"+vector.z+"f]";
|
||||||
|
}
|
||||||
|
|
||||||
function getMouseDeltaX(){
|
function getMouseDeltaX(){
|
||||||
var mouseDeltaX = 0;
|
var mouseDeltaX = 0;
|
||||||
if(mouseDownX != null && mouseMoveX != null){
|
if(mouseDownX != null && mouseMoveX != null){
|
||||||
|
|
36
style.css
36
style.css
|
@ -15,6 +15,21 @@ body{
|
||||||
background-color: #dddddd;
|
background-color: #dddddd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div{
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1{
|
||||||
|
text-align: center;
|
||||||
|
font-family: "Oswald", sans-serif;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
a{
|
||||||
|
color: #000000;
|
||||||
|
}
|
||||||
|
|
||||||
#gl{
|
#gl{
|
||||||
width: 60%;
|
width: 60%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
@ -22,24 +37,21 @@ body{
|
||||||
cursor: move;
|
cursor: move;
|
||||||
}
|
}
|
||||||
|
|
||||||
#controls{
|
#card{
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
box-shadow: 0 2px 4px #555555;
|
box-shadow: 0 2px 4px #555555;
|
||||||
margin: 1em;
|
margin: 0.5em;
|
||||||
margin-left: 60%;
|
margin-left: 60%;
|
||||||
}
|
}
|
||||||
#inputsection{
|
|
||||||
margin: 0.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
#code{
|
.padding{
|
||||||
margin: 0.5em;
|
|
||||||
padding: 0.5em;
|
padding: 0.5em;
|
||||||
font-style: italic;
|
|
||||||
word-wrap: break-word;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
h1{
|
.code{
|
||||||
text-align: center;
|
word-wrap: break-word;
|
||||||
font-family: "Oswald", sans-serif;
|
padding: 1em;
|
||||||
|
font-family: monospace;
|
||||||
|
background-color: #37474f;
|
||||||
|
color: #ffffff;
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue