Jump to content

[1.8] [SOLVED] NullPointerException when opening custom GUI


JimiIT92

Recommended Posts

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 :)

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 :)

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
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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • They were already updated, and just to double check I even did a cleanup and fresh update from that same page. I'm quite sure drivers are not the problem here. 
    • i tried downloading the drivers but it says no AMD graphics hardware has been detected    
    • Update your AMD/ATI drivers - get the drivers from their website - do not update via system  
    • As the title says i keep on crashing on forge 1.20.1 even without any mods downloaded, i have the latest drivers (nvidia) and vanilla minecraft works perfectly fine for me logs: https://pastebin.com/5UR01yG9
    • Hello everyone, I'm making this post to seek help for my modded block, It's a special block called FrozenBlock supposed to take the place of an old block, then after a set amount of ticks, it's supposed to revert its Block State, Entity, data... to the old block like this :  The problem I have is that the system breaks when handling multi blocks (I tried some fix but none of them worked) :  The bug I have identified is that the function "setOldBlockFields" in the item's "setFrozenBlock" function gets called once for the 1st block of multiblock getting frozen (as it should), but gets called a second time BEFORE creating the first FrozenBlock with the data of the 1st block, hence giving the same data to the two FrozenBlock :   Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=head] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@73681674 BlockEntityData : id:"minecraft:bed",x:3,y:-60,z:-6} Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=3, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=2, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} here is the code inside my custom "freeze" item :    @Override     public @NotNull InteractionResult useOn(@NotNull UseOnContext pContext) {         if (!pContext.getLevel().isClientSide() && pContext.getHand() == InteractionHand.MAIN_HAND) {             BlockPos blockPos = pContext.getClickedPos();             BlockPos secondBlockPos = getMultiblockPos(blockPos, pContext.getLevel().getBlockState(blockPos));             if (secondBlockPos != null) {                 createFrozenBlock(pContext, secondBlockPos);             }             createFrozenBlock(pContext, blockPos);             return InteractionResult.SUCCESS;         }         return super.useOn(pContext);     }     public static void createFrozenBlock(UseOnContext pContext, BlockPos blockPos) {         BlockState oldState = pContext.getLevel().getBlockState(blockPos);         BlockEntity oldBlockEntity = oldState.hasBlockEntity() ? pContext.getLevel().getBlockEntity(blockPos) : null;         CompoundTag oldBlockEntityData = oldState.hasBlockEntity() ? oldBlockEntity.serializeNBT() : null;         if (oldBlockEntity != null) {             pContext.getLevel().removeBlockEntity(blockPos);         }         BlockState FrozenBlock = setFrozenBlock(oldState, oldBlockEntity, oldBlockEntityData);         pContext.getLevel().setBlockAndUpdate(blockPos, FrozenBlock);     }     public static BlockState setFrozenBlock(BlockState blockState, @Nullable BlockEntity blockEntity, @Nullable CompoundTag blockEntityData) {         BlockState FrozenBlock = BlockRegister.FROZEN_BLOCK.get().defaultBlockState();         ((FrozenBlock) FrozenBlock.getBlock()).setOldBlockFields(blockState, blockEntity, blockEntityData);         return FrozenBlock;     }  
  • Topics

×
×
  • Create New...

Important Information

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