Jump to content

[SOLVED][1.15.2] Few clicks on a block before doing something


Recommended Posts

Posted (edited)

Hi,

I think it's a quick and simple question, but I want to know what's the best way to do it,

I want do create a block, on which you need to click 3 times with an item before converting it into different block,

where do I store the amount of clicks I have already clicked? Do I create a tile entity and store it there (if yes, how do I do it?) , or should I store it as one of the states of the block?

Cheers 

Edited by Corgam
Posted
10 hours ago, Corgam said:

Hi,

I think it's a quick and simple question, but I want to know what's the best way to do it,

I want do create a block, on which you need to click 3 times with an item before converting it into different block,

where do I store the amount of clicks I have already clicked? Do I create a tile entity and store it there (if yes, how do I do it?) , or should I store it as one of the states of the block?

Cheers 

You can do it in both ways, but I'll say block state if that's the only thing you want to do.

  • Like 1
Posted

What if I want to have a random amout of clicks needed for a block to change? 

To give some context, I want to create a chisable block, that you need to click 3-5 times with chisel, before it converts to chiseled version of it.

Posted

 

2 hours ago, diesieben07 said:

Make a block state property for your block that holds an int from 0-5. When placing the block set this value to a random number between 3-5. When clicked with a chisel, decrement the number and only chisel when it reaches 0.

 

I did exactly what you wrote. Everything works as I wanted. Thanks!

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.