Fix hotbar not registering 0-9 inputs

This commit is contained in:
SerpentSpirale 2021-12-03 13:27:57 +01:00
parent e732f7d823
commit c2e5ddaeda
2 changed files with 13 additions and 7 deletions

View file

@ -577,7 +577,7 @@ public class MinecraftGLView extends TextureView {
int barX = (CallbackBridge.physicalWidth / 2) - (barWidth / 2);
if(x < barX || x >= barX + barWidth) return -1;
return hotbarKeys[((x - barX) / barWidth / 9) % 9];
return hotbarKeys[(int) net.kdt.pojavlaunch.utils.MathUtils.map(x, barX, barX + barWidth, 0, 9)];
}
/** Return the size, given the UI scale size */