Create a natural disaster - 2mal3/Natural-Disaster-Datapack GitHub Wiki

You can also add new natural disasters of your own, which will then be automatically added to the random pot of natural disasters.
If you need any inspiration, here is an example of a complete natural disaster.

Register

First, you must register the natural disaster so that it has a chance of being selected. To do this, you need to call the commands

scoreboard players add %natural_disasters nadi.data 1
data modify storage 2mal3:nadi natural_disasters append value "<start functioin>"

from the function tag 2mal3:nadi/api/register/natural_disasters. In the commands you have to replace <start function> with the function command that should start your natural disaster.

Start function

In the start function only the command

scoreboard players set %natural_disaster_on nadi.data 1

is required, the rest is up to you. The only other condition is that your natural disaster must end at some point and then execute the stop function.

Stop function

In the stop function I recommend you to undo all the changes made by your natural disaster. You must also run the following commands at the end of the function.

scoreboard players set %natural_disaster_on nadi.data 0
function 2mal3:nadi/new_time