/*
* macu_lib
* Copyright (C) 2026 macuguita
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, see
*
* Registries can hold entries that are lazily initialized via {@link Supplier} and can
* be iterated over or streamed. This interface is designed to be used by mod frameworks
* and libraries to organize game objects, items, or other data types.
*
* @param
* This is typically used to identify the mod or library that owns the registry.
*
* @return The registry namespace, or {@code null} if not set.
*/
default @Nullable String namespace() {
return null;
}
/**
* Registers a new entry in this registry.
*
* The entry is associated with the given {@code id} and lazily supplied via
* the provided {@link Supplier}.
*
* @param id The name for this entry (e.g., {@code "item_name"}).
* @param supplier A {@link Supplier} that provides the object when needed.
* @param The type of the entry, which must extend {@code T}.
* @return A {@link GuitaRegistryEntry} representing the newly registered entry.
*/
GuitaRegistryEntry register(String id, Supplier supplier);
/**
* Returns a {@link Collection} of all entries in this registry.
*
* @return A collection of {@link GuitaRegistryEntry} objects.
*/
Collection
* This is a convenient method for functional operations on registry entries.
*
* @return A {@link Stream} of {@link GuitaRegistryEntry} objects.
*/
default Stream
* This is equivalent to mapping {@link GuitaRegistryEntry#get()} over the registry entries.
*
* @return A {@link Stream} of objects of type {@code T}.
*/
default Stream
* This method should be called after all entries are registered, and will register
* these items into Minecraft.
*/
void init();
}