Jump to content

Threading and World members.


JB

Recommended Posts

The mod will be changing the player's sleep behavior and I can do most magic using Forge. There's however code in the EntityPlayer.onUpdate() that needs to be disabled. Now hacking away in the pre-tick I can change the World.skylightSubtracted to force isDaytime() to return false and restore it in the post-tick.

 

I just don't know enough about MineCraft to go and do something like that. Are there multiple threads that might want to access the World.skylightSubtracted? I'm pretty sure there would be, or at least there should be. I've read before that minecraft it's not multi-threaded which should make the skylightSubtracted 'hack' safe.

 

Any input welcome before I break something.

 

 

if (!this.worldObj.isRemote)
{
    if (!this.isInBed())
    {
        this.wakeUpPlayer(true, true, false);
    }
    // else if (this.worldObj.isDaytime()) <---- this code
    // {
    // this.wakeUpPlayer(false, true, true);
    // }

I'm back playing!

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



×
×
  • Create New...

Important Information

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