Use empty hotkey button when key is unbound across all versions
This happened to already be the case in 1.16.3 (because of another bug), this commit makes it intentional and consistent across all versions. Using the empty label over NONE or another label because it doesn't change the width of the button and therefore fits nicer with all the other buttons.
This commit is contained in:
@@ -185,6 +185,14 @@ public class KeyBindingRegistry extends EventRegistrations {
|
|||||||
return MCVer.getBoundKey(keyBinding);
|
return MCVer.getBoundKey(keyBinding);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isBound() {
|
||||||
|
//#if MC>=11400
|
||||||
|
return !keyBinding.isUnbound();
|
||||||
|
//#else
|
||||||
|
//$$ return keyBinding.getKeyCode() != 0;
|
||||||
|
//#endif
|
||||||
|
}
|
||||||
|
|
||||||
public void trigger() {
|
public void trigger() {
|
||||||
KeyBindingAccessor acc = (KeyBindingAccessor) keyBinding;
|
KeyBindingAccessor acc = (KeyBindingAccessor) keyBinding;
|
||||||
acc.setPressTime(acc.getPressTime() + 1);
|
acc.setPressTime(acc.getPressTime() + 1);
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public class HotkeyButtons extends EventRegistrations implements Extra {
|
|||||||
@Override
|
@Override
|
||||||
public void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo) {
|
public void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo) {
|
||||||
// There doesn't seem to be an KeyBindingUpdate event, so we'll just update it every time
|
// There doesn't seem to be an KeyBindingUpdate event, so we'll just update it every time
|
||||||
setLabel(keyBinding.getBoundKey());
|
setLabel(keyBinding.isBound() ? keyBinding.getBoundKey() : "");
|
||||||
super.draw(renderer, size, renderInfo);
|
super.draw(renderer, size, renderInfo);
|
||||||
}
|
}
|
||||||
}.onClick(keyBinding::trigger);
|
}.onClick(keyBinding::trigger);
|
||||||
|
|||||||
Reference in New Issue
Block a user