Posted July 19, 20178 yr While testing one of my mods alongside some others, I got this crash that I can't figure out: Spoiler ---- Minecraft Crash Report ---- // But it works on my machine. Time: 7/18/17 11:45 PM Description: Ticking entity java.lang.ClassCastException: java.lang.reflect.Field cannot be cast to java.lang.Byte at net.minecraft.entity.EntityLivingBase.func_184587_cr(EntityLivingBase.java:2641) at net.minecraft.entity.EntityLivingBase.func_184608_ct(EntityLivingBase.java:2651) at net.minecraft.entity.EntityLivingBase.func_70071_h_(EntityLivingBase.java:2082) at net.minecraft.entity.EntityLiving.func_70071_h_(EntityLiving.java:295) at net.minecraft.entity.monster.EntityMob.func_70071_h_(SourceFile:46) at net.minecraft.entity.monster.EntityCreeper.func_70071_h_(SourceFile:161) at net.minecraft.world.World.func_72866_a(World.java:1976) at net.minecraft.world.WorldServer.func_72866_a(WorldServer.java:833) at net.minecraft.world.World.func_72870_g(World.java:1939) at net.minecraft.world.World.func_72939_s(World.java:1753) at net.minecraft.world.WorldServer.func_72939_s(WorldServer.java:614) at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:761) at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:665) at net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:185) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:523) at java.lang.Thread.run(Thread.java:748) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Client thread Stacktrace: at net.minecraft.entity.EntityLivingBase.func_184587_cr(EntityLivingBase.java:2641) at net.minecraft.entity.EntityLivingBase.func_184608_ct(EntityLivingBase.java:2651) at net.minecraft.entity.EntityLivingBase.func_70071_h_(EntityLivingBase.java:2082) at net.minecraft.entity.EntityLiving.func_70071_h_(EntityLiving.java:295) at net.minecraft.entity.monster.EntityMob.func_70071_h_(SourceFile:46) at net.minecraft.entity.monster.EntityCreeper.func_70071_h_(SourceFile:161) at net.minecraft.world.World.func_72866_a(World.java:1976) at net.minecraft.world.WorldServer.func_72866_a(WorldServer.java:833) at net.minecraft.world.World.func_72870_g(World.java:1939) -- Entity being ticked -- Details: Entity Type: minecraft:creeper (net.minecraft.entity.monster.EntityCreeper) Entity ID: 10719 Entity Name: Creeper Entity's Exact location: -122.50, 44.00, 317.50 Entity's Block location: World: (-123,44,317), Chunk: (at 5,2,13 in -8,19; contains blocks -128,0,304 to -113,255,319), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511) Entity's Momentum: 0.00, -0.08, 0.00 Entity's Passengers: [] Entity's Vehicle: ~~ERROR~~ NullPointerException: null Stacktrace: at net.minecraft.world.World.func_72939_s(World.java:1753) at net.minecraft.world.WorldServer.func_72939_s(WorldServer.java:614) -- Affected level -- Details: Level name: New World All players: 1 total; [EntityPlayerMP['<PROFILE NAME>'/386, l='New World', x=-111.07, y=95.53, z=268.25]] Chunk stats: ServerChunkCache: 630 Drop: 0 Level seed: 8382629383432640614 Level generator: ID 00 - default, ver 1. Features enabled: true Level generator options: Level spawn location: World: (-100,64,256), Chunk: (at 12,4,0 in -7,16; contains blocks -112,0,256 to -97,255,271), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511) Level time: 12128 game time, 6064 day time Level dimension: 0 Level storage version: 0x04ABD - Anvil Level weather: Rain time: 23809 (now: false), thunder time: 71243 (now: false) Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true Stacktrace: at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:761) at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:665) at net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:185) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:523) at java.lang.Thread.run(Thread.java:748) -- System Details -- Details: Minecraft Version: 1.12 Operating System: Linux (amd64) version 4.12.0-041200-generic Java Version: 1.8.0_131, Oracle Corporation Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 2316900848 bytes (2209 MB) / 4064280576 bytes (3876 MB) up to 7635730432 bytes (7282 MB) JVM Flags: 2 total; -Xms2048m -Xmx8192m IntCache: cache: 0, tcache: 8, allocated: 20, tallocated: 86 FML: MCP 9.40 Powered by Forge 14.21.1.2413 8 mods loaded, 8 mods active States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored UCHIJAAAA minecraft{1.12} [Minecraft] (minecraft.jar) UCHIJAAAA mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) UCHIJAAAA FML{8.0.99.99} [Forge Mod Loader] (forge-1.12-14.21.1.2413-universal.jar) UCHIJAAAA forge{14.21.1.2413} [Minecraft Forge] (forge-1.12-14.21.1.2413-universal.jar) UCHIJAAAA crafttweaker{4.0.1} [CraftTweaker2] (CraftTweaker2-1.12-4.0.1.jar) UCHIJAAAA ctgui{1.0.0} [CT-GUI] (CraftTweaker2-1.12-4.0.1.jar) UCHIJAAAA degradeexplodedblocks{1.0.0} [DegradeExplodedBlocks] (degradeexplodedblocks-1.11.2-1.0.0.jar) UCHIJAAAA infinitefluids{1.1.1} [InfiniteFluids] (infinitefluids-1.11-1.1.1.jar) Loaded coremods (and transformers): GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread. Profiler Position: N/A (disabled) Player Count: 1 / 8; [EntityPlayerMP['<PROFILE NAME>'/386, l='New World', x=-111.07, y=95.53, z=268.25]] Type: Integrated Server (map_client.txt) Is Modded: Definitely; Client brand changed to 'fml,forge' Important part: java.lang.ClassCastException: java.lang.reflect.Field cannot be cast to java.lang.Byte at net.minecraft.entity.EntityLivingBase.func_184587_cr(EntityLivingBase.java:2641) Here's what I figured out myself: First, here's net.minecraft.entity.EntityLivingBase.func_184587_cr(EntityLivingBase.java:2641): public boolean isHandActive() { return (((Byte)this.dataManager.get(HAND_STATES)).byteValue() & 1) > 0; } HAND_STATES is declared as a DataParameter<Byte>, so all through this next part, T is Byte. Next, here's this.dataManager.get: public <T> T get(DataParameter<T> key) { return (T)this.getEntry(key).getValue(); } And here's getValue: public T getValue() { return this.value; } And finally, here's value: private T value; I don't get how a Field could have gotten as far as it did. "value" is declared as type T, as are the return values of getValue() and get(). Even get() itself has an explicit cast to T. Where did the Field come from here, and why didn't it crash anywhere prior to isHandActive where it must have been shoehorned into an inappropriate variable?
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.