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> </center>
</div> </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"> <div class="padding underline">
<label><input type="checkbox" name="invisible">Invisible</label><br> <label><input type="checkbox" name="invisible">Invisible</label><br>
<label><input type="checkbox" name="invulnerable">Invulnerable</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. //DATA -> Stuff that we'll use to generate the command. Fetched from the controls.
var mcVersion;
var invisible = false; var invisible = false;
var invulnerable = false; var invulnerable = false;
var persistencerequired = false; var persistencerequired = false;
@ -86,7 +89,7 @@ $(document).ready(function(){
$("input").on("input", function(){ $("input").on("input", function(){
handleInput(); handleInput();
}); });
$(':checkbox, #equipCustomHeadMode, #equipmode').change(function() { $(':checkbox, #equipCustomHeadMode, #equipmode, #mcversion').change(function() {
handleInput(); handleInput();
}); });
@ -260,6 +263,8 @@ function setup(){
// Write stuff from input into variables // Write stuff from input into variables
function handleInput(){ function handleInput(){
mcVersion = $("#mcversion").val();
invisible = getCheckBoxInput("invisible"); invisible = getCheckBoxInput("invisible");
invulnerable = getCheckBoxInput("invulnerable"); invulnerable = getCheckBoxInput("invulnerable");
persistencerequired = getCheckBoxInput("persistencerequired"); persistencerequired = getCheckBoxInput("persistencerequired");
@ -319,8 +324,16 @@ function updateUI(){
else else
$("#inputarms").slideUp(); $("#inputarms").slideUp();
if(useEquipment) if(useEquipment){
$("#customequipment").slideDown(); $("#customequipment").slideDown();
// Hide left hand item input for minecraft 1.8
if(mcVersion == "1.8"){
$("#equipHandLeft").hide();
}
else{
$("#equipHandLeft").show();
}
}
else else
$("#customequipment").slideUp(); $("#customequipment").slideUp();
@ -382,6 +395,11 @@ function updateUI(){
function generateCode(){ function generateCode(){
var code = "/summon armor_stand ~ ~ ~ {"; var code = "/summon armor_stand ~ ~ ~ {";
// Old entity name
if(mcVersion == "1.8" || mcVersion == "1.9"){
code = "/summon ArmorStand ~ ~ ~ {";
}
var tags = []; var tags = [];
//CheckBoxes //CheckBoxes
@ -406,21 +424,36 @@ function generateCode(){
// Equipment // Equipment
if(useEquipment){ if(useEquipment){
var armor = []; // Old 1.8 Equipment format
if(mcVersion == "1.8"){
var armor = [];
armor.push(getShoesItem()); armor.push(getHandRightItem());
armor.push(getLeggingsItem()); armor.push(getShoesItem());
armor.push(getChestplateItem()); armor.push(getLeggingsItem());
armor.push(getHeadItem()); 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()); tags.push("ArmorItems:["+armor.join(",")+"]");
hands.push(getHandLeftItem());
tags.push("HandItems:["+hands.join(",")+"]"); var hands = [];
hands.push(getHandRightItem());
hands.push(getHandLeftItem());
tags.push("HandItems:["+hands.join(",")+"]");
}
} }
// Custom name // Custom name