Jump to content

[1.8] [SOLVED] NullPointerException when opening custom GUI


Recommended Posts

Posted

So i'm still trying to replace the default container GUI for some blocks, now when i open the GUI the game crashes and it gives me a NullPointerException. I've uploaded all the code to a github repository, i'm really desperate with this :( Any kind of help will be really appreciated, here is the github link

https://github.com/JimiIT92/NewGUI

Don't blame me if i always ask for your help. I just want to learn to be better :)

Posted

Ops, i'm so sorry i've forgot that :( Here is the crash given in eclipse

[23:31:32] [server thread/ERROR]: Encountered an unexpected exception
java.lang.NullPointerException
at net.minecraft.crash.CrashReportCategory.firstTwoElementsOfStackTraceMatch(Unknown Source) ~[CrashReportCategory.class:?]
at net.minecraft.crash.CrashReport.makeCategoryDepth(Unknown Source) ~[CrashReport.class:?]
at net.minecraft.world.World.addWorldInfoToCrashReport(Unknown Source) ~[World.class:?]
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(Unknown Source) ~[MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.tick(Unknown Source) ~[MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.tick(Unknown Source) ~[integratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(Unknown Source) [MinecraftServer.class:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_60]
[23:31:32] [server thread/ERROR]: This crash report has been saved to: C:\Users\jimia\Documents\Minecraft Mods\NewGUI\run\.\crash-reports\crash-2015-10-04_23.31.32-server.txt
[23:31:32] [server thread/INFO]: Stopping server
[23:31:32] [server thread/INFO]: Saving players
[23:31:32] [server thread/INFO]: Player12 lost connection: TextComponent{text='Server closed', siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}
[23:31:32] [server thread/INFO]: Player12 left the game
[23:31:32] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:-1]: ---- Minecraft Crash Report ----
// Sorry 

Time: 04/10/15 23.31
Description: Exception in server tick loop

java.lang.NullPointerException: Exception in server tick loop
at net.minecraft.crash.CrashReportCategory.firstTwoElementsOfStackTraceMatch(Unknown Source)
at net.minecraft.crash.CrashReport.makeCategoryDepth(Unknown Source)
at net.minecraft.world.World.addWorldInfoToCrashReport(Unknown Source)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(Unknown Source)
at net.minecraft.server.MinecraftServer.tick(Unknown Source)
at net.minecraft.server.integrated.IntegratedServer.tick(Unknown Source)
at net.minecraft.server.MinecraftServer.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- System Details --
Details:
Minecraft Version: 1.8
Operating System: Windows 10 (amd64) version 10.0
Java Version: 1.8.0_60, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 384113168 bytes (366 MB) / 662700032 bytes (632 MB) up to 1398276096 bytes (1333 MB)
JVM Flags: 0 total; 
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v9.10 FML v8.0.99.99 Minecraft Forge 11.14.3.1516 4 mods loaded, 4 mods active
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
UCHIJAAAA	mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) 
UCHIJAAAA	FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.8-11.14.3.1516.jar) 
UCHIJAAAA	Forge{11.14.3.1516} [Minecraft Forge] (forgeSrc-1.8-11.14.3.1516.jar) 
UCHIJAAAA	newgui{1.0} [newgui] (bin) 
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['Player12'/142, l='New World', x=881,61, y=5,00, z=1215,05]]
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'fml,forge'
[23:31:32] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:-1]: #@!@# Game crashed! Crash report saved to: #@!@# .\crash-reports\crash-2015-10-04_23.31.32-server.txt

 

 

Don't blame me if i always ask for your help. I just want to learn to be better :)

Posted

Alright, so this is the "new" crash report

[23:53:44] [server thread/ERROR]: Encountered an unexpected exception
net.minecraft.util.ReportedException: Ticking entity
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:781) ~[MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:669) ~[MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:171) ~[integratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:540) [MinecraftServer.class:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_60]
Caused by: java.lang.IndexOutOfBoundsException: Index: 46, Size: 46
at java.util.ArrayList.rangeCheck(Unknown Source) ~[?:1.8.0_60]
at java.util.ArrayList.get(Unknown Source) ~[?:1.8.0_60]
at net.minecraft.inventory.Container.detectAndSendChanges(Container.java:98) ~[Container.class:?]
at net.minecraft.entity.player.EntityPlayerMP.onUpdate(EntityPlayerMP.java:263) ~[EntityPlayerMP.class:?]
at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2031) ~[World.class:?]
at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:758) ~[WorldServer.class:?]
at net.minecraft.world.World.updateEntity(World.java:1997) ~[World.class:?]
at net.minecraft.world.World.updateEntities(World.java:1823) ~[World.class:?]
at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:587) ~[WorldServer.class:?]
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:775) ~[MinecraftServer.class:?]
... 4 more
[23:53:44] [server thread/ERROR]: This crash report has been saved to: C:\Users\jimia\Documents\Minecraft Mods\NewGUI\run\.\crash-reports\crash-2015-10-04_23.53.44-server.txt
[23:53:44] [server thread/INFO]: Stopping server
[23:53:44] [server thread/INFO]: Saving players
[23:53:44] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:663]: ---- Minecraft Crash Report ----
// I blame Dinnerbone.

Time: 04/10/15 23.53
Description: Ticking entity

java.lang.IndexOutOfBoundsException: Index: 46, Size: 46
at java.util.ArrayList.rangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at net.minecraft.inventory.Container.detectAndSendChanges(Container.java:98)
at net.minecraft.entity.player.EntityPlayerMP.onUpdate(EntityPlayerMP.java:263)
at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2031)
at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:758)
at net.minecraft.world.World.updateEntity(World.java:1997)
at net.minecraft.world.World.updateEntities(World.java:1823)
at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:587)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:775)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:669)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:171)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:540)
at java.lang.Thread.run(Unknown Source)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Stacktrace:
at java.util.ArrayList.rangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at net.minecraft.inventory.Container.detectAndSendChanges(Container.java:98)
at net.minecraft.entity.player.EntityPlayerMP.onUpdate(EntityPlayerMP.java:263)
at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2031)
at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:758)
at net.minecraft.world.World.updateEntity(World.java:1997)

-- Entity being ticked --
Details:
Entity Type: null (net.minecraft.entity.player.EntityPlayerMP)
Entity ID: 142
Entity Name: Player796
Entity's Exact location: 881,61, 5,00, 1215,05
Entity's Block location: 881,00,5,00,1215,00 - World: (881,5,1215), Chunk: (at 1,0,15 in 55,75; contains blocks 880,0,1200 to 895,255,1215), Region: (1,2; contains chunks 32,64 to 63,95, blocks 512,0,1024 to 1023,255,1535)
Entity's Momentum: 0,00, -0,08, 0,00
Entity's Rider: ~~ERROR~~ NullPointerException: null
Entity's Vehicle: ~~ERROR~~ NullPointerException: null
Stacktrace:
at net.minecraft.world.World.updateEntities(World.java:1823)
at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:587)

-- Affected level --
Details:
Level name: New World
All players: 1 total; [EntityPlayerMP['Player796'/142, l='New World', x=881,61, y=5,00, z=1215,05]]
Chunk stats: ServerChunkCache: 707 Drop: 0
Level seed: 2632965430761002026
Level generator: ID 01 - flat, ver 0. Features enabled: true
Level generator options: 
Level spawn location: 889,00,4,00,1221,00 - World: (889,4,1221), Chunk: (at 9,0,5 in 55,76; contains blocks 880,0,1216 to 895,255,1231), Region: (1,2; contains chunks 32,64 to 63,95, blocks 512,0,1024 to 1023,255,1535)
Level time: 5598 game time, 5598 day time
Level dimension: 0
Level storage version: 0x04ABD - Anvil
Level weather: Rain time: 28257 (now: false), thunder time: 72580 (now: false)
Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true
Stacktrace:
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:775)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:669)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:171)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:540)
at java.lang.Thread.run(Unknown Source)

-- System Details --
Details:
Minecraft Version: 1.8
Operating System: Windows 10 (amd64) version 10.0
Java Version: 1.8.0_60, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 253236464 bytes (241 MB) / 661127168 bytes (630 MB) up to 1398276096 bytes (1333 MB)
JVM Flags: 0 total; 
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v9.10 FML v8.0.99.99 Minecraft Forge 11.14.3.1516 4 mods loaded, 4 mods active
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
UCHIJAAAA	mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) 
UCHIJAAAA	FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.8-11.14.3.1516.jar) 
UCHIJAAAA	Forge{11.14.3.1516} [Minecraft Forge] (forgeSrc-1.8-11.14.3.1516.jar) 
UCHIJAAAA	newgui{1.0} [newgui] (bin) 
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['Player796'/142, l='New World', x=881,61, y=5,00, z=1215,05]]
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'fml,forge'
[23:53:44] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:663]: #@!@# Game crashed! Crash report saved to: #@!@# .\crash-reports\crash-2015-10-04_23.53.44-server.txt

 

it's always the problem of the indexOutOfBounds :( Also the EntityPlayerMP is null, why? :/

Don't blame me if i always ask for your help. I just want to learn to be better :)

Posted

You're still indexing a 0..45 array with index=46. It's time for you to set a break point (or four) and run your code in debug mode. The firat thing you must figure out is why the array has only 46 elements when you thought you added 4. You thought you had 50 slots, so where did that array come from that it has only 46?

 

Put your debug hat on and do some sleuthing!

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Posted

I will do more debug now that it doesn't crash ;) Thanks diesieben :) I've still the IndexOutOfBounds error :( I've update the github repository with the new code :)

Don't blame me if i always ask for your help. I just want to learn to be better :)

Posted

If i could kiss you i will do xD The GUI finally works and doesn't crash or gives some error :D Now i will find how to give the new slot a proper shift-click function :) Thank you soooooooo much diesieben :D Finally it has solved :D

Don't blame me if i always ask for your help. I just want to learn to be better :)

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

×
×
  • Create New...

Important Information

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