Skip to content

Mysterious Box

Skyler James edited this page Aug 15, 2021 · 1 revision

Introduction

Opening a mysterious box in-game results in a random .mcfunction file being chosen and executed. Users can use datapacks to add their own functions to the pool of functions. The .mcfunction file must be saved at data/greekfantasy/functions/mysterious_box/functionname.json

What is .mcfunction?

Files with this extension are treated as a set of commands to run in-game. Each command goes on a separate line without the /. Comments can be added by prefixing a line with #. See the wiki for more information on .mcfunction files.

What do @ and ~ do?

For a mysterious box function, the @p indicates the player who opened the box and ~ ~ ~ for x y z indicates the xyz coordinates of the box. If you have other questions, please do not ask me because I hardly know anything about commands.

Example

Here is a full example of a valid mysterious box function file, this one located at data/greekfantasy/functions/mysterious_box/instant_death.mcfunction

# This function instantly kills the player and spawns diamonds at the location of the box
summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:diamond",Count:50}}
kill @p

If you have ideas for mysterious box functions that should be included in the mod, please open an issue or pull request, preferably with the commands already written out because I don't know how to use anything more complicated than /give T.T