Jump to content

1.19.3 Detecting if a block is powered by redstone


Adixe

Recommended Posts

Hello, I have a problem. I have created a class representing my block that extends the Block class. I want to implement lamp-like behavior: the block can be powered or not. I want to detect this change somehow. Unfortunately, after a long time of searching, I couldn't find a solution. On the Internet I found the use of various methods from the BlockBehaviour class, but most of them are deprecated, e.g. use, neighborChanged, getSignal, etc. Is there any substitute for such methods? I will be grateful for your help!

Link to comment
Share on other sites

On 2/11/2023 at 8:49 AM, Adixe said:

Hello, I have a problem. I have created a class representing my block that extends the Block class. I want to implement lamp-like behavior: the block can be powered or not. I want to detect this change somehow. Unfortunately, after a long time of searching, I couldn't find a solution. On the Internet I found the use of various methods from the BlockBehaviour class, but most of them are deprecated, e.g. use, neighborChanged, getSignal, etc. Is there any substitute for such methods? I will be grateful for your help!

Look at the minecraft code? Specifically, the RedstoneLampBlock since that is doing exactly what you want.

Link to comment
Share on other sites

7 minutes ago, ChampionAsh5357 said:

Look at the minecraft code? Specifically, the RedstoneLampBlock since that is doing exactly what you want.

Oh, thanks! I hadn't thought of such a solution. Indeed, I found everything I need. Next time I'll just look at a similar block.

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.



×
×
  • Create New...

Important Information

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