Fixed keybinding crashing when invalid
This commit is contained in:
@@ -42,6 +42,7 @@ public abstract class SplashOverlayMixin {
|
|||||||
private float progress;
|
private float progress;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @author SaturnClient
|
||||||
* @reason Replace vanilla splash rendering completely but keep exit logic
|
* @reason Replace vanilla splash rendering completely but keep exit logic
|
||||||
*/
|
*/
|
||||||
@Overwrite
|
@Overwrite
|
||||||
|
|||||||
@@ -21,8 +21,11 @@ public class KeybindingSelector extends Element {
|
|||||||
public void render(RenderScope renderScope, ElementContext ctx) {
|
public void render(RenderScope renderScope, ElementContext ctx) {
|
||||||
int textColor = focused ? 0xFFFFFF : 0xAAAAAA;
|
int textColor = focused ? 0xFFFFFF : 0xAAAAAA;
|
||||||
renderScope.drawRoundedRectangle(0, 0, width, height, 10, 0xFF000000);
|
renderScope.drawRoundedRectangle(0, 0, width, height, 10, 0xFF000000);
|
||||||
renderScope.drawText(0.6f, prop.value == -1 ? "<NONE>" :
|
String name = GLFW.glfwGetKeyName(prop.value, GLFW.glfwGetKeyScancode(prop.value));
|
||||||
GLFW.glfwGetKeyName(prop.value, GLFW.glfwGetKeyScancode(prop.value)).toUpperCase(),
|
|
||||||
|
renderScope.drawText(0.6f,
|
||||||
|
prop.value == -1 ? "<NONE>"
|
||||||
|
: name != null ? name.toUpperCase() : "<Invalid-Key>",
|
||||||
4, 4, Theme.FONT.value, textColor);
|
4, 4, Theme.FONT.value, textColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user