Search in sources :

Example 1 with Event

use of net.minecraftforge.eventbus.api.Event in project MinecraftForge by MinecraftForge.

the class ForgeHooksClient method onScreenMouseClickedPost.

public static boolean onScreenMouseClickedPost(Screen guiScreen, double mouseX, double mouseY, int button, boolean handled) {
    Event event = new ScreenEvent.MouseClickedEvent.Post(guiScreen, mouseX, mouseY, button, handled);
    MinecraftForge.EVENT_BUS.post(event);
    return event.getResult() == Event.Result.DEFAULT ? handled : event.getResult() == Event.Result.ALLOW;
}
Also used : SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent) LerpingBossEvent(net.minecraft.client.gui.components.LerpingBossEvent) Event(net.minecraftforge.eventbus.api.Event) PlaySoundEvent(net.minecraftforge.client.event.sound.PlaySoundEvent)

Example 2 with Event

use of net.minecraftforge.eventbus.api.Event in project MinecraftForge by MinecraftForge.

the class ForgeHooksClient method onScreenMouseReleasedPost.

public static boolean onScreenMouseReleasedPost(Screen guiScreen, double mouseX, double mouseY, int button, boolean handled) {
    Event event = new ScreenEvent.MouseReleasedEvent.Post(guiScreen, mouseX, mouseY, button, handled);
    MinecraftForge.EVENT_BUS.post(event);
    return event.getResult() == Event.Result.DEFAULT ? handled : event.getResult() == Event.Result.ALLOW;
}
Also used : SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent) LerpingBossEvent(net.minecraft.client.gui.components.LerpingBossEvent) Event(net.minecraftforge.eventbus.api.Event) PlaySoundEvent(net.minecraftforge.client.event.sound.PlaySoundEvent)

Example 3 with Event

use of net.minecraftforge.eventbus.api.Event in project MinecraftForge by MinecraftForge.

the class ForgeHooksClient method onScreenMouseScrollPre.

public static boolean onScreenMouseScrollPre(MouseHandler mouseHelper, Screen guiScreen, double scrollDelta) {
    Window mainWindow = guiScreen.getMinecraft().getWindow();
    double mouseX = mouseHelper.xpos() * (double) mainWindow.getGuiScaledWidth() / (double) mainWindow.getScreenWidth();
    double mouseY = mouseHelper.ypos() * (double) mainWindow.getGuiScaledHeight() / (double) mainWindow.getScreenHeight();
    Event event = new ScreenEvent.MouseScrollEvent.Pre(guiScreen, mouseX, mouseY, scrollDelta);
    return MinecraftForge.EVENT_BUS.post(event);
}
Also used : Window(com.mojang.blaze3d.platform.Window) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent) LerpingBossEvent(net.minecraft.client.gui.components.LerpingBossEvent) Event(net.minecraftforge.eventbus.api.Event) PlaySoundEvent(net.minecraftforge.client.event.sound.PlaySoundEvent)

Example 4 with Event

use of net.minecraftforge.eventbus.api.Event in project MinecraftForge by MinecraftForge.

the class ForgeHooksClient method onScreenMouseScrollPost.

public static boolean onScreenMouseScrollPost(MouseHandler mouseHelper, Screen guiScreen, double scrollDelta) {
    Window mainWindow = guiScreen.getMinecraft().getWindow();
    double mouseX = mouseHelper.xpos() * (double) mainWindow.getGuiScaledWidth() / (double) mainWindow.getScreenWidth();
    double mouseY = mouseHelper.ypos() * (double) mainWindow.getGuiScaledHeight() / (double) mainWindow.getScreenHeight();
    Event event = new ScreenEvent.MouseScrollEvent.Post(guiScreen, mouseX, mouseY, scrollDelta);
    return MinecraftForge.EVENT_BUS.post(event);
}
Also used : Window(com.mojang.blaze3d.platform.Window) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent) LerpingBossEvent(net.minecraft.client.gui.components.LerpingBossEvent) Event(net.minecraftforge.eventbus.api.Event) PlaySoundEvent(net.minecraftforge.client.event.sound.PlaySoundEvent)

Example 5 with Event

use of net.minecraftforge.eventbus.api.Event in project MinecraftForge by MinecraftForge.

the class ForgeHooksClient method onRecipesUpdated.

public static void onRecipesUpdated(RecipeManager mgr) {
    Event event = new RecipesUpdatedEvent(mgr);
    MinecraftForge.EVENT_BUS.post(event);
}
Also used : SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent) LerpingBossEvent(net.minecraft.client.gui.components.LerpingBossEvent) Event(net.minecraftforge.eventbus.api.Event) PlaySoundEvent(net.minecraftforge.client.event.sound.PlaySoundEvent)

Aggregations

Event (net.minecraftforge.eventbus.api.Event)7 LerpingBossEvent (net.minecraft.client.gui.components.LerpingBossEvent)6 PlaySoundEvent (net.minecraftforge.client.event.sound.PlaySoundEvent)6 SubscribeEvent (net.minecraftforge.eventbus.api.SubscribeEvent)6 Window (com.mojang.blaze3d.platform.Window)3 ImmutableMap (com.google.common.collect.ImmutableMap)1 NativeImage (com.mojang.blaze3d.platform.NativeImage)1 RenderSystem (com.mojang.blaze3d.systems.RenderSystem)1 com.mojang.blaze3d.vertex (com.mojang.blaze3d.vertex)1 Either (com.mojang.datafixers.util.Either)1 Matrix3f (com.mojang.math.Matrix3f)1 Matrix4f (com.mojang.math.Matrix4f)1 Transformation (com.mojang.math.Transformation)1 Vector3f (com.mojang.math.Vector3f)1 File (java.io.File)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Comparator (java.util.Comparator)1 HashMap (java.util.HashMap)1