我开始尝试对Minecraft 1.7.10进行调制,但是每当我尝试从eclipse运行我的测试模块时,客户端就会崩溃(问题不在我构建并加载到Minecraft并能正常工作的模块中。 这是崩溃日志:
---- Minecraft Crash Report ----
// Would you like a cupcake?
Time: 9/17/18 11:06 AM
Description: Initializing game
java.lang.NoSuchMethodError: java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer;
at net.minecraft.client.Minecraft.func_152340_a(Minecraft.java:694)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:463)
at net.minecraft.client.Minecraft.run(Minecraft.java:942)
at net.minecraft.client.main.Main.main(Main.java:164)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
at GradleStart.main(Unknown Source)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Stacktrace:
at net.minecraft.client.Minecraft.func_152340_a(Minecraft.java:694)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:463)
-- Initialization --
Details:
Stacktrace:
at net.minecraft.client.Minecraft.run(Minecraft.java:942)
at net.minecraft.client.main.Main.main(Main.java:164)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
at GradleStart.main(Unknown Source)
-- System Details --
Details:
Minecraft Version: 1.7.10
Operating System: Windows 10 (amd64) version 10.0
Java Version: 1.8.0_171, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 857412696 bytes (817 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML:
Launched Version: 1.7.10
LWJGL: 2.9.1
OpenGL: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread.
GL Caps:
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: []
Current Language: ~~ERROR~~ NullPointerException: null
Profiler Position: N/A (disabled)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Anisotropic Filtering: Off (1)
从我收集到的信息来看,使用jre1.8.0安装JDK 10.0.2和eclipse似乎是一个问题,但我不确定,也不确定如何解决此问题。
答案 0 :(得分:2)
这里的根本问题是Java9 +的ByteBuffer#flip()
可以返回ByteBuffer
。
代码似乎依赖于获取这种类型。
在这种情况下,因为在Buffer
类中定义了flip
方法,Java 8(及更早版本)返回了Buffer
。
Buffer flippedBuffer = byteBuffer.flip(); // also works in Java9+
ByteBuffer flippedByteBuffer = byteBuffer.flip(); // Java 9+ only