FallingTree

FallingTree

28M Downloads

Falling Animations Of Trees

Rajbir98 opened this issue ยท 7 comments

commented

Describe the feature

Falling Animations Of Trees like Chop Down Updated its a forge mod

Link Of Mod: https://www.curseforge.com/minecraft/mc-mods/chop-down-updated

commented

Sorry for the delay.

I don't really see how this would be done though. As when you break the tree everything instantly breaks there's no interest into making it fall to the floor.

If what you want is to basically make the trees fall on the ground instead of being destroyed I think there is already a fabric mod that also does this. https://www.curseforge.com/minecraft/mc-mods/trees-do-not-float

commented

Another simpler animation idea: break blocks in sequence instead of instant break of whole tree

commented

As I stated on another issue, I think it's an over extension of an already simple and useful mod.

commented

Another simpler animation idea: break blocks in sequence instead of instant break of whole tree

I also had this idea. Having logs break one by one or in a spreading cube would be awesome. This way of animating things also leaves a certain "vanilla" feel to it, which I believe would be appreciated by many.

commented

For sure. It's been open for a while not because I don't want it but more because I don't really know a good way to do this.

As it is it'd need quite some changes to be able to handle that. But that's doable. It's just that as always I kinda ask myself questions on some "edge cases". Like "what if the tree is cut twice" (like the tree is cut again before the animation finishes). "What if a block changes while the animation is ongoing".
I kinda have to experiment with all that. But maybe if I can add random attributes to a block it could be a solution.

commented

I think it's worth if you make another mod for that, honestly yours "as is" is great.

commented

What if the tree is cut twice?
What if a block changes while the animation is ongoing?

That can be solved by having a queue of blocks that you are animating through. Since a queue is by definition a list, if you break another block, you can check whether or not it's present in the queue and, if it is in it, simply remove it from the queue. Deleting by coordinates alone might suffice. It also covers the case of block state change (for example, if a leaf with flowers just so happens to blossom during the animation).

There is, however, another edge case: what if somehow the block transitions from "choppable" to "unchoppable" during the animation. Silly example: from leaf to stone. Maybe the place was WorldEdit'ed in a really unfortunate time. That is resolvable by making sure that the block you're trying to destroy is in the mod's scope (Allowlist) at the moment of attempted destruction.

In a case of an exceptionally large tree that spans thousands of blocks, you can simply limit the amount of blocks to be impacted during an animation tick to 16 or something. And the order is already established with the queue that was created during a breadth-first search.

That might be a separate mod, true. But that would duplicate quite a bit of code and do a lot of calculations twice. To me that seems wasteful. Remember: people have slow PCs and/or loads of mods loaded, so every little bit of optimisation helps.