Skip to content

Usercontent JavaScript API

Marcel Konrad edited this page Dec 2, 2021 · 5 revisions

The JavaScript interpreter comes with an instance of UsercontentAPI available for reference with api

Example: api.addChatMessage("Hello World")

Function Description
String getValue(String id) Returns the value stored by a button or menu with id id. Otherwise null.
String setValue(String id, String value) Sets the value with id id to value
String getArgument(String command, String index) Returns value of argument argument of command command. Otherwise null.
void setArgument(String command, String argument, String value) Sets the value of argument argument of command command to value value
void addChatMessage(Object object) Prints the object to the ingame chat

ActionHelper

Example:

var ActionHelper = Java.type('exopandora.worldhandler.util.ActionHelper');
ActionHelper.displayGui();
Function Description
void backToGame() Closes the GUI
void open(String id) Tries to open the content with id id
void timeDawn() Sets the time to dawn
void timeNoon() Sets the time to noon
void timeSunset() Sets the time to sunset
void timeMidnight() Sets the time to midnight
void setDayTime(int time) Sets the time to time
void weatherClear() Sets the weather to clear
void weatherRain() Sets the weather to rain
void weatherThunder() Sets the weather to thunder
void difficultyPeaceful() Sets the difficulty to peaceful
void difficultyEasy() Sets the difficulty to easy
void difficultyNormal() Sets the difficulty to normal
void difficultyHard() Sets the difficulty to hard
void gamemodeSurvival() Sets the gamemode to survival
void gamemodeCreative() Sets the gamemode to creative
void gamemodeAdventure() Sets the gamemode to adventure
void gamemodeSpectator() Sets the gamemode to spectator
void displayGui() Tries to open the World Handler GUI (same as pressing the activation button)

Clone this wiki locally