World Functions - JsMacros/JsMacros GitHub Wiki
these functions return values using helper classes as wrappers, this allows for more direct access to the underlying data. see this for more info. the world functions are:
getLoadedPlayers()
Example: world.getLoadedPlayers();
Returns an ArrayList of PlayerEntityHelpers representing the players within the player's render distance.
getPlayers()
Example: world.getPlayers();
Returns an ArrayList of PlayerListEntryHelpers representing all the players on the server.
getBlock(int, int, int)
Example: world.getBlock(0, 50, 0);
Returns a BlockDataHelper showing information about the block.
getEntities()
Example: world.getEntities();
Returns an ArrayList of EntityHelpers representing every entity within the player's render distance.
getDimension() 1.1.2+
Example: world.getDimension();
returns a string dimension id.
getSkyLight(Int, Int, Int) 1.1.2+
Example: world.getSkyLight(x, y, z)
returns sky light level of block
getBlockLight(Int, Int, Int) 1.1.2+
Example: world.getBlockLight(x, y, z)
returns block light level of block
getBiome() 1.1.5+
Example: world.getBiome();
returns the current biome.
getTime() 1.1.5+
Example: world.getTime();
returns the current time.
getTimeOfDay() 1.1.5+
Example: world.getTimeOfDay();
returns the current time of day.
playSound(String, float, float, double, double, double) 1.1.7+
*Example: world.playSound("block.anvil.use", volume, pitch, x, y, z);
x,y,z
are an optional set of variables.
volume
and pitch
are also seperately optional
playSoundFile(String, double) 1.1.7+
Example: world.playSound(path_from_macroFolder, volume)
getBossBars() 1.2.1+
Example: world.getBossBars()
returns a Map<String, BossBarHelper>
for the boss bars.
isChunkLoaded(Int, Int) 1.2.2+
Example: world.isChunkLoaded(chunkX, chunkZ)
for chunkX/chunkZ use the chunk coords (aka block coords >> 4
)
getCurrentServerAddress() 1.2.2+
Example: world.getCurrentServerAddress()
returns a string representation of the current server's address.
getBiomeAt(int, int) 1.2.3+
Example: world.getBiomeAt(x,z)
returns string of biome at a position.
getRespawnPos() 1.2.6+
Example: world.getRespawnPos()
returns a BlockPosHelper.
getDifficulty() 1.2.6+
Example: world.getDifficulty()
returns the int
representing difficulty.
getMoonPhase() 1.2.6+
Example: world.getMoonPhase()
returns the int
representation of moon phase.