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 */

View File

@ -2,17 +2,21 @@ package net.kdt.pojavlaunch.utils;
import static org.lwjgl.glfw.CallbackBridge.windowHeight;
import static org.lwjgl.glfw.CallbackBridge.windowWidth;
import java.io.*;
import java.lang.ref.WeakReference;
import java.util.*;
import android.os.Build;
import android.os.FileObserver;
import android.util.*;
import android.util.Log;
import androidx.annotation.Nullable;
import net.kdt.pojavlaunch.*;
import net.kdt.pojavlaunch.Tools;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;
public class MCOptionUtils
{
@ -103,6 +107,8 @@ public class MCOptionUtils
}
};
}
fileObserver.startWatching();
}
public static void notifyListeners(){