1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-08-29 16:47:56 +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:
Jonathan Coates
2025-07-17 09:00:14 +01:00
parent e81a2c72ce
commit b8d9499027

View File

@@ -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);