Jump to content

Buffing a block?


ianc1215

Recommended Posts

I was wondering if is possible to assign an expiring value to a block. Basically I am looking for a way to buff a block with an effect that would drop off like a buff on a player. Maybe have the buff last for 20000 ticks then stop.

 

Is this even possible, if so where can I look or how could begin with such?

“Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program.” - Linus Torvalds

Link to comment
Share on other sites

Good evening,

 

It generally depends on wether this is a block that's only appearing once or twice in a world or is plentiful like a block of dirt.

In case of the first you can simply use a tile entity, set a variable to the desired number of ticks, save them with nbt,

and under updateEntity() simply diminish the variable. As for the effect, I suggest looking up a decent tutorial on potions.

 

Greetings,

Black

Link to comment
Share on other sites

Well the block would be grown like a wheat crop. Basically I am looking to make it so I can water a plant and have a buff applied to the plant. But then have the buff effect wear off after so much time has elapsed.

 

My original idea involved using a TileEntity to store NBT data about the attributes on the block. But if I was to do this how would I make the buff expire?

 

Also is there a better way to do it?

“Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program.” - Linus Torvalds

Link to comment
Share on other sites

Well, a plant itself has a updatetick() method which you can override to let it grow.

However I believe it to be quite a hassle to store your data without an nbt tag.

I'm to inexperienced to really tell you what the best method is but to me it seems making it a tile entity is the best way to go.

And I explained you allready that a tileentity has a UpdateEntity() method that ticks every 1/20th of a second.

So you can simply use that to diminish your counter.

Or you could use the UpdateTick() method from the plant itself and set the value you want to diminish to 16 and simply count down with that.

It's much simpeler and friendlier than a TileEntity.

And if it needs to be longer you can always declare a temporary variable and

everytime the method ticks diminish the temporary variable, and if that one reaches a certain treshold diminish your metadata.

Quite a lot of ways to do this really.

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.

Announcements



×
×
  • Create New...

Important Information

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