Is it possible to create a custom ore and add it to world generation with a Datapack?



  • As the title suggests, I am wanting to add custom ores to the game (I.E. new gemstones like ruby, sapphire, topaz, etc), but I have no clue how to control world generation to add such a thing. I tried searching for how to add an ore but all I found was I would need to replace blocks like granite and diorite, which I will accept as the only option but I would prefer not to. I am aiming to edit as few game mechanics as possible, thus meaning I cannot replace any existing vanilla ores or stones because that could reduce abundancy or the resource itself. Ideally, I would like to avoid the usage of any kind of Spigot plugins but I will use them if that means I can do what I am attempting to achieve.

    My Minecraft version is 1.18.x



  • This is a very complex method, but if you are not using plugins or mods, this is probably one of few ways.

    Part 1:

    one thing you can try is to have some kind of tagged entity (usually invisible armorstands) get randomly teleported around the world (spreadplayers), and then set their y coordinate to where you want your ores to spawn in the ground. the next part is generating the ore vein or single ore block at where they are (player heads are good for custom blocks but do not take up a full block space).

    Part 2:

    now that you have the ore blocks set, you need a way to detect if they are broken. you can leave the armor stands and check constantly if the block they are standing at is broken, if so: delete the normally dropped item, spawn your custom item, and kill the armor stand.

    This is very difficult to implement, but these instructions should help.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2