Posted November 20, 201212 yr For a server-side mod that makes some chunks private. When a player enters a chunk he/she receives a message if that chunk is already claimed. I now use a class that implements 'IScheduledTickHandler' that every 5 ticks checks the coordinates of all the players to see if they moved to another chunk. This works, but I would guess that using an event would be less demanding on the server. I tried it with 'EntityEvent.EnteringChunk', but that is called with non-player entities as well. I couldn't find out if it was a mob or a player that was causing the event to be called. I couldn't find if something exists like -PlayerEvent.EnteringChunk-. Thank you.
November 20, 201212 yr You can use EntityEvent.EnteringChunk just fine. Just make sure your entity is instanceof EntityPlayer like: if(event.entity instanceof EntityPlayer) { // YOUR CODE } Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! | mah twitter This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.
November 21, 201212 yr Are events such as EnteringChunk documented somewhere? They don't seem to have been added to the wiki yet. Just wondering if it's documented elsewhere or if I'll have to browse source to get info on it.
November 25, 201212 yr Author There is some information in the javadoc online: http://jd.minecraftforge.net/ downloads: http://files.minecraftforge.net/ I think it has most or all classed documented, but there are no examples or anything. For me it's often hard to find out how to use it, but I'm just starting to make mods.
November 25, 201212 yr Author You can use EntityEvent.EnteringChunk just fine. Just make sure your entity is instanceof EntityPlayerThank you. I'll keep using my old method for now, because EntityEvent.EnteringChunk is called so often with mobs moving.
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.