From bbba1d200f6cbdc4750cab7b32c24443d6955190 Mon Sep 17 00:00:00 2001 From: Vasco Lavos Date: Tue, 9 Apr 2024 12:21:07 +0100 Subject: [PATCH] Make Pre cancellable instead --- .../violetmoon/zeta/client/event/play/ZScreen.java | 2 +- .../client/event/play/ForgeZScreen.java | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/violetmoon/zeta/client/event/play/ZScreen.java b/src/main/java/org/violetmoon/zeta/client/event/play/ZScreen.java index 05d25c2..a4ab9d1 100644 --- a/src/main/java/org/violetmoon/zeta/client/event/play/ZScreen.java +++ b/src/main/java/org/violetmoon/zeta/client/event/play/ZScreen.java @@ -35,7 +35,7 @@ interface MouseButtonPressed extends ZScreen { double getMouseX(); double getMouseY(); - interface Pre extends MouseButtonPressed { } + interface Pre extends MouseButtonPressed, Cancellable { } interface Post extends MouseButtonPressed { } } diff --git a/src/main/java/org/violetmoon/zetaimplforge/client/event/play/ForgeZScreen.java b/src/main/java/org/violetmoon/zetaimplforge/client/event/play/ForgeZScreen.java index 8147717..ae7b6f6 100644 --- a/src/main/java/org/violetmoon/zetaimplforge/client/event/play/ForgeZScreen.java +++ b/src/main/java/org/violetmoon/zetaimplforge/client/event/play/ForgeZScreen.java @@ -94,7 +94,7 @@ public Post(ScreenEvent.Render e) { } public static class MouseButtonPressed extends ForgeZScreen implements ZScreen.MouseButtonPressed { - private final ScreenEvent.MouseButtonPressed e; + final ScreenEvent.MouseButtonPressed e; public MouseButtonPressed(ScreenEvent.MouseButtonPressed e) { super(e); @@ -120,6 +120,16 @@ public static class Pre extends ForgeZScreen.MouseButtonPressed implements ZScre public Pre(ScreenEvent.MouseButtonPressed.Pre e) { super(e); } + + @Override + public boolean isCanceled() { + return e.isCanceled(); + } + + @Override + public void setCanceled(boolean cancel) { + e.setCanceled(cancel); + } } public static class Post extends ForgeZScreen.MouseButtonPressed implements ZScreen.MouseButtonPressed.Post {