Mojira Archive
MC-116952

Can't read CPU info and shows 'CPU: <unknown>' in the debug screen (F3)

The bug

CPU shows <unknown> at debug screen.

Steps to reproduce

Press F3

Code analysis

Based on 1.11.2 decompiled using MCP 9.35 rc1 and 17w18b decompiled using CFR

It looks like the used libraries and methods to detect the CPU changed:

1.11.2
oshi-project:oshi-core:1.1
net.minecraft.client.renderer.OpenGlHelper.initializeTextures() (1.11.2, MCP name)
Processor[] aprocessor = (new SystemInfo()).getHardware().getProcessors();
cpu = String.format("%dx %s", new Object[] {Integer.valueOf(aprocessor.length), aprocessor[0]}).replaceAll("\\s+", " ");
17w18b
com.github.oshi:oshi-core:3.4.2
chp.a() (17w18b)
CentralProcessor centralProcessor = new SystemInfo().getHardware().getProcessor();
ab = String.format("%dx %s", new Object[]{centralProcessor.getPhysicalProcessorCount(), centralProcessor}).replaceAll("\\s+", " ");

The problem appears to be that (at least) one library is missing: org/slf4j/LoggerFactory
This can be seen by modifiying the method chp.a() to log an error if it cannot detect the CPU (which should be done in the first place!):

[13:00:27] [Client thread/ERROR]: Could not get processor
java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
	at oshi.hardware.common.AbstractCentralProcessor.<clinit>(AbstractCentralProcessor.java:43) ~[oshi-core-3.4.2.jar:3.4.2]
	at oshi.hardware.platform.windows.WindowsHardwareAbstractionLayer.getProcessor(WindowsHardwareAbstractionLayer.java:64) ~[oshi-core-3.4.2.jar:3.4.2]
	at chp.a(chp.java:272) [17w18b_custom.jar:?]
	at bhm.ap(SourceFile:446) [17w18b_custom.jar:?]
	at bhm.a(SourceFile:389) [17w18b_custom.jar:?]
	at net.minecraft.client.main.Main.main(SourceFile:123) [17w18b_custom.jar:?]
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
	at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.8.0_131]
	at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_131]
	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) ~[?:1.8.0_131]
	at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_131]
	... 6 more

Fixed

Alawnely

2017-05-03, 05:38 PM

2017-05-10, 06:47 PM

2017-05-10, 06:47 PM

6

2

Confirmed

F3, cpu, debugscreen, library

Minecraft 17w18a, Minecraft 17w18b

Minecraft 1.12 Pre-Release 1