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

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

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

import com.yungnickyoung.minecraft.yungsapi.api.autoregister.AutoRegisterPotion;
import com.yungnickyoung.minecraft.yungsapi.autoregister.AutoRegisterField;
import com.yungnickyoung.minecraft.yungsapi.autoregister.AutoRegistrationManager;
import net.minecraft.class_1293;
import net.minecraft.class_1842;
import net.minecraft.class_2378;
import net.minecraft.class_7923;

/**
 * Registration of Potions.
 */
public class PotionModuleFabric {
    public static void processEntries() {
        AutoRegistrationManager.POTIONS.stream()
                .filter(data -> !data.processed())
                .forEach(PotionModuleFabric::register);
    }

    private static void register(AutoRegisterField data) {
        AutoRegisterPotion autoRegisterPotion = (AutoRegisterPotion) data.object();
        class_1293 mobEffectInstance = autoRegisterPotion.getMobEffectInstance();
        String name = data.name().method_12836() + "." + data.name().method_12832();
        class_1842 potion = new class_1842(name, mobEffectInstance);
        autoRegisterPotion.setSupplier(() -> potion);

        // Register mob effect
        class_2378.method_10230(class_7923.field_41179, data.name(), potion);
        data.markProcessed();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy