Scoreboard API (ScoreAPI) | Minecraft PE Mods & Addons

0
3


This behavior pack extends the capabilities of the scoreboard command. You can perform calculations over coordinates, player’s level and game mode. The behavior pack uses smart algorithms, so there is high performance

Documentation

First you need to declare objectives x, y, z, ry, rx, level, mode and temp. This is easy to do by entering the command /function scoreapi_init. What are these objectives for?

  • x, y, z — the main coordinates of the player
  • ry, rx — the coordinates of the player’s head rotation. ry — horizontal rotation, from –180 to 180. rx — vertical rotation, from –90 to 90.
  • level — the player’s level
  • mode — the player’s gamemode
  • temp — a temporary objective used in some functions. Changing its value will not have any effect

The syntax of the functions

Functions starting with save_ save the values of the player’s properties to the objectives. For example, function save_level saves the player’s level to the level objective.

Functions starting with set_ set the player’s properties by taking values from objectives.

Functions starting with tp_ teleport the entity using objectives x, y, z, or ry, rx. For example, function tp_x teleports the entity to the x objective. tp_xyz teleports the entity to the x, y, z objectives. “” in the function name means ~ (relative). So tp_-xy means “tp ~x y“, tp_-x-y-z means “tp ~x ~y ~z“, etc.

Functions

There are 64 functions (7 private and 57 usable. Usable functions:

  • scoreapi_init — initiates objectives x, y, z, ry, rx, level, mode and temp
  • scoreapi_remove — removes objectives
  • scoreapi_help — outputs information about the functions
  • save_? — saves ? to the objectives. Examples: save_xy (saves x and y coordinates), save_rx (saves rx coordinate), save_mode (saves gamemode)
  • save_all — saves all player properties to the objectives (x, y, z, ry, rx, level, mode)
  • tp_? — teleports the entity to ? coordinates. Examples: tp_xz (teleports to x and z), tp_x-yz (teleports to x, ~y and z), tp_-ry (teleports to ~ry)
  • tp_all — teleports the entity to all the coordinates (x, y, z, ry and rx)
  • set_mode — sets the player’s gamemode
  • set_level — sets the player’s level
  • add_levels — adds levels to the player’s level (supports negative values)
  • remove_levels — removes levels from the player’s level (supports negative values)
  • clear_level — sets the player’s level to 0
  • look_xyz — turns the entity to the x, y, z coordinates

Practice

Let’s practice! First, call the scoreapi_init function to add the necessary objectives. Let’s say you want to teleport to the x –35 coordinate. Do /scoreboard players set @s x -35. Then call the tp_x function. Congratulations! You are at the x 35 coordinate!

You have to save your coordinates (including your head rotation). Do /function save_all to save all the coordinates. Done! Now you can view your coordinates by entering /scoreboard players list @s. If you just want to save coordinates without turning, call save_xyz.

You have to teleport 10 blocks up. Do /scoreboard players set @s y 10. Then call the tp_-y function. “-” means ~ (relative).

You have to set your level to a random value from 15 to 35. Do /scoreboard players random @s level 15 35. Then call the set_level function. To save your current level to the level objective, do /function save_level.

Notes

  • When setting the player level, the sound is not played; this was done on purpose. To fix this, do /playsound random.levelup @s ~ ~ ~ 0.75 1
  • I recommend disabling the sendcommandfeedback gamerule before using functions starting with tp_
  • Maximum values: x, z, ry, rx — 16777216, y4096, level24791, mode2.
  • You can periodically save your properties to the objectives using a repeating command block with the command /execute target ~ ~ ~ function save_? (in place of the ? you should write what you will save). Don’t forget to disable the output of command blocks (/gamerule commandblockoutput false)
  • You can use my addon in your own projects and edit the functions for your purposes

Thank you for using my addon! If you find any bug or error in the text, write in the comments.


  • Fixed functions starting with tp_. In 1.0.2 they didn’t work correctly, I’m sorry
  • Fixed other minor bugs
  • Now the save_all function saves all the player properties (x, y, z, ry, rx, level, temp)
  • Fixed some glitches in the sidebar and list when using the functions
  • Fully fixed the save_rx function
  • Fixed a small but important bug in the save_level function
  • Fixed minor errors in documentation
  • Fixed the save_rx function
  • Improved documentation
  • Fixed other minor bugs

Downloads

Supported Minecraft versions

1.10
1.11
1.12
1.13
1.14
1.15 (beta)
1.16
1.16 (beta)
1.8
1.9



Source link

LEAVE A REPLY

Please enter your comment!
Please enter your name here