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

top.hendrixshen.magiclib.mixin.minecraft.event.LanguageManagerMixin Maven / Gradle / Ivy

There is a newer version: 0.6.59
Show newest version
package top.hendrixshen.magiclib.mixin.minecraft.event;

import net.minecraft.class_1076;
import net.minecraft.class_1077;
import net.minecraft.class_3300;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import top.hendrixshen.magiclib.impl.event.EventManager;
import top.hendrixshen.magiclib.impl.event.minecraft.LanguageManagerEvent.LanguageReloadEvent;
import top.hendrixshen.magiclib.impl.event.minecraft.LanguageManagerEvent.LanguageSelectEvent;

@Mixin(class_1076.class)
public class LanguageManagerMixin {
    @Inject(
            method = "onResourceManagerReload",
            at = @At(
                    value = "RETURN"
            )
    )
    private void postOnResourceManagerReload(class_3300 resourceManager, CallbackInfo ci) {
        EventManager.dispatch(new LanguageReloadEvent());
    }

    @Inject(
            method = "setSelected",
            at = @At(
                    value = "RETURN"
            )
    )
    private void postSetSelected(
            //#if MC > 11903
            //$$ String languageCode,
            //#else
            class_1077 language,
            //#endif
            CallbackInfo ci
    ) {
        EventManager.dispatch(new LanguageSelectEvent());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy