mojira.dev

Janne Mareike Koschinski

Assigned

No issues.

Reported

No issues.

Comments

I've created a fix for everyone using forge in 1.6.4, the same changes could be applied to vanilla minecraft.

src.minecraft.client.settings.GameSettings.java

// Replace getKeyDisplayString with this one:
	public static String getKeyDisplayString(int key) {
		// I've replace the original ternary operator here with a regular if clause for better readibility
		if (key < 0) {
			return I18n.getStringParams("key.mouseButton",
					new Object[] { Integer.valueOf(key + 101) });
		} else if (Keyboard.getKeyName(key)==null || Keyboard.getKeyName(key).isEmpty() || Keyboard.getKeyName(key).equals("NONE")) {
				return String.format("%c", key).toUpperCase();
		} else {
				return Keyboard.getKeyName(key);
		}
	}

src.cpw.mods.fml.client.registry.KeyBindingRegistry.java

// Add this Method
        public static final List<Integer> getPressedKeys() {
        	List<Integer> pressedKeys = new ArrayList<Integer>();
        	while (Keyboard.next()) {
        		pressedKeys.add(Keyboard.getEventKey() != Keyboard.KEY_NONE ? Keyboard.getEventKey() : Keyboard.getEventCharacter());
        	}
        	return pressedKeys;
        }

// Replace keyTick with this one
        private void keyTick(EnumSet<TickType> type, boolean tickEnd)
        {
        	List<Integer> pressedKeys = getPressedKeys();
		for (int i = 0; i < keyBindings.length; i++)
		{
			KeyBinding keyBinding = keyBindings[i];
			int keyCode = keyBinding.keyCode;
			boolean state = (keyCode < 0 ? Mouse.isButtonDown(keyCode + 100) : pressedKeys.contains(keyCode));
			if (state != keyDown[i] || (state && repeatings[i]))
			{
				if (state)
				{
					keyDown(type, keyBinding, tickEnd, state!=keyDown[i]);
				}
				else
				{
					keyUp(type, keyBinding, tickEnd);
				}
				if (tickEnd)
				{
					keyDown[i] = state;
				}
			}
		}
	}

src.net.minecraftforge.client.GuiControlsScrollPanel.java

// Replace keyTyped with this one
	public boolean keyTyped(char c, int i)
	{
		if (selected != -1)
		{
			if (i != 0) 
				options.setKeyBinding(selected, i);
			else
				options.setKeyBinding(selected, c);
			selected = -1;
			KeyBinding.resetKeyBindingArrayAndHash();
			return false;
		}
		return true;
	}

net.minecraft.client.Minecraft.java

while (Keyboard.next())
						{
								KeyBinding.setKeyBindState(Keyboard.getEventKey() != Keyboard.KEY_NONE ? Keyboard.getEventKey() : Keyboard.getEventCharacter(), Keyboard.getEventKeyState());

								if (Keyboard.getEventKeyState())
								{
										KeyBinding.onTick(Keyboard.getEventKey() != Keyboard.KEY_NONE ? Keyboard.getEventKey() : Keyboard.getEventCharacter());
								}

								if (this.field_83002_am > 0L)
								{
										if (getSystemTime() - this.field_83002_am >= 6000L)
										{
												throw new ReportedException(new CrashReport("Manually triggered debug crash", new Throwable()));
										}

										if (!Keyboard.isKeyDown(46) || !Keyboard.isKeyDown(61))
										{
												this.field_83002_am = -1L;
										}
								}
								else if (Keyboard.isKeyDown(46) && Keyboard.isKeyDown(61))
								{
										this.field_83002_am = getSystemTime();
								}

								if (Keyboard.getEventKeyState())
								{
										if (Keyboard.getEventKey() == 87)
										{
												this.toggleFullscreen();
										}
										else
										{
												if (this.currentScreen != null)
												{
														this.currentScreen.handleKeyboardInput();
												}
												else
												{
														if (Keyboard.getEventKey() == 1)
														{
																this.displayInGameMenu();
														}

														if (Keyboard.getEventKey() == 31 && Keyboard.isKeyDown(61))
														{
																this.refreshResources();
														}

														if (Keyboard.getEventKey() == 20 && Keyboard.isKeyDown(61))
														{
																this.refreshResources();
														}

														if (Keyboard.getEventKey() == 33 && Keyboard.isKeyDown(61))
														{
																flag = Keyboard.isKeyDown(42) | Keyboard.isKeyDown(54);
																this.gameSettings.setOptionValue(EnumOptions.RENDER_DISTANCE, flag ? -1 : 1);
														}

														if (Keyboard.getEventKey() == 30 && Keyboard.isKeyDown(61))
														{
																this.renderGlobal.loadRenderers();
														}

														if (Keyboard.getEventKey() == 35 && Keyboard.isKeyDown(61))
														{
																this.gameSettings.advancedItemTooltips = !this.gameSettings.advancedItemTooltips;
																this.gameSettings.saveOptions();
														}

														if (Keyboard.getEventKey() == 48 && Keyboard.isKeyDown(61))
														{
																RenderManager.field_85095_o = !RenderManager.field_85095_o;
														}

														if (Keyboard.getEventKey() == 25 && Keyboard.isKeyDown(61))
														{
																this.gameSettings.pauseOnLostFocus = !this.gameSettings.pauseOnLostFocus;
																this.gameSettings.saveOptions();
														}

														if (Keyboard.getEventKey() == 59)
														{
																this.gameSettings.hideGUI = !this.gameSettings.hideGUI;
														}

														if (Keyboard.getEventKey() == 61)
														{
																this.gameSettings.showDebugInfo = !this.gameSettings.showDebugInfo;
																this.gameSettings.showDebugProfilerChart = GuiScreen.isShiftKeyDown();
														}

														if (Keyboard.getEventKey() == 63)
														{
																++this.gameSettings.thirdPersonView;

																if (this.gameSettings.thirdPersonView > 2)
																{
																		this.gameSettings.thirdPersonView = 0;
																}
														}

														if (Keyboard.getEventKey() == 66)
														{
																this.gameSettings.smoothCamera = !this.gameSettings.smoothCamera;
														}
												}

												for (i = 0; i < 9; ++i)
												{
														if (Keyboard.getEventKey() == 2 + i)
														{
																this.thePlayer.inventory.currentItem = i;
														}
												}

												if (this.gameSettings.showDebugInfo && this.gameSettings.showDebugProfilerChart)
												{
														if (Keyboard.getEventKey() == 11)
														{
																this.updateDebugProfilerName(0);
														}

														for (i = 0; i < 9; ++i)
														{
																if (Keyboard.getEventKey() == 2 + i)
																{
																		this.updateDebugProfilerName(i + 1);
																}
														}
												}
										}
								}
						}

This should be enough to fix the problem for forge users.

Mojang, please implement this!

This problem is not even in minecraft's code, this is a problem in lwjgl.
The best would be if you'd send a bugreport to their bugtracker.

I can confirm this problem using Minecraft 1.7.4 / Launcher version 1.3.7 but not with the french/belgian keyboard, instead I've got this problem on a german keyboard with the keys:
ö, ä, ü, #, +, ß, ', ^ and <.

I tested this manually, for these keys LWJGL doesn't output any KeyCode, and I even investigated LWJGL's java source:
The problem is neither in Minecraft nor in the Java-part of LWJGL, instead it has to be anywhere between the Kernel and LWJGL's C parts.