I'm trying to find the position of nearby trees. Can I get a list of nearby trees with a command like entityQuery? I've tried entityQuery and objectQuery and they don't show up in the list.
The thing is that trees aren't entities they are almost considerated as blocks, the rule of thumbs to know if you can use a command to query for entities is if it has something around it when you do /debug it will pick it up in a world.entityQuery call since it just an entity query that isn't filtered in any way Sent from my SM-T350 using Tapatalk
OK, so they aren't entities and won't be picked up by entityQuery. They do show up with the boxes command, but I can't get info on them with world.material either. Is there any way to get info on the trees?
I haven't gone far enough into the LUA API to answer that but my best guess is maybe but most likely not
ok so i've done a bit of research on my own and found out something, while it isn't possible to detect only trees, you can detect all plants to do so just use this code Code: for _,EntityId in pairs(world.entityQuery([InsertSearchLocationHere], [insertSearchRadiusHere])) do if world.entityType(EntityId) == "plant" then --do stuff end end
Thanks! That gets me the list of IDs. I don't suppose there's any way of getting info about their item drops?
Though you could get the position with world.entityPosition and destroy the block at the position by using world.damageTiles or something like that
yeah, I was able to 'chop' down all the trees with world.damageTiles({world.entityPosition(EntityId)},"foreground",position,"plantish",200) I need to make a short video with the exploding trees set to the 1812 overture, but that's just bonus. I'm trying to set up some NPC tenants to automate some tasks and I was hoping to set one up to gather lumber. To simplify the automation when the player is gone I would rather spawn the appropriate amount of logs. However, some trees spawn different types of logs, so I'm trying to get info about the trees that would have been harvested.