package lib; /** Represents an item in the game. **/ enum abstract Item(String) to String { public inline function new(name:String) { // Check if the name is valid. in the format `mod:item_name` e.g. `minecraft:apple` // TODO: implement // make sure to not use regex this = name; } @:from(String) public static function fromString(s:String) { return new Item(s); } function getBase():String { return this.split(":")[0]; } var Coal = "minecraft:coal"; var Charcoal = "minecraft:charcoal"; }