SpongeAPI
SpongeAPI copied to clipboard
Shortcut method for cataloged classes
Maybe introduce something like
class.builder()
for registry requests?
e.g.
ItemType.of(String)
or
ItemTypes.of(String)
static Optional<ItemType> of(String id) {
return Sponge.getRegistry().getType(ItemType.clsas, id);
}
I really like the idea. This would make the class more enum like. Maybe also add a getAll()
method .
My vote is for ItemType as opposed to ItemTypes because ItemTypes is meant as a static registry of the vanilla types while ItemType knows about the dynamic registry by ID. Also, I think that .of
implies construction and the method should instead be named getById
or similar.