Something went wrong. Try again.
The Minecraft: Java Edition decompiled source code.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103package com.mojang.blaze3d.platform;
import com.google.common.base.Joiner;import com.google.common.collect.Lists;import com.mojang.blaze3d.DontObfuscate;import com.mojang.blaze3d.systems.RenderSystem;import com.mojang.logging.LogUtils;import java.util.ArrayList;import java.util.Locale;import java.util.function.Consumer;import java.util.function.LongSupplier;import java.util.function.Supplier;import org.jspecify.annotations.Nullable;import org.lwjgl.Version;import org.lwjgl.glfw.GLFW;import org.lwjgl.glfw.GLFWErrorCallback;import org.lwjgl.glfw.GLFWErrorCallbackI;import org.lwjgl.glfw.GLFWVidMode;import org.lwjgl.system.MemoryUtil;import org.slf4j.Logger;import oshi.SystemInfo;import oshi.hardware.CentralProcessor;
@DontObfuscatepublic class GLX { private static final Logger LOGGER = LogUtils.getLogger(); @Nullable private static String cpuInfo;
public static int _getRefreshRate(Window window) { RenderSystem.assertOnRenderThread(); long l = GLFW.glfwGetWindowMonitor(window.handle()); if (l == 0L) { l = GLFW.glfwGetPrimaryMonitor(); }
GLFWVidMode gLFWVidMode = l == 0L ? null : GLFW.glfwGetVideoMode(l); return gLFWVidMode == null ? 0 : gLFWVidMode.refreshRate(); }
public static String _getLWJGLVersion() { return Version.getVersion(); }
public static LongSupplier _initGlfw() { Window.checkGlfwError((integer, string1) -> { throw new IllegalStateException(String.format(Locale.ROOT, "GLFW error before init: [0x%X]%s", integer, string1)); }); ArrayList arrayList = Lists.newArrayList(); GLFWErrorCallback gLFWErrorCallback = GLFW.glfwSetErrorCallback((i, l) -> { String string1 = l == 0L ? "" : MemoryUtil.memUTF8(l); arrayList.add(String.format(Locale.ROOT, "GLFW error during init: [0x%X]%s", i, string1)); }); if (!GLFW.glfwInit()) { throw new IllegalStateException("Failed to initialize GLFW, errors: " + Joiner.on(",").join(arrayList)); } else { LongSupplier longSupplier = () -> (long)(GLFW.glfwGetTime() * 1.0E9);
for (String string : arrayList) { LOGGER.error("GLFW error collected during initialization: {}", string); }
RenderSystem.setErrorCallback(gLFWErrorCallback); return longSupplier; } }
public static void _setGlfwErrorCallback(GLFWErrorCallbackI gLFWErrorCallbackI) { GLFWErrorCallback gLFWErrorCallback = GLFW.glfwSetErrorCallback(gLFWErrorCallbackI); if (gLFWErrorCallback != null) { gLFWErrorCallback.free(); } }
public static boolean _shouldClose(Window window) { return GLFW.glfwWindowShouldClose(window.handle()); }
public static String _getCpuInfo() { if (cpuInfo == null) { cpuInfo = "<unknown>";
try { CentralProcessor centralProcessor = new SystemInfo().getHardware().getProcessor(); cpuInfo = String.format(Locale.ROOT, "%dx %s", centralProcessor.getLogicalProcessorCount(), centralProcessor.getProcessorIdentifier().getName()) .replaceAll("\\s+", " "); } catch (Throwable throwable) { } }
return cpuInfo; }
public static <T> T make(Supplier<T> supplier) { return (T)supplier.get(); }
public static <T> T make(T object, Consumer<T> consumer) { consumer.accept(object); return (T)object; }}