mirror of
				https://github.com/haselkern/Minecraft-ArmorStand.git
				synced 2025-10-31 12:14:05 +00:00 
			
		
		
		
	Partnering with minecraft-heads.com
This commit is contained in:
		
							parent
							
								
									1473d3cebc
								
							
						
					
					
						commit
						7ab69d7a42
					
				
					 2 changed files with 38 additions and 13 deletions
				
			
		|  | @ -161,6 +161,13 @@ | |||
|                     <option value="url">Image URL</option> | ||||
|                     <option value="givecode">Give Code</option> | ||||
|                 </select> | ||||
| 
 | ||||
|                 <div id="minecraft-heads"> | ||||
|                     <br> | ||||
|                     Shop for some nice heads and then copy the <i>Give Code</i> into the helmet field: | ||||
|                     <br> | ||||
|                     <a href="http://minecraft-heads.com/" target="_blank"><img src="http://minecraft-heads.com/images/banners/minecraft-heads_halfbanner_234x60.png" alt="minecraft-heads.com" /></a> | ||||
|                 </div> | ||||
|             </div> | ||||
|         </div> | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										26
									
								
								js/main.js
									
										
									
									
									
								
							
							
						
						
									
										26
									
								
								js/main.js
									
										
									
									
									
								
							|  | @ -362,12 +362,21 @@ function updateUI(){ | |||
|     else | ||||
|         $("#helmetcolor").slideUp(); | ||||
| 
 | ||||
| 	// Link to minecraft-heads.com
 | ||||
| 	if(equipCustomHeadMode == "givecode"){ | ||||
| 		$("#minecraft-heads").slideDown(); | ||||
| 	} | ||||
| 	else{ | ||||
| 		$("#minecraft-heads").slideUp(); | ||||
| 	} | ||||
| 
 | ||||
| 	// Show disabled slots
 | ||||
| 	if(useDisabledSlots) | ||||
| 		$("#disabledslots").slideDown(); | ||||
| 	else | ||||
| 		$("#disabledslots").slideUp(); | ||||
| 
 | ||||
| 	// Generate code
 | ||||
| 	$("#code").text(generateCode()); | ||||
| 	if(generateCode().length > 100){ | ||||
| 		$("#codeinfo").slideDown(); | ||||
|  | @ -559,6 +568,9 @@ function getHeadItem(){ | |||
| 
 | ||||
| 	// Parse give code
 | ||||
| 	else if(equipCustomHeadMode == "givecode"){ | ||||
| 
 | ||||
| 		// Give Code in this format: /give @p skull 1 3 {display:{Name:"Some Name"},SkullOwner:{Id:"a74719ce...
 | ||||
| 		if(equipHelmet.indexOf("SkullOwner:{") >= 0){ | ||||
| 			var skullOwnerRaw = equipHelmet.substring(equipHelmet.indexOf("SkullOwner")); | ||||
| 			var parsed = ""; | ||||
| 			var bracketCounter = 0; | ||||
|  | @ -567,18 +579,24 @@ function getHeadItem(){ | |||
| 			for(var i = 0; i < skullOwnerRaw.length; i++){ | ||||
| 				var c = skullOwnerRaw[i]; | ||||
| 
 | ||||
| 			if(c == "{"){ | ||||
| 				bracketsStarted = true;	 | ||||
| 				bracketCounter++; | ||||
| 			} | ||||
| 				if(c == "{") bracketCounter++; | ||||
| 				if(c == "}") bracketCounter--; | ||||
| 
 | ||||
| 				parsed += c; | ||||
| 				if(bracketCounter == 0 && bracketsStarted) break; | ||||
| 				if(c == ":") bracketsStarted = true; | ||||
| 			} | ||||
| 
 | ||||
| 			return '{id:"skull",Count:1b,Damage:3b,tag:{'+parsed+'}}'; | ||||
| 		} | ||||
| 		// Give Code in this format: /give @p skull 1 3 {SkullOwner:"playername"} (quotes optional)
 | ||||
| 		else{ | ||||
| 			var skullOwnerRaw = equipHelmet.substring(equipHelmet.indexOf("SkullOwner:")); | ||||
| 			skullOwnerRaw = skullOwnerRaw.substring(0, skullOwnerRaw.indexOf("}")); | ||||
| 			return '{id:"skull",Count:1b,Damage:3b,tag:{'+skullOwnerRaw+'}}'; | ||||
| 		} | ||||
| 
 | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lars Martens
						Lars Martens