Posted August 9, 20169 yr 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()); } } }
August 9, 20169 yr You want ChunkEvent.Load 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.
August 9, 20169 yr Author 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?
August 9, 20169 yr I couldn't tell you... 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.
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.