1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-06-25 22:53:22 +00:00

Fix mouse_up not being fired on Fabric

This commit is contained in:
Jonathan Coates 2022-12-29 22:16:36 +00:00
parent 7f34aff6bb
commit 77f62dac94
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06
2 changed files with 12 additions and 2 deletions

View File

@ -105,6 +105,16 @@ public boolean keyPressed(int key, int scancode, int modifiers) {
return super.keyPressed(key, scancode, modifiers);
}
@Override
public boolean mouseReleased(double x, double y, int button) {
// Reimplement ContainerEventHandler.mouseReleased, as it's not called in vanilla (it is in Forge, but that
// shouldn't matter).
setDragging(false);
var child = getChildAt(x, y);
if (child.isPresent() && child.get().mouseReleased(x, y, button)) return true;
return super.mouseReleased(x, y, button);
}
@Override
public void render(PoseStack stack, int mouseX, int mouseY, float partialTicks) {

View File

@ -184,7 +184,7 @@ public boolean mouseReleased(double mouseX, double mouseY, int button) {
lastMouseX = charX;
lastMouseY = charY;
return false;
return true;
}
@Override
@ -203,7 +203,7 @@ public boolean mouseDragged(double mouseX, double mouseY, int button, double v2,
lastMouseY = charY;
}
return false;
return true;
}
@Override