the_big_one/src/main/java/jesse/keeblarcraft/CustomItems/ItemManager.java
Jkibbels 95c68935f3
Some checks failed
build / build (21) (push) Has been cancelled
First one
2024-10-28 17:47:51 -04:00

70 lines
2.7 KiB
Java

/*
*
* ItemManager
*
* This is the general purpose item manager for the mod. All items will be registered through
* this class in order to make custom items a lot cleaner to make!
*
*
*/
package jesse.keeblarcraft.CustomItems;
import java.util.ArrayList;
import java.util.List;
import jesse.keeblarcraft.Keeblarcraft;
import net.minecraft.item.Item;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;
public class ItemManager {
/// The item list. DO NOT ADD TO THE LIST YOURSELF. USE
/// THE RegisterItem(...) FUNCTION OTHERWISE YOUR ITEM WILL
/// NOT BE REGISTERED PROPERLY AND MAY BREAK THE GAME
public static final List<Item> itemList = new ArrayList<Item>();
/////////////////////////////////////////////////////////////////////////////
/// @fn RegisterItem
///
/// @arg[in] name is the item name. IMPORTANT: Name must adhere to rules:
/// 1. The name provided here must match these names:
/// * This items models/item name
/// * This items textures/item name
/// 2 Name must be lowercase & no special characters besides '_'
///
/// @arg[in] item is the item to be added to the item list
///
/// @brief This is the call to register your item to the game! Please
/// do not forget to update the models/item json file, the
/// textures/item png name, and finally the lang/en_us.json file
/////////////////////////////////////////////////////////////////////////////
public static void RegisterItem(String name, Item item) {
Item newItem = Registry.register(Registries.ITEM, new Identifier(Keeblarcraft.MOD_ID, name), item);
itemList.add(newItem);
}
/////////////////////////////////////////////////////////////////////////////
/// @fn RegisterAllItems
///
/// @brief This function is only meant to be called by the main mod
/// execution path and should only be called once. This is a
/// glorified print statement - but also serves to add the
/// example item in the game
/////////////////////////////////////////////////////////////////////////////
public static void RegisterAllItems() {
Keeblarcraft.LOGGER.info("Registering mod items for " + Keeblarcraft.MOD_ID);
// Call the item group register function first
CustomItemGroups.RegisterGroups();
// The example item provides a demo of how you could make an item in your class
// Item exampleItem = new Item(new FabricItemSettings());
// RegisterItem("metaljacket_helmet", exampleItem);
}
}