Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,20 @@
public abstract class UTGuiEnderUtilitiesMixin
{
/**
* @reason Stop processing slot hotkeys after the GUI has been closed.
* @reason Stop processing the close key itself and any later key events
* queued for this GUI after it has already been closed.
*/
@Inject(method = "keyTyped", at = @At("HEAD"), cancellable = true, require = 0, remap = true)
@Inject(method = "keyTyped", at = @At("HEAD"), cancellable = true, require = 1, remap = true)
private void utStopKeyHandlingAfterClose(char typedChar, int keyCode, CallbackInfo ci)
{
Minecraft mc = Minecraft.getMinecraft();

if (mc.player == null || mc.currentScreen != (Object) this)
{
ci.cancel();
return;
}

if (keyCode == Keyboard.KEY_ESCAPE || mc.gameSettings.keyBindInventory.isActiveAndMatches(keyCode))
{
mc.player.closeScreen();
Expand Down
Loading