Looking for a plugin that regenerates trees and leaves after a certain amount of time (a Minecraft day perhaps) Any recommendations are highly appreciated, thank you
A easy way to do this would be something like calling a Block Break event, check if the block in the event is a leaf block, start. start a timer and have it respawn…
I can’t guarantee performance on that when it gets to larger numbers though <.<
Edit: I got bored so I thought I would try it… in about 20 minutes I have code that can filter out leaves, so tomorrow Ill add some code to add a countdown timer to place a leaf block back… or maybe just copy the snapshot? Haven’t decided yet.
You can call
restore() on snapshots. As for a timer, you could just delay a task, though that wouldn’t persist across restarts.
Regenerates Naturally Generated Trees after 1 in game day. (The decay event seems a bit bugged at the moment, but Ill tinker with it some more a bit later)
Edit: Updated source code and release as per suggestion from pie (below)
Just a comment - it’s recommended to match against abstract values such as
ItemTypes.LOG instead of calling
getId and matching against an id such as
"minecraft:log" since not only is it implementation-defined, but it’s also possible to make mistakes, whereas the former is compiler-checked.
Curious, will this embed trees in peoples houses?
As in, regenerate the tree when it’s been cut down and replaced with brick?
There is a check in the code to make sure the block is air before setting it to leaf/log.