All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yungnickyoung.minecraft.yungsapi.module.ItemModuleFabric Maven / Gradle / Ivy

The newest version!
package com.yungnickyoung.minecraft.yungsapi.module;

import com.yungnickyoung.minecraft.yungsapi.api.autoregister.AutoRegisterItem;
import com.yungnickyoung.minecraft.yungsapi.autoregister.AutoRegistrationManager;
import net.minecraft.class_1747;
import net.minecraft.class_1792;
import net.minecraft.class_2248;
import net.minecraft.class_2378;
import net.minecraft.class_2960;
import net.minecraft.class_7923;
import com.yungnickyoung.minecraft.yungsapi.autoregister.AutoRegisterField;

/**
 * Registration of Items.
 * Provides additional static utility method for registering BlockItems.
 */
public class ItemModuleFabric {

    public static void processEntries() {
        AutoRegistrationManager.ITEMS.stream()
                .filter(data -> !data.processed())
                .forEach(ItemModuleFabric::register);
    }

    private static void register(AutoRegisterField data) {
        AutoRegisterItem autoRegisterItem = (AutoRegisterItem) data.object();
        class_1792 item = autoRegisterItem.get();

        // Register item
        class_2378.method_10230(class_7923.field_41178, data.name(), item);
        data.markProcessed();
    }

    public static void registerBlockItem(class_2960 resourceLocation, class_2248 block, class_1792.class_1793 itemProperties) {
        class_2378.method_10230(class_7923.field_41178, resourceLocation, new class_1747(block, itemProperties));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy