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

Support for multiple MC Versions

Apparently this is very important for many people.
This commit is contained in:
Lars Martens 2016-11-24 20:16:56 +01:00
parent 2c80abc37c
commit c20f7df61e
2 changed files with 53 additions and 12 deletions

View file

@ -36,6 +36,14 @@
</center>
</div>
<div class="padding underline">
<select id="mcversion">
<option value="1.11">Minecraft 1.11 and above</option>
<option value="1.9">Minecraft 1.9 &amp; 1.10</option>
<option value="1.8">Minecraft 1.8</option>
</select>
</div>
<div class="padding underline">
<label><input type="checkbox" name="invisible">Invisible</label><br>
<label><input type="checkbox" name="invulnerable">Invulnerable</label><br>

View file

@ -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,6 +424,20 @@ function generateCode(){
// Equipment
if(useEquipment){
// Old 1.8 Equipment format
if(mcVersion == "1.8"){
var armor = [];
armor.push(getHandRightItem());
armor.push(getShoesItem());
armor.push(getLeggingsItem());
armor.push(getChestplateItem());
armor.push(getHeadItem());
tags.push("Equipment:["+armor.join(",")+"]");
}
// New 1.9+ Equipment format
else{
var armor = [];
armor.push(getShoesItem());
@ -422,6 +454,7 @@ function generateCode(){
tags.push("HandItems:["+hands.join(",")+"]");
}
}
// Custom name
if(customName != "" && customName != null)