Jump to content

Recommended Posts

Posted (edited)

I am creating a block with a tile entity that will spawn a specific enemy after a random amount of time (currently I have it hardcoded to make it easier to debug). A dilemma I had was that since I randomed on both the client and the server there would be two different timers for each side. I tried to solve this by checking if !world.isRemote, but doing this resulted in this being posted in the log whenever I rejoin a world, and the countdown doesn't resume.

 

Another problem is that once the countdown finishes the mob I want to spawn simply doesn't spawn. No crash, no log output, nothing, as if I didn't try and spawn the mob at all. He does spawn if I use a spawn egg however.

 

TileEntity

Where I register it (I call registerTileEntities from preInit from my main mod class)

 

EDIT: I found a partial solution. Rather than checking if the world is on the server or not, I am instead sending a packet which syncs the server time with the client. Now my mob spawns! Hooray! Except for I reload the world.

 

If the block is still counting down, then it will stop counting down when I rejoin.

If the block has counted down and spawned the mob it will dissapear when I rejoin, and will not count down.

In both cases this is a part of what it outputs in the log.

 

Updated Tile Entity

Edited by That_Martin_Guy

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.