Dynamic Trees

Dynamic Trees

25M Downloads

[Compatibility] Chopdown Updated

Shovinus opened this issue · 10 comments

commented

A few people now have asked me to make my mod work with your trees to let the trees fall over.

Unfortunately as you handle the collapse of the tree before my mod can interrupt this is not so easy, also I am guessing there are a reasons you handle the trees collapse.

Could you have a look to see if there is a better solution than just me overriding your collapse method?

Curse page: https://minecraft.curseforge.com/projects/chop-down-updated

commented

Ahh I handle it differently because the whole point was to stop easy harvesting of trees like vein miner chopper mods do, instead just making it as immersive as possible, so you don't get any drops, the logs just fall to the ground, also deals with the issue of climbing large trees.

commented

Yeah. I get why your mod operates as it does. It's probably the best idea for that paradigm. I have to take a different approach for obvious reasons.

commented
commented

The problem is that Dynamic Trees does a summation of the wood volume for the entire tree(or cut off portion) to quantify the number of logs needed for the drop. Also, the nodes of the tree must not come into contact with nodes from other trees. So if you were to reassemble the tree sideways on the ground with all of its nodes being the right size and position without touching other trees you're going to have a hell of a time. The best I could offer is to have a method to pass along the number of resulting logs to you somehow and you could make the horizontal falling trunk stack you use. I caution that it would look weird though.

commented

Here's how I would do it if I were you..
Dynamic Trees will send out a fireBlockHarvesting event on harvest. This can be seen in com.ferreusveritas.dynamictrees.blocks.BlockBranch.java #removedByPlayer(...) line 315.
Simply subscribe to this event. If the event's blockstate is an instanceof DynamicTrees's BlockBranch then count and remove the log items in the list of itemStacks from the event and use the count to build your trunk made of falling log blocks. You can determine the fall direction by the player position and the block position in the event.

If you do it properly then you won't need to include a hard dependency for dynamic trees and you won't have to break my mod in the process.

commented

Having the trees fall over is on my todo list. I highly recommend letting me implement it and letting those few people know that I will implement it on my side. Thanks!

commented

Sweet, the code I use is available on the git, if you want to view. Though as you have access to the actual tree shape you can probably implement a bit more defined method.
https://github.com/Shovinus/ChopDownUpdated

commented

My plan is to capture the tree shape at the harvest event and make an entity from the data. Then simply animate the entity falling over. Once it hits the ground it will drop it's goodies and remove itself from the world.

commented

I will have to check that out, thank you,it is a hard problem to get around, maybe if I convert the blocked to a felled version and subsequent breaks return logs or sticks merely base on the size, i.e. above x drop a log, or else drop a stick or 2.
Which if you were actually chopping a tree is probably close, possibly smaller ones could actually just drop planks or "smaller logs" which create less planks per craft.

commented

That's all fine and everything but it's a lot of complicated potentially bug prone craziness and a lot of work. My suggestion could be done in about 20 minutes, with about 15 lines of code, wouldn't involve special blocks, would be more compatible and it would work just like the users of your mod expect and then you can move on to other things. Eventually I'll make my trees fall anyway and you'll likely be disabling all the work you did. At least implement my suggestion and decide later if you want to dig your own grave. :)