- Bug fix: move camera a bit causes trigger right mouse.
- Implemented Hotbar touch (from Android version with some changes
from @serpentspirale
This commit is contained in:
Duy Tran Khanh committed 2021-02-07 13:02:28 +07:00
1 parent 8dee3ac1bf
commit 6efde23c02
6 files changed
+105 -9

No files matched your search

@@ -8,6 +8,8 @@ public class UIKit {
public static final int ACTION_UP = 1;
public static final int ACTION_MOVE = 2;
private static int guiScale;
public static void callback_LauncherViewController_installMinecraft() {
PLaunchApp.installMinecraft();
}
@@ -49,6 +51,18 @@ public class UIKit {
CallbackBridge.sendCursorPos(CallbackBridge.mouseX, CallbackBridge.mouseY);
}
public static void updateMCGuiScale() {
MCOptionUtils.load();
String str = MCOptionUtils.get("guiScale");
guiScale = (str == null ? 0 :Integer.parseInt(str));
int scale = Math.max(Math.min(GLFW.mGLFWWindowWidth / 320, GLFW.mGLFWWindowHeight / 240), 1);
if(scale < guiScale || guiScale == 0){
guiScale = scale;
updateMCGuiScale(guiScale);
}
}
public static boolean updateProgressSafe(final float progress, final String message) {
System.out.println(message);
return updateProgress(progress, ((int) (progress * 100)) + "% - " + message);
@@ -61,6 +75,8 @@ public class UIKit {
public static native int launchUI(String[] uiArgs);
// public static native void runOnUIThread(UIKitCallback callback);
private static native void updateMCGuiScale(int scale);
// Update progress
public static native boolean updateProgress(float progress, String message);
@@ -41,6 +41,21 @@ public class MCOptionUtils
mLineList.add(key + ":" + value);
}
public static String get(String key){
if (mLineList == null){
load();
}
for (int i = 0; i < mLineList.size(); i++) {
String line = mLineList.get(i);
if (line.startsWith(key + ":")) {
String value = mLineList.get(i);
return value.substring(value.indexOf(":")+1);
}
}
return null;
}
public static void save() {
StringBuilder result = new StringBuilder();
for (int i = 0; i < mLineList.size(); i++) {