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

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

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

import com.yungnickyoung.minecraft.yungsapi.api.autoregister.AutoRegisterSoundEvent;
import com.yungnickyoung.minecraft.yungsapi.autoregister.AutoRegistrationManager;
import net.minecraft.class_2378;
import net.minecraft.class_3414;
import net.minecraft.class_7923;
import com.yungnickyoung.minecraft.yungsapi.autoregister.AutoRegisterField;

/**
 * Registration of Sound Events.
 */
public class SoundEventModuleFabric {
    public static void processEntries() {
        AutoRegistrationManager.SOUND_EVENTS.stream()
                .filter(data -> !data.processed())
                .forEach(SoundEventModuleFabric::register);
    }

    private static void register(AutoRegisterField data) {
        AutoRegisterSoundEvent autoRegisterSoundEvent = (AutoRegisterSoundEvent) data.object();
        class_3414 soundEvent = class_3414.method_47908(data.name());
        autoRegisterSoundEvent.setSupplier(() -> soundEvent);

        // Register
        class_2378.method_10230(class_7923.field_41172, data.name(), soundEvent);
        data.markProcessed();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy