mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-08-29 08:42:17 +00:00
Fix terminals not receiving scroll events
Minecraft 1.21.2 added a mouseScroll override to AbstractContainerScreen, which means that child widgets no longer receive scroll events. We reimplement that logic in our computer screen. Fixes #2245.
This commit is contained in:
@@ -125,6 +125,15 @@ public abstract class AbstractComputerScreen<T extends AbstractComputerMenu> ext
|
||||
return super.mouseReleased(x, y, button);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseScrolled(double mouseX, double mouseY, double scrollX, double scrollY) {
|
||||
// Reimplement ContainerEventHandler.mouseScrolled, as AbstractContainerScreen overrides it.
|
||||
var child = getChildAt(mouseX, mouseY);
|
||||
if (child.isPresent() && child.get().mouseScrolled(mouseX, mouseY, scrollX, scrollY)) return true;
|
||||
|
||||
return super.mouseScrolled(mouseX, mouseY, scrollX, scrollY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(GuiGraphics graphics, int mouseX, int mouseY, float partialTicks) {
|
||||
super.render(graphics, mouseX, mouseY, partialTicks);
|
||||
|
Reference in New Issue
Block a user