com.yungnickyoung.minecraft.yungsapi.module.SoundEventModuleFabric Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of YungsApi-1.21-Fabric Show documentation
Show all versions of YungsApi-1.21-Fabric Show documentation
A common API for YUNG's Minecraft mods
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();
}
}