mirror of
https://github.com/architectury/architectury-api.git
synced 2026-03-28 11:57:01 -05:00
Rename to ClientScreenInputEvent and fix mixins
This commit is contained in:
@@ -28,7 +28,7 @@ import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public interface ClientGuiInputEvent {
|
||||
public interface ClientScreenInputEvent {
|
||||
Event<MouseScrolled> MOUSE_SCROLLED_PRE = EventFactory.createInteractionResult(MouseScrolled.class);
|
||||
Event<MouseScrolled> MOUSE_SCROLLED_POST = EventFactory.createInteractionResult(MouseScrolled.class);
|
||||
Event<MouseClicked> MOUSE_CLICKED_PRE = EventFactory.createInteractionResult(MouseClicked.class);
|
||||
@@ -1,7 +1,9 @@
|
||||
package me.shedaniel.architectury.test;
|
||||
|
||||
import com.mojang.blaze3d.platform.InputConstants;
|
||||
import me.shedaniel.architectury.event.events.*;
|
||||
import me.shedaniel.architectury.event.events.client.ClientChatEvent;
|
||||
import me.shedaniel.architectury.event.events.client.ClientScreenInputEvent;
|
||||
import me.shedaniel.architectury.event.events.client.ClientLifecycleEvent;
|
||||
import me.shedaniel.architectury.event.events.client.ClientPlayerEvent;
|
||||
import me.shedaniel.architectury.hooks.ExplosionHooks;
|
||||
@@ -203,6 +205,34 @@ public class TestMod {
|
||||
TextureStitchEvent.POST.register(atlas -> {
|
||||
SINK.accept("Client texture stitched: " + atlas.location());
|
||||
});
|
||||
ClientScreenInputEvent.MOUSE_SCROLLED_PRE.register((client, screen, mouseX, mouseY, amount) -> {
|
||||
SINK.accept("Screen Mouse amount: %.2f distance", amount);
|
||||
return InteractionResult.PASS;
|
||||
});
|
||||
ClientScreenInputEvent.MOUSE_CLICKED_PRE.register((client, screen, mouseX, mouseY, button) -> {
|
||||
SINK.accept("Screen Mouse clicked: " + button);
|
||||
return InteractionResult.PASS;
|
||||
});
|
||||
ClientScreenInputEvent.MOUSE_RELEASED_PRE.register((client, screen, mouseX, mouseY, button) -> {
|
||||
SINK.accept("Screen Mouse released: " + button);
|
||||
return InteractionResult.PASS;
|
||||
});
|
||||
ClientScreenInputEvent.MOUSE_DRAGGED_PRE.register((client, screen, mouseX1, mouseY1, button, mouseX2, mouseY2) -> {
|
||||
SINK.accept("Screen Mouse dragged: %d (%d,%d) by (%d,%d)", button, (int) mouseX1, (int) mouseY1, (int) mouseX2, (int) mouseY2);
|
||||
return InteractionResult.PASS;
|
||||
});
|
||||
ClientScreenInputEvent.CHAR_TYPED_PRE.register((client, screen, character, keyCode) -> {
|
||||
SINK.accept("Screen Char typed: " + character);
|
||||
return InteractionResult.PASS;
|
||||
});
|
||||
ClientScreenInputEvent.KEY_PRESSED_PRE.register((client, screen, keyCode, scanCode, modifiers) -> {
|
||||
SINK.accept("Screen Key pressed: " + InputConstants.getKey(keyCode, scanCode).getDisplayName().getString());
|
||||
return InteractionResult.PASS;
|
||||
});
|
||||
ClientScreenInputEvent.KEY_RELEASED_PRE.register((client, screen, keyCode, scanCode, modifiers) -> {
|
||||
SINK.accept("Screen Key released: " + InputConstants.getKey(keyCode, scanCode).getDisplayName().getString());
|
||||
return InteractionResult.PASS;
|
||||
});
|
||||
}
|
||||
|
||||
private static String toSimpleName(Object o) {
|
||||
|
||||
@@ -55,10 +55,12 @@ public class ClientOverlayMessageSink extends ConsoleMessageSink {
|
||||
if (timeExisted >= 5000) {
|
||||
messageIterator.remove();
|
||||
} else {
|
||||
int textWidth = minecraft.font.width(message.text);
|
||||
int alpha = (int) Mth.clamp((5000 - timeExisted) / 5000f * 400f + 8, 0, 255);
|
||||
GuiComponent.fill(matrices, 0, y - 1, 2 + textWidth + 1, y + lineHeight - 1, 0x505050 + ((alpha * 144 / 255) << 24));
|
||||
minecraft.font.draw(matrices, message.text, 1, y, 0xE0E0E0 + (alpha << 24));
|
||||
if (y - 1 < minecraft.getWindow().getGuiScaledHeight()) {
|
||||
int textWidth = minecraft.font.width(message.text);
|
||||
int alpha = (int) Mth.clamp((5000 - timeExisted) / 5000f * 400f + 8, 0, 255);
|
||||
GuiComponent.fill(matrices, 0, y - 1, 2 + textWidth + 1, y + lineHeight - 1, 0x505050 + ((alpha * 144 / 255) << 24));
|
||||
minecraft.font.draw(matrices, message.text, 1, y, 0xE0E0E0 + (alpha << 24));
|
||||
}
|
||||
y += lineHeight;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
package me.shedaniel.architectury.mixin.fabric.client;
|
||||
|
||||
import me.shedaniel.architectury.event.events.client.ClientGuiInputEvent;
|
||||
import me.shedaniel.architectury.event.events.client.ClientScreenInputEvent;
|
||||
import net.minecraft.client.KeyboardHandler;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.components.events.ContainerEventHandler;
|
||||
@@ -46,7 +46,7 @@ public class MixinKeyboardHandler {
|
||||
ordinal = 0), cancellable = true)
|
||||
public void onCharFirst(long long_1, int int_1, int int_2, CallbackInfo info) {
|
||||
if (!info.isCancelled()) {
|
||||
InteractionResult result = ClientGuiInputEvent.CHAR_TYPED_PRE.invoker().charTyped(minecraft, minecraft.screen, (char) int_1, int_2);
|
||||
InteractionResult result = ClientScreenInputEvent.CHAR_TYPED_PRE.invoker().charTyped(minecraft, minecraft.screen, (char) int_1, int_2);
|
||||
if (result != InteractionResult.PASS)
|
||||
info.cancel();
|
||||
}
|
||||
@@ -57,7 +57,7 @@ public class MixinKeyboardHandler {
|
||||
ordinal = 1), cancellable = true)
|
||||
public void onCharSecond(long long_1, int int_1, int int_2, CallbackInfo info) {
|
||||
if (!info.isCancelled()) {
|
||||
InteractionResult result = ClientGuiInputEvent.CHAR_TYPED_PRE.invoker().charTyped(minecraft, minecraft.screen, (char) int_1, int_2);
|
||||
InteractionResult result = ClientScreenInputEvent.CHAR_TYPED_PRE.invoker().charTyped(minecraft, minecraft.screen, (char) int_1, int_2);
|
||||
if (result != InteractionResult.PASS)
|
||||
info.cancel();
|
||||
}
|
||||
@@ -68,7 +68,7 @@ public class MixinKeyboardHandler {
|
||||
ordinal = 0, shift = At.Shift.AFTER), cancellable = true)
|
||||
public void onCharFirstPost(long long_1, int int_1, int int_2, CallbackInfo info) {
|
||||
if (!info.isCancelled()) {
|
||||
InteractionResult result = ClientGuiInputEvent.CHAR_TYPED_PRE.invoker().charTyped(minecraft, minecraft.screen, (char) int_1, int_2);
|
||||
InteractionResult result = ClientScreenInputEvent.CHAR_TYPED_POST.invoker().charTyped(minecraft, minecraft.screen, (char) int_1, int_2);
|
||||
if (result != InteractionResult.PASS)
|
||||
info.cancel();
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public class MixinKeyboardHandler {
|
||||
ordinal = 1, shift = At.Shift.AFTER), cancellable = true)
|
||||
public void onCharSecondPost(long long_1, int int_1, int int_2, CallbackInfo info) {
|
||||
if (!info.isCancelled()) {
|
||||
InteractionResult result = ClientGuiInputEvent.CHAR_TYPED_PRE.invoker().charTyped(minecraft, minecraft.screen, (char) int_1, int_2);
|
||||
InteractionResult result = ClientScreenInputEvent.CHAR_TYPED_POST.invoker().charTyped(minecraft, minecraft.screen, (char) int_1, int_2);
|
||||
if (result != InteractionResult.PASS)
|
||||
info.cancel();
|
||||
}
|
||||
@@ -92,12 +92,12 @@ public class MixinKeyboardHandler {
|
||||
if (!info.isCancelled()) {
|
||||
if (int_3 != 1 && (int_3 != 2 || !this.sendRepeatsToGui)) {
|
||||
if (int_3 == 0) {
|
||||
InteractionResult result = ClientGuiInputEvent.KEY_RELEASED_PRE.invoker().keyReleased(minecraft, minecraft.screen, int_1, int_2, int_4);
|
||||
InteractionResult result = ClientScreenInputEvent.KEY_RELEASED_PRE.invoker().keyReleased(minecraft, minecraft.screen, int_1, int_2, int_4);
|
||||
if (result != InteractionResult.PASS)
|
||||
info.cancel();
|
||||
}
|
||||
} else {
|
||||
InteractionResult result = ClientGuiInputEvent.KEY_PRESSED_PRE.invoker().keyPressed(minecraft, minecraft.screen, int_1, int_2, int_4);
|
||||
InteractionResult result = ClientScreenInputEvent.KEY_PRESSED_PRE.invoker().keyPressed(minecraft, minecraft.screen, int_1, int_2, int_4);
|
||||
if (result != InteractionResult.PASS)
|
||||
info.cancel();
|
||||
}
|
||||
@@ -112,9 +112,9 @@ public class MixinKeyboardHandler {
|
||||
if (!info.isCancelled() && !bls[0]) {
|
||||
InteractionResult result;
|
||||
if (int_3 != 1 && (int_3 != 2 || !this.sendRepeatsToGui)) {
|
||||
result = ClientGuiInputEvent.KEY_RELEASED_POST.invoker().keyReleased(minecraft, minecraft.screen, int_1, int_2, int_4);
|
||||
result = ClientScreenInputEvent.KEY_RELEASED_POST.invoker().keyReleased(minecraft, minecraft.screen, int_1, int_2, int_4);
|
||||
} else {
|
||||
result = ClientGuiInputEvent.KEY_PRESSED_POST.invoker().keyPressed(minecraft, minecraft.screen, int_1, int_2, int_4);
|
||||
result = ClientScreenInputEvent.KEY_PRESSED_POST.invoker().keyPressed(minecraft, minecraft.screen, int_1, int_2, int_4);
|
||||
}
|
||||
if (result != InteractionResult.PASS)
|
||||
info.cancel();
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
package me.shedaniel.architectury.mixin.fabric.client;
|
||||
|
||||
import me.shedaniel.architectury.event.events.client.ClientGuiInputEvent;
|
||||
import me.shedaniel.architectury.event.events.client.ClientScreenInputEvent;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.MouseHandler;
|
||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||
@@ -53,7 +53,7 @@ public class MixinMouseHandler {
|
||||
ordinal = 0), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD)
|
||||
public void onMouseScrolled(long long_1, double double_1, double double_2, CallbackInfo info, double amount, double x, double y) {
|
||||
if (!info.isCancelled()) {
|
||||
InteractionResult result = ClientGuiInputEvent.MOUSE_SCROLLED_PRE.invoker().mouseScrolled(minecraft, minecraft.screen, x, y, amount);
|
||||
InteractionResult result = ClientScreenInputEvent.MOUSE_SCROLLED_PRE.invoker().mouseScrolled(minecraft, minecraft.screen, x, y, amount);
|
||||
if (result != InteractionResult.PASS)
|
||||
info.cancel();
|
||||
}
|
||||
@@ -64,7 +64,7 @@ public class MixinMouseHandler {
|
||||
ordinal = 0, shift = At.Shift.AFTER), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD)
|
||||
public void onMouseScrolledPost(long long_1, double double_1, double double_2, CallbackInfo info, double amount, double x, double y) {
|
||||
if (!info.isCancelled()) {
|
||||
InteractionResult result = ClientGuiInputEvent.MOUSE_SCROLLED_POST.invoker().mouseScrolled(minecraft, minecraft.screen, x, y, amount);
|
||||
InteractionResult result = ClientScreenInputEvent.MOUSE_SCROLLED_POST.invoker().mouseScrolled(minecraft, minecraft.screen, x, y, amount);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class MixinMouseHandler {
|
||||
ordinal = 0), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD)
|
||||
public void onMouseClicked(long long_1, int button, int int_2, int int_3, CallbackInfo info, boolean bl, int i, boolean[] bls, double d, double e) {
|
||||
if (!info.isCancelled()) {
|
||||
InteractionResult result = ClientGuiInputEvent.MOUSE_CLICKED_PRE.invoker().mouseClicked(minecraft, minecraft.screen, d, e, button);
|
||||
InteractionResult result = ClientScreenInputEvent.MOUSE_CLICKED_PRE.invoker().mouseClicked(minecraft, minecraft.screen, d, e, button);
|
||||
if (result != InteractionResult.PASS)
|
||||
info.cancel();
|
||||
}
|
||||
@@ -84,49 +84,51 @@ public class MixinMouseHandler {
|
||||
ordinal = 0, shift = At.Shift.AFTER), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD)
|
||||
public void onMouseClickedPost(long long_1, int button, int int_2, int int_3, CallbackInfo info, boolean bl, int i, boolean[] bls, double d, double e) {
|
||||
if (!info.isCancelled()) {
|
||||
InteractionResult result = ClientGuiInputEvent.MOUSE_CLICKED_POST.invoker().mouseClicked(minecraft, minecraft.screen, d, e, button);
|
||||
if (result != InteractionResult.PASS)
|
||||
info.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "onPress", at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/gui/screens/Screen;wrapScreenError(Ljava/lang/Runnable;Ljava/lang/String;Ljava/lang/String;)V",
|
||||
ordinal = 1), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD)
|
||||
public void onMouseReleased(long long_1, int button, int int_2, int int_3, CallbackInfo info, boolean bl, int i, boolean[] bls, double d, double e) {
|
||||
if (!info.isCancelled()) {
|
||||
InteractionResult result = ClientGuiInputEvent.MOUSE_RELEASED_PRE.invoker().mouseReleased(minecraft, minecraft.screen, d, e, button);
|
||||
if (result != InteractionResult.PASS)
|
||||
info.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "onPress", at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/gui/screens/Screen;wrapScreenError(Ljava/lang/Runnable;Ljava/lang/String;Ljava/lang/String;)V",
|
||||
ordinal = 1, shift = At.Shift.AFTER), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD)
|
||||
public void onMouseReleasedPost(long long_1, int button, int int_2, int int_3, CallbackInfo info, boolean bl, int i, boolean[] bls, double d, double e) {
|
||||
if (!info.isCancelled()) {
|
||||
InteractionResult result = ClientGuiInputEvent.MOUSE_RELEASED_POST.invoker().mouseReleased(minecraft, minecraft.screen, d, e, button);
|
||||
InteractionResult result = ClientScreenInputEvent.MOUSE_CLICKED_POST.invoker().mouseClicked(minecraft, minecraft.screen, d, e, button);
|
||||
if (result != InteractionResult.PASS)
|
||||
info.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnresolvedMixinReference")
|
||||
@Inject(method = {"method_1602", "lambda$onMove$11"}, at = @At("HEAD"), cancellable = true)
|
||||
@Inject(method = {"lambda$onPress$1", "method_1605"}, at = @At("HEAD"), cancellable = true, remap = false)
|
||||
public void onGuiMouseReleased(boolean[] bls, double d, double e, int button, CallbackInfo info) {
|
||||
if (!info.isCancelled()) {
|
||||
InteractionResult result = ClientScreenInputEvent.MOUSE_RELEASED_PRE.invoker().mouseReleased(minecraft, minecraft.screen, d, e, button);
|
||||
if (result != InteractionResult.PASS) {
|
||||
bls[0] = true;
|
||||
info.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnresolvedMixinReference")
|
||||
@Inject(method = {"lambda$onPress$1", "method_1605"}, at = @At("RETURN"), cancellable = true, remap = false)
|
||||
public void onGuiMouseReleasedPost(boolean[] bls, double d, double e, int button, CallbackInfo info) {
|
||||
if (!info.isCancelled() && !bls[0]) {
|
||||
InteractionResult result = ClientScreenInputEvent.MOUSE_RELEASED_POST.invoker().mouseReleased(minecraft, minecraft.screen, d, e, button);
|
||||
if (result != InteractionResult.PASS) {
|
||||
bls[0] = true;
|
||||
info.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnresolvedMixinReference")
|
||||
@Inject(method = {"method_1602", "lambda$onMove$11"}, at = @At("HEAD"), cancellable = true, remap = false)
|
||||
public void onMouseDragged(GuiEventListener element, double d, double e, double f, double g, CallbackInfo info) {
|
||||
if (!info.isCancelled()) {
|
||||
InteractionResult result = ClientGuiInputEvent.MOUSE_DRAGGED_PRE.invoker().mouseDragged(minecraft, (Screen) element, d, e, activeButton, f, g);
|
||||
InteractionResult result = ClientScreenInputEvent.MOUSE_DRAGGED_PRE.invoker().mouseDragged(minecraft, (Screen) element, d, e, activeButton, f, g);
|
||||
if (result != InteractionResult.PASS)
|
||||
info.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnresolvedMixinReference")
|
||||
@Inject(method = {"method_1602", "lambda$onMove$11"}, at = @At("RETURN"))
|
||||
@Inject(method = {"method_1602", "lambda$onMove$11"}, at = @At("RETURN"), remap = false)
|
||||
public void onMouseDraggedPost(GuiEventListener element, double d, double e, double f, double g, CallbackInfo info) {
|
||||
if (!info.isCancelled()) {
|
||||
ClientGuiInputEvent.MOUSE_DRAGGED_POST.invoker().mouseDragged(minecraft, (Screen) element, d, e, activeButton, f, g);
|
||||
ClientScreenInputEvent.MOUSE_DRAGGED_POST.invoker().mouseDragged(minecraft, (Screen) element, d, e, activeButton, f, g);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,86 +182,86 @@ public class EventHandlerImplClient {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void event(GuiScreenEvent.MouseScrollEvent.Pre event) {
|
||||
if (ClientGuiInputEvent.MOUSE_SCROLLED_PRE.invoker().mouseScrolled(Minecraft.getInstance(), event.getGui(), event.getMouseX(), event.getMouseY(), event.getScrollDelta()) == InteractionResult.FAIL) {
|
||||
if (ClientScreenInputEvent.MOUSE_SCROLLED_PRE.invoker().mouseScrolled(Minecraft.getInstance(), event.getGui(), event.getMouseX(), event.getMouseY(), event.getScrollDelta()) == InteractionResult.FAIL) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void event(GuiScreenEvent.MouseScrollEvent.Post event) {
|
||||
ClientGuiInputEvent.MOUSE_SCROLLED_POST.invoker().mouseScrolled(Minecraft.getInstance(), event.getGui(), event.getMouseX(), event.getMouseY(), event.getScrollDelta());
|
||||
ClientScreenInputEvent.MOUSE_SCROLLED_POST.invoker().mouseScrolled(Minecraft.getInstance(), event.getGui(), event.getMouseX(), event.getMouseY(), event.getScrollDelta());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void event(GuiScreenEvent.MouseClickedEvent.Pre event) {
|
||||
if (ClientGuiInputEvent.MOUSE_CLICKED_PRE.invoker().mouseClicked(Minecraft.getInstance(), event.getGui(), event.getMouseX(), event.getMouseY(), event.getButton()) == InteractionResult.FAIL) {
|
||||
if (ClientScreenInputEvent.MOUSE_CLICKED_PRE.invoker().mouseClicked(Minecraft.getInstance(), event.getGui(), event.getMouseX(), event.getMouseY(), event.getButton()) == InteractionResult.FAIL) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void event(GuiScreenEvent.MouseClickedEvent.Post event) {
|
||||
ClientGuiInputEvent.MOUSE_CLICKED_POST.invoker().mouseClicked(Minecraft.getInstance(), event.getGui(), event.getMouseX(), event.getMouseY(), event.getButton());
|
||||
ClientScreenInputEvent.MOUSE_CLICKED_POST.invoker().mouseClicked(Minecraft.getInstance(), event.getGui(), event.getMouseX(), event.getMouseY(), event.getButton());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void event(GuiScreenEvent.MouseDragEvent.Pre event) {
|
||||
if (ClientGuiInputEvent.MOUSE_DRAGGED_PRE.invoker().mouseDragged(Minecraft.getInstance(), event.getGui(), event.getMouseX(), event.getMouseY(), event.getMouseButton(), event.getDragX(), event.getDragY()) == InteractionResult.FAIL) {
|
||||
if (ClientScreenInputEvent.MOUSE_DRAGGED_PRE.invoker().mouseDragged(Minecraft.getInstance(), event.getGui(), event.getMouseX(), event.getMouseY(), event.getMouseButton(), event.getDragX(), event.getDragY()) == InteractionResult.FAIL) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void event(GuiScreenEvent.MouseDragEvent.Post event) {
|
||||
ClientGuiInputEvent.MOUSE_DRAGGED_POST.invoker().mouseDragged(Minecraft.getInstance(), event.getGui(), event.getMouseX(), event.getMouseY(), event.getMouseButton(), event.getDragX(), event.getDragY());
|
||||
ClientScreenInputEvent.MOUSE_DRAGGED_POST.invoker().mouseDragged(Minecraft.getInstance(), event.getGui(), event.getMouseX(), event.getMouseY(), event.getMouseButton(), event.getDragX(), event.getDragY());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void event(GuiScreenEvent.MouseReleasedEvent.Pre event) {
|
||||
if (ClientGuiInputEvent.MOUSE_RELEASED_PRE.invoker().mouseReleased(Minecraft.getInstance(), event.getGui(), event.getMouseX(), event.getMouseY(), event.getButton()) == InteractionResult.FAIL) {
|
||||
if (ClientScreenInputEvent.MOUSE_RELEASED_PRE.invoker().mouseReleased(Minecraft.getInstance(), event.getGui(), event.getMouseX(), event.getMouseY(), event.getButton()) == InteractionResult.FAIL) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void event(GuiScreenEvent.MouseReleasedEvent.Post event) {
|
||||
ClientGuiInputEvent.MOUSE_RELEASED_PRE.invoker().mouseReleased(Minecraft.getInstance(), event.getGui(), event.getMouseX(), event.getMouseY(), event.getButton());
|
||||
ClientScreenInputEvent.MOUSE_RELEASED_PRE.invoker().mouseReleased(Minecraft.getInstance(), event.getGui(), event.getMouseX(), event.getMouseY(), event.getButton());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void event(GuiScreenEvent.KeyboardCharTypedEvent.Pre event) {
|
||||
if (ClientGuiInputEvent.CHAR_TYPED_PRE.invoker().charTyped(Minecraft.getInstance(), event.getGui(), event.getCodePoint(), event.getModifiers()) == InteractionResult.FAIL) {
|
||||
if (ClientScreenInputEvent.CHAR_TYPED_PRE.invoker().charTyped(Minecraft.getInstance(), event.getGui(), event.getCodePoint(), event.getModifiers()) == InteractionResult.FAIL) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void event(GuiScreenEvent.KeyboardCharTypedEvent.Post event) {
|
||||
ClientGuiInputEvent.CHAR_TYPED_POST.invoker().charTyped(Minecraft.getInstance(), event.getGui(), event.getCodePoint(), event.getModifiers());
|
||||
ClientScreenInputEvent.CHAR_TYPED_POST.invoker().charTyped(Minecraft.getInstance(), event.getGui(), event.getCodePoint(), event.getModifiers());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void event(GuiScreenEvent.KeyboardKeyPressedEvent.Pre event) {
|
||||
if (ClientGuiInputEvent.KEY_PRESSED_PRE.invoker().keyPressed(Minecraft.getInstance(), event.getGui(), event.getKeyCode(), event.getScanCode(), event.getModifiers()) == InteractionResult.FAIL) {
|
||||
if (ClientScreenInputEvent.KEY_PRESSED_PRE.invoker().keyPressed(Minecraft.getInstance(), event.getGui(), event.getKeyCode(), event.getScanCode(), event.getModifiers()) == InteractionResult.FAIL) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void event(GuiScreenEvent.KeyboardKeyPressedEvent.Post event) {
|
||||
ClientGuiInputEvent.KEY_PRESSED_POST.invoker().keyPressed(Minecraft.getInstance(), event.getGui(), event.getKeyCode(), event.getScanCode(), event.getModifiers());
|
||||
ClientScreenInputEvent.KEY_PRESSED_POST.invoker().keyPressed(Minecraft.getInstance(), event.getGui(), event.getKeyCode(), event.getScanCode(), event.getModifiers());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void event(GuiScreenEvent.KeyboardKeyReleasedEvent.Pre event) {
|
||||
if (ClientGuiInputEvent.KEY_RELEASED_PRE.invoker().keyReleased(Minecraft.getInstance(), event.getGui(), event.getKeyCode(), event.getScanCode(), event.getModifiers()) == InteractionResult.FAIL) {
|
||||
if (ClientScreenInputEvent.KEY_RELEASED_PRE.invoker().keyReleased(Minecraft.getInstance(), event.getGui(), event.getKeyCode(), event.getScanCode(), event.getModifiers()) == InteractionResult.FAIL) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void event(GuiScreenEvent.KeyboardKeyReleasedEvent.Post event) {
|
||||
ClientGuiInputEvent.KEY_RELEASED_POST.invoker().keyReleased(Minecraft.getInstance(), event.getGui(), event.getKeyCode(), event.getScanCode(), event.getModifiers());
|
||||
ClientScreenInputEvent.KEY_RELEASED_POST.invoker().keyReleased(Minecraft.getInstance(), event.getGui(), event.getKeyCode(), event.getScanCode(), event.getModifiers());
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
|
||||
Reference in New Issue
Block a user