0

I'm making a Minecraft mod in Itellij that relies on org.lwjgl.input code. That library was removed from LWJGL 3, so I have to use LWJGL 2 instead. I added the correct LWJGL 2 jar files to my dependencies and libraries and no errors show in my code. However, when I compile, I get this error:

error: package org.lwjgl.input does not exist

import org.lwjgl.input.Keyboard;

I already tried rebuilding, cleaning, deleting the .idea folder, invalidating the cache, and deleting all of the LWJGL 3 libraries. Am I missing a step?

Alex
  • 1
  • 1
  • You use LWJGL2 in IntelliJ IDEA just like you use any other external dependency in an IDEA module/project. See: https://stackoverflow.com/questions/1051640/correct-way-to-add-external-jars-lib-jar-to-an-intellij-idea-project#answer-1051705 – httpdigest May 26 '19 at 12:56
  • If you read my question you'll see that I already tried that, and it did not work. – Alex May 26 '19 at 13:42
  • Have you looked inside the jar that you're using to see if the package org.lwjgl.input is there? Are you using the maven repository files? Do you have the natives included as well? – Kylon Tyner May 26 '19 at 15:20
  • Do you want to use LWJGL 2 instead of LWJGL 3 or both together? – DasElias May 26 '19 at 16:29
  • Yes it is there, and I don't think I'm using Maven at all. I am trying to use LWJGL 2 instead of 3. – Alex May 26 '19 at 17:16
  • It turns out that modding Minecraft is dependent on 3, so I need to use both – Alex May 26 '19 at 20:20
  • @Alex Older minecraft versions only require LWJGL2, newer versions like 1.13 use LWJGL3 – Frontear May 27 '19 at 13:02

1 Answers1

2

LWJGL3 is a major upgrade over (the now deprecated and unsupported) LWJGL2. Several higher level APIs such as the org.lwjgl.input package have been removed in favor of low-level bindings to native APIs that can be used by applications. Using LWJGL3 and LWJGL2 on the same classpath is not a proper solution to retrieve old behavior. (Since the input APIs are fairly tightly integrated into the windowing code and LWJGL2 and LWJGL3 are not designed to be used together, it is unlikely to work at all.) Instead, I highly recommend to update your mod to use an input API exposed either by Minecraft itself or by the modding framework you are using.

  • Do you have a suggestion as to which API to use? – Alex May 28 '19 at 14:28
  • It depends on which library/framework you use for modding and what you want to achieve. An example: If you are working with Forge and want to trigger some kind of action when a key is pressed `InputEvent` (and subtypes) might be the right choice. (https://github.com/MinecraftForge/MinecraftForge/pull/5533) – TheMrMilchmann May 30 '19 at 01:10