Make a feature spawn like near where the player spawns (Like bonus chests)

Started by Terminnus on

Topic category: Help with Minecraft modding (Java Edition)

Joined Sep 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Make a feature spawn like near where the player spawns (Like bonus chests)
Wed, 09/25/2024 - 02:32 (edited)

I'm making a mod that adds crates to the game, a block that gives you some loot when you destroy it, I want to add a feature that generates 4 basic crates near where the player spawns (much like the bonus chest), Is there any way to do that?, thanks!

PD: sorry for my English, I'm not a native

Edited by Terminnus on Wed, 09/25/2024 - 02:32
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You can make a feature. On…
Thu, 09/26/2024 - 00:43

You can make a feature. On additional generation condition get world spawn coordinates and return false if x y z of feature placement is further than 10 or so blocks in any direction. Then make a variable that is false and only allows the feature to spawn when it is false. On player joins world set the variable to true. Also set the generation to the latest it can be. Hopefully that would make it only spawn once. With this method though I guess theres a chance the crate might not spawn at all. Idk try it out and see if it works.