Posted April 16, 201312 yr 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!
April 16, 201312 yr 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!
April 16, 201312 yr 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.
April 16, 201312 yr 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.