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've been working on creating a SSP block that turns on / off much like the Redstone Lamp but without the need for redstone.

 

I'm curious though because if I place one down and turn it on and then log out, when I log back in it isn't glowing unless I toggle the switch again.

 

I incorrectly assumed that onBlockAdded() fired both when you placed the block and when the world was loaded. I looked at the various redstone*.java files but wasn't quite sure how it saves state from session to session.

 

Any advice (examples or things I can read) as to how you tell the world when it loads that block XYZ should be lit?

 

Thanks!

 

  • Author

I've been working on creating a SSP block that turns on / off much like the Redstone Lamp but without the need for redstone.

 

I'm curious though because if I place one down and turn it on and then log out, when I log back in it isn't glowing unless I toggle the switch again.

 

I incorrectly assumed that onBlockAdded() fired both when you placed the block and when the world was loaded. I looked at the various redstone*.java files but wasn't quite sure how it saves state from session to session.

 

Any advice (examples or things I can read) as to how you tell the world when it loads that block XYZ should be lit?

 

Thanks!

 

  • Author

Well, I figured it out so I'll post here in case any other newcomers get stuck...

 

There were actually two things I was doing wrong:

 

1. I commented out my scheduleBlockUpdate() inside onBlockAdded()

 

This is required to schedule the block for updates after logging out / in. Part of the data saved with the world is the tickRate for the block and when it's next scheduled

 

2. Existing blocks don't get updated after making changes

 

I made the code changes but the blocks that were already in the world needed to be destroyed and replaced. I should've realized this earlier but hey, it's late and I'm tired.

  • Author

Well, I figured it out so I'll post here in case any other newcomers get stuck...

 

There were actually two things I was doing wrong:

 

1. I commented out my scheduleBlockUpdate() inside onBlockAdded()

 

This is required to schedule the block for updates after logging out / in. Part of the data saved with the world is the tickRate for the block and when it's next scheduled

 

2. Existing blocks don't get updated after making changes

 

I made the code changes but the blocks that were already in the world needed to be destroyed and replaced. I should've realized this earlier but hey, it's late and I'm tired.

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.