added PaN
This commit is contained in:
		
							parent
							
								
									e0f8d274e7
								
							
						
					
					
						commit
						df7991763d
					
				| @ -3,7 +3,8 @@ package lib; | |||||||
| /** | /** | ||||||
| 	Represents an item in the game. | 	Represents an item in the game. | ||||||
| **/ | **/ | ||||||
| enum abstract Item(String) to String { | @:forward | ||||||
|  | enum abstract Item(PaN) to String { | ||||||
| 	public inline function new(name:String) { | 	public inline function new(name:String) { | ||||||
| 		// Check if the name is valid. in the format `mod:item_name` e.g. `minecraft:apple` | 		// Check if the name is valid. in the format `mod:item_name` e.g. `minecraft:apple` | ||||||
| 		// TODO: implement | 		// TODO: implement | ||||||
| @ -16,10 +17,6 @@ enum abstract Item(String) to String { | |||||||
| 		return new Item(s); | 		return new Item(s); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	function getBase():String { |  | ||||||
| 		return this.split(":")[0]; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	var Coal = "minecraft:coal"; | 	var Coal = "minecraft:coal"; | ||||||
| 	var Charcoal = "minecraft:charcoal"; | 	var Charcoal = "minecraft:charcoal"; | ||||||
| } | } | ||||||
|  | |||||||
							
								
								
									
										18
									
								
								src/lib/PaN.hx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								src/lib/PaN.hx
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,18 @@ | |||||||
|  | package lib; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  | 	Provider and name. e.g. "minecraft:dirt", "mod:item", "minecraft:overworld" | ||||||
|  | **/ | ||||||
|  | abstract PaN(String) to String from String { | ||||||
|  | 	public inline function new(pan:String) { | ||||||
|  | 		this = pan; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	public function getProvider():String { | ||||||
|  | 		return this.split(":")[0]; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	public function getName():String { | ||||||
|  | 		return this.split(":")[1]; | ||||||
|  | 	} | ||||||
|  | } | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user