Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.