Jump to content

Entity cannot be cast to class net.minecraft.world.entity.Mob


coldthunder4
 Share

Recommended Posts

I hate posting these small problems I have here asking for help, but I legit cannot find resources that tell me how to properly do these things. If someone can lend me a link detailing a lot of the minecraft modding classes and such, much appreciated. 

My mob crashes the game when I spawn it. 

My question about this is, What's the problem here? Thanks in advance.

GitHub Repository: https://github.com/Coldthunder4/AGuardMod 

Crash Log:

---- Minecraft Crash Report ---- // I let you down. Sorry :( Time: 1/6/23, 9:53 PM Description: Unexpected error java.lang.ClassCastException: class net.coldthunder4.cellguard.entity.custom.GuardEntity cannot be cast to class net.minecraft.world.entity.Mob (net.coldthunder4.cellguard.entity.custom.GuardEntity is in module cellguard@0.0.1-1.19 of loader 'TRANSFORMER' @7c8c70d6; net.minecraft.world.entity.Mob is in module minecraft@1.19 of loader 'TRANSFORMER' @7c8c70d6) at net.minecraft.client.renderer.entity.MobRenderer.shouldRender(MobRenderer.java:20) ~[forge-1.19-41.1.0_mapped_official_1.19-recomp.jar%23181!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.entity.EntityRenderDispatcher.shouldRender(EntityRenderDispatcher.java:123) ~[forge-1.19-41.1.0_mapped_official_1.19-recomp.jar%23181!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.LevelRenderer.renderLevel(LevelRenderer.java:1194) ~[forge-1.19-41.1.0_mapped_official_1.19-recomp.jar%23181!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.GameRenderer.renderLevel(GameRenderer.java:1068) ~[forge-1.19-41.1.0_mapped_official_1.19-recomp.jar%23181!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.GameRenderer.render(GameRenderer.java:840) ~[forge-1.19-41.1.0_mapped_official_1.19-recomp.jar%23181!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.runTick(Minecraft.java:1084) ~[forge-1.19-41.1.0_mapped_official_1.19-recomp.jar%23181!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.run(Minecraft.java:669) ~[forge-1.19-41.1.0_mapped_official_1.19-recomp.jar%23181!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(Main.java:206) ~[forge-1.19-41.1.0_mapped_official_1.19-recomp.jar%23181!/:?] {re:classloading,pl:runtimedistcleaner:A} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {} at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {} at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {} at net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:25) ~[fmlloader-1.19-41.1.0.jar%2394!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) [modlauncher-10.0.8.jar%23106!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-10.0.8.jar%23106!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-10.0.8.jar%23106!/:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-10.0.8.jar%23106!/:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-10.0.8.jar%23106!/:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-10.0.8.jar%23106!/:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-10.0.8.jar%23106!/:?] {} at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) [bootstraplauncher-1.1.2.jar:?] {} A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Render thread Stacktrace: at net.minecraft.client.renderer.entity.MobRenderer.shouldRender(MobRenderer.java:20) ~[forge-1.19-41.1.0_mapped_official_1.19-recomp.jar%23181!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.entity.EntityRenderDispatcher.shouldRender(EntityRenderDispatcher.java:123) ~[forge-1.19-41.1.0_mapped_official_1.19-recomp.jar%23181!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.LevelRenderer.renderLevel(LevelRenderer.java:1194) ~[forge-1.19-41.1.0_mapped_official_1.19-recomp.jar%23181!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.GameRenderer.renderLevel(GameRenderer.java:1068) ~[forge-1.19-41.1.0_mapped_official_1.19-recomp.jar%23181!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} -- Affected level -- Details: All players: 1 total; [LocalPlayer['Dev'/82, l='ClientLevel', x=-8.50, y=-60.00, z=7.50]] Chunk stats: 961, 609 Level dimension: minecraft:overworld Level spawn location: World: (0,-60,0), Section: (at 0,4,0 in 0,-4,0; chunk contains blocks 0,-64,0 to 15,319,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,-64,0 to 511,319,511) Level time: 450 game time, 450 day time Server brand: forge Server type: Integrated singleplayer server Stacktrace: at net.minecraft.client.multiplayer.ClientLevel.fillReportDetails(ClientLevel.java:449) ~[forge-1.19-41.1.0_mapped_official_1.19-recomp.jar%23181!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.fillReport(Minecraft.java:2237) ~[forge-1.19-41.1.0_mapped_official_1.19-recomp.jar%23181!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.run(Minecraft.java:691) ~[forge-1.19-41.1.0_mapped_official_1.19-recomp.jar%23181!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(Main.java:206) ~[forge-1.19-41.1.0_mapped_official_1.19-recomp.jar%23181!/:?] {re:classloading,pl:runtimedistcleaner:A} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {} at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {} at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {} at net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:25) ~[fmlloader-1.19-41.1.0.jar%2394!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) [modlauncher-10.0.8.jar%23106!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-10.0.8.jar%23106!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-10.0.8.jar%23106!/:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-10.0.8.jar%23106!/:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-10.0.8.jar%23106!/:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-10.0.8.jar%23106!/:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-10.0.8.jar%23106!/:?] {} at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) [bootstraplauncher-1.1.2.jar:?] {} -- Last reload -- Details: Reload number: 1 Reload reason: initial Finished: Yes Packs: Default, Mod Resources -- System Details -- Details: Minecraft Version: 1.19 Minecraft Version ID: 1.19 Operating System: Windows 10 (amd64) version 10.0 Java Version: 17.0.5, Eclipse Adoptium Java VM Version: OpenJDK 64-Bit Server VM (mixed mode, sharing), Eclipse Adoptium Memory: 1134633312 bytes (1082 MiB) / 1654652928 bytes (1578 MiB) up to 4217372672 bytes (4022 MiB) CPUs: 12 Processor Vendor: GenuineIntel Processor Name: 11th Gen Intel(R) Core(TM) i5-11400H @ 2.70GHz Identifier: Intel64 Family 6 Model 141 Stepping 1 Microarchitecture: unknown Frequency (GHz): 2.69 Number of physical packages: 1 Number of physical CPUs: 6 Number of logical CPUs: 12 Graphics card #0 name: Intel(R) UHD Graphics Graphics card #0 vendor: Intel Corporation (0x8086) Graphics card #0 VRAM (MB): 1024.00 Graphics card #0 deviceId: 0x9a68 Graphics card #0 versionInfo: DriverVersion=31.0.101.1999 Graphics card #1 name: NVIDIA GeForce RTX 3050 Ti Laptop GPU Graphics card #1 vendor: NVIDIA (0x10de) Graphics card #1 VRAM (MB): 4095.00 Graphics card #1 deviceId: 0x25a0 Graphics card #1 versionInfo: DriverVersion=30.0.15.1165 Memory slot #0 capacity (MB): 8192.00 Memory slot #0 clockSpeed (GHz): 3.20 Memory slot #0 type: DDR4 Memory slot #1 capacity (MB): 8192.00 Memory slot #1 clockSpeed (GHz): 3.20 Memory slot #1 type: DDR4 Virtual memory max (MB): 26837.67 Virtual memory used (MB): 18781.58 Swap memory total (MB): 10752.00 Swap memory used (MB): 846.11 JVM Flags: 1 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump Launched Version: MOD_DEV Backend library: LWJGL version 3.3.1 build 7 Backend API: NVIDIA GeForce RTX 3050 Ti Laptop GPU/PCIe/SSE2 GL version 3.2.0 NVIDIA 511.65, NVIDIA Corporation Window size: 1920x991 GL Caps: Using framebuffer using OpenGL 3.2 GL debug messages: Using VBOs: Yes Is Modded: Definitely; Client brand changed to 'forge'; Server brand changed to 'forge' Type: Integrated Server (map_client.txt) Graphics mode: fancy Resource Packs: Current Language: English (US) CPU: 12x 11th Gen Intel(R) Core(TM) i5-11400H @ 2.70GHz Server Running: true Player Count: 1 / 8; [ServerPlayer['Dev'/82, l='ServerLevel[FLAT]', x=-8.50, y=-60.00, z=7.50]] Data Packs: vanilla, mod:forge, mod:cellguard World Generation: Stable ModLauncher: 10.0.8+10.0.8+main.0ef7e830 ModLauncher launch target: forgeclientuserdev ModLauncher naming: mcp ModLauncher services: mixin-0.8.5.jar mixin PLUGINSERVICE eventbus-6.0.0.jar eventbus PLUGINSERVICE fmlloader-1.19-41.1.0.jar slf4jfixer PLUGINSERVICE fmlloader-1.19-41.1.0.jar object_holder_definalize PLUGINSERVICE fmlloader-1.19-41.1.0.jar runtime_enum_extender PLUGINSERVICE fmlloader-1.19-41.1.0.jar capability_token_subclass PLUGINSERVICE accesstransformers-8.0.4.jar accesstransformer PLUGINSERVICE fmlloader-1.19-41.1.0.jar runtimedistcleaner PLUGINSERVICE modlauncher-10.0.8.jar mixin TRANSFORMATIONSERVICE modlauncher-10.0.8.jar fml TRANSFORMATIONSERVICE FML Language Providers: minecraft@1.0 lowcodefml@null javafml@null Mod List: forge-1.19-41.1.0_mapped_official_1.19-recomp.jar |Minecraft |minecraft |1.19 |DONE |Manifest: a1:d4:5e:04:4f:d3:d6:e0:7b:37:97:cf:77:b0:de:ad:4a:47:ce:8c:96:49:5f:0a:cf:8c:ae:b2:6d:4b:8a:3f |Forge |forge |41.1.0 |DONE |Manifest: NOSIGNATURE main |Guard Mod |cellguard |0.0.1-1.19 |DONE |Manifest: NOSIGNATURE Crash Report UUID: c698254a-08c5-4591-af27-e4a1ad642f47 FML: 41.1 Forge: net.minecraftforge:41.1.0

Link to comment
Share on other sites

I think you meant to extend a class further down than LivingEntity (probably at least Mob?), there's a lot of classes in the inheritance line between LivingEntity and most vanilla mobs.

Eg. a zombie:

LivingEntity -> Mob -> PathfinderMob -> Monster -> Zombie

  • Like 1
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.