Changed how key events work

This commit is contained in:
tom lee
2022-02-06 14:57:43 +08:00
parent de4dd44209
commit 31717ad202
2 changed files with 25 additions and 19 deletions
@@ -25,6 +25,7 @@ import java.util.concurrent.TimeUnit;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.lwjgl.glfw.GLFW;
import com.seibel.lod.core.ModInfo;
import com.seibel.lod.core.enums.config.DistanceGenerationMode;
@@ -105,8 +106,6 @@ public class ClientApi
clientChunkLoad.end("clientChunkLoad");
}
//private HashSet<AbstractChunkPosWrapper> lastFrame = new HashSet<AbstractChunkPosWrapper>();
public void renderLods(Mat4f mcModelViewMatrix, Mat4f mcProjectionMatrix, float partialTicks)
{
// comment out when creating a release
@@ -249,7 +248,30 @@ public class ClientApi
CONFIG.client().advanced().debugging().setDebugKeybindingsEnabled(true);
}
//=================//
// DUBUG USE //
//=================//
// Trigger once on key press, with CLIENT PLAYER.
public void keyPressedEvent(int glfwKey) {
ClientApi.LOGGER.info("DEBUG: Key Pressed: {}",glfwKey);
if (glfwKey == GLFW.GLFW_KEY_F8) {
CONFIG.client().advanced().debugging()
.setDebugMode(CONFIG.client().advanced().debugging().getDebugMode().getNext());
MC.sendChatMessage("F8: Set debug mode to " + CONFIG.client().advanced().debugging().getDebugMode());
}
if (glfwKey == GLFW.GLFW_KEY_F6) {
CONFIG.client().advanced().debugging()
.setDrawLods(!CONFIG.client().advanced().debugging().getDrawLods());
MC.sendChatMessage("F6: Set rendering to " + CONFIG.client().advanced().debugging().getDrawLods());
}
}
@@ -193,22 +193,6 @@ public class EventApi {
// Misc Events //
// =============//
public void onKeyInput(int key, int keyAction) {
if (CONFIG.client().advanced().debugging().getDebugKeybindingsEnabled()) {
if (key == GLFW.GLFW_KEY_F8 && keyAction == GLFW.GLFW_PRESS) {
CONFIG.client().advanced().debugging()
.setDebugMode(CONFIG.client().advanced().debugging().getDebugMode().getNext());
MC.sendChatMessage("F8: Set debug mode " + CONFIG.client().advanced().debugging().getDebugMode());
}
if (key == GLFW.GLFW_KEY_F6 && keyAction == GLFW.GLFW_PRESS) {
CONFIG.client().advanced().debugging()
.setDrawLods(!CONFIG.client().advanced().debugging().getDrawLods());
MC.sendChatMessage("F6: Set rendering " + CONFIG.client().advanced().debugging().getDrawLods());
}
}
}
// NOTE: This is being called from Render Thread.
/** Re-centers the given LodDimension if it needs to be. */
public void playerMoveEvent(LodDimension lodDim) {