How to have entity spawn in tree??

Started by modbroz on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jun 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to have entity spawn in tree??
Fri, 07/11/2025 - 15:08 (edited)

How do I have my entity spawn inside trees?

Edited by modbroz on Fri, 07/11/2025 - 15:08
Joined Apr 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
If the tree is a feature…
Fri, 07/11/2025 - 15:10

If the tree is a feature that places an nbt structure, you can save the nbt structure of the tree with the entity inside of it an include entities set to true. Otherwise you would need to make a custom spawning condition that checks for the log of your tree. To avoid players building trees you could have a blockstate for the log that defaults to true, but is set to false if the block is placed by a player, and the entity can only spawn if the blockstate is true. However, the first option is probably the easier one.