mirror of
				https://github.com/haselkern/Minecraft-ArmorStand.git
				synced 2025-10-30 21:24:06 +00:00 
			
		
		
		
	Support for multiple MC Versions
Apparently this is very important for many people.
This commit is contained in:
		
							parent
							
								
									2c80abc37c
								
							
						
					
					
						commit
						c20f7df61e
					
				
					 2 changed files with 53 additions and 12 deletions
				
			
		|  | @ -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 & 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> | ||||||
|  |  | ||||||
							
								
								
									
										37
									
								
								js/main.js
									
										
									
									
									
								
							
							
						
						
									
										37
									
								
								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.
 | //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,6 +424,20 @@ function generateCode(){ | ||||||
| 
 | 
 | ||||||
| 	// Equipment
 | 	// Equipment
 | ||||||
| 	if(useEquipment){ | 	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 = []; | 			var armor = []; | ||||||
| 
 | 
 | ||||||
| 			armor.push(getShoesItem()); | 			armor.push(getShoesItem()); | ||||||
|  | @ -422,6 +454,7 @@ function generateCode(){ | ||||||
| 
 | 
 | ||||||
| 			tags.push("HandItems:["+hands.join(",")+"]"); | 			tags.push("HandItems:["+hands.join(",")+"]"); | ||||||
| 		} | 		} | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
| 	// Custom name
 | 	// Custom name
 | ||||||
| 	if(customName != "" && customName != null) | 	if(customName != "" && customName != null) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lars Martens
						Lars Martens