mirror of
				https://github.com/haselkern/Minecraft-ArmorStand.git
				synced 2025-10-30 21:24:06 +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="url">Image URL</option> | ||||||
|                     <option value="givecode">Give Code</option> |                     <option value="givecode">Give Code</option> | ||||||
|                 </select> |                 </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> | ||||||
|         </div> |         </div> | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										26
									
								
								js/main.js
									
										
									
									
									
								
							
							
						
						
									
										26
									
								
								js/main.js
									
										
									
									
									
								
							|  | @ -362,12 +362,21 @@ function updateUI(){ | ||||||
|     else |     else | ||||||
|         $("#helmetcolor").slideUp(); |         $("#helmetcolor").slideUp(); | ||||||
| 
 | 
 | ||||||
|  | 	// Link to minecraft-heads.com
 | ||||||
|  | 	if(equipCustomHeadMode == "givecode"){ | ||||||
|  | 		$("#minecraft-heads").slideDown(); | ||||||
|  | 	} | ||||||
|  | 	else{ | ||||||
|  | 		$("#minecraft-heads").slideUp(); | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
|  | 	// Show disabled slots
 | ||||||
| 	if(useDisabledSlots) | 	if(useDisabledSlots) | ||||||
| 		$("#disabledslots").slideDown(); | 		$("#disabledslots").slideDown(); | ||||||
| 	else | 	else | ||||||
| 		$("#disabledslots").slideUp(); | 		$("#disabledslots").slideUp(); | ||||||
| 
 | 
 | ||||||
|  | 	// Generate code
 | ||||||
| 	$("#code").text(generateCode()); | 	$("#code").text(generateCode()); | ||||||
| 	if(generateCode().length > 100){ | 	if(generateCode().length > 100){ | ||||||
| 		$("#codeinfo").slideDown(); | 		$("#codeinfo").slideDown(); | ||||||
|  | @ -559,6 +568,9 @@ function getHeadItem(){ | ||||||
| 
 | 
 | ||||||
| 	// Parse give code
 | 	// Parse give code
 | ||||||
| 	else if(equipCustomHeadMode == "givecode"){ | 	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 skullOwnerRaw = equipHelmet.substring(equipHelmet.indexOf("SkullOwner")); | ||||||
| 			var parsed = ""; | 			var parsed = ""; | ||||||
| 			var bracketCounter = 0; | 			var bracketCounter = 0; | ||||||
|  | @ -567,18 +579,24 @@ function getHeadItem(){ | ||||||
| 			for(var i = 0; i < skullOwnerRaw.length; i++){ | 			for(var i = 0; i < skullOwnerRaw.length; i++){ | ||||||
| 				var c = skullOwnerRaw[i]; | 				var c = skullOwnerRaw[i]; | ||||||
| 
 | 
 | ||||||
| 			if(c == "{"){ | 				if(c == "{") bracketCounter++; | ||||||
| 				bracketsStarted = true;	 |  | ||||||
| 				bracketCounter++; |  | ||||||
| 			} |  | ||||||
| 				if(c == "}") bracketCounter--; | 				if(c == "}") bracketCounter--; | ||||||
| 
 | 
 | ||||||
| 				parsed += c; | 				parsed += c; | ||||||
| 				if(bracketCounter == 0 && bracketsStarted) break; | 				if(bracketCounter == 0 && bracketsStarted) break; | ||||||
|  | 				if(c == ":") bracketsStarted = true; | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 			return '{id:"skull",Count:1b,Damage:3b,tag:{'+parsed+'}}'; | 			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