Posted December 29, 201410 yr Is it possible to find out the player that caused a ChunkEvent.Load event? The only solution I've thought of so far is to register a tick handler or scheduled handler that gets the closest player for each recently loaded chunk. I'm curious if there's a better way to do it.
December 29, 201410 yr Author I want to reward players for exploration. I'll be keeping track of what chunks have previously been loaded at some point so ultimately I'm trying to work out the best way of deciding who should be rewarded for the loading of a previously 'unseen' chunk.
December 29, 201410 yr On chunk load: read from chunk NBT if the chunk has never been loaded: find nearest player within (16 * chunkload radius) save this to the chunk NBT Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
December 30, 201410 yr Author Thanks. So I can get the chunk NBT by subscribing to ChunkDataEvent.Load, however this seems to be triggered all the time, even if a player isn't moving. And I can't see a way to get the NBT directly from a Chunk object. So my thinking is this: - Store the chunk load player info separately (in WorldSavedData or something else) - On ChunkEvent.Load, check to see whether it's been loaded before - If not, find nearest player to the chunk with and save them. Thanks for the help.
December 30, 201410 yr @SubscribeEvent public void chunkLoad(ChunkDataEvent.Load event) { NBTTagCompound nbt = event.getData(); } Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
December 30, 201410 yr Author I know, I've already tested that. As I mentioned above it gets triggered way too often, not just on a chunk load and even periodically when the player is doing absolutely nothing. So making use of ChunkEvent.Load and storing the data myself should be more efficient.
December 30, 201410 yr That's because "save" and "load" events have nothing to do with where the player is or what they're doing. That's ChunkEvent.Load and ChunkEvent.Unload , but those events don't give you access to the chunk NBT data. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
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.