sieg Posted August 9, 2016 Share Posted August 9, 2016 Hey guys. When a chunk loads, I'm trying to save information about that chunk to a file. However, the event I'm listening to is the ChunkEvent.load event. When my code is executed upon handling the event, I believe the chunk data has not been initialized yet? So it caused the NullPointerException. At least this is my theory. Is there any way to execute my code directly after the chunk has finished loading? What I have now public class MapEvents { @SubscribeEvent public void Load(ChunkEvent event) { .... for(int i = 0; i < 1; i++){ ExtendedBlockStorage section = chunkStorage[0]; //causes NullPointerException, presumably because chunk data has not been fully loaded System.out.print(section.getYLocation()); } } } Quote Link to comment Share on other sites More sharing options...
Animefan8888 Posted August 9, 2016 Share Posted August 9, 2016 You want ChunkEvent.Load Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator. Link to comment Share on other sites More sharing options...
sieg Posted August 9, 2016 Author Share Posted August 9, 2016 You want ChunkEvent.Load Why is the ChunkEvent.load event called around 2,000 times when I join the game? There seriously can't be that many chunks, right? Quote Link to comment Share on other sites More sharing options...
Animefan8888 Posted August 9, 2016 Share Posted August 9, 2016 I couldn't tell you... Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator. Link to comment Share on other sites More sharing options...
Recommended Posts
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.