Skip to content

Commit

Permalink
Make Pre cancellable instead
Browse files Browse the repository at this point in the history
  • Loading branch information
Vazkii committed Apr 9, 2024
1 parent 6afd13b commit bbba1d2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 { }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 {
Expand Down

0 comments on commit bbba1d2

Please sign in to comment.