Category:Minecraft PE Mods & Addons / Minecraft PE Addons
Viewed: 1470 - Published at: 4 years ago
Description:
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, y — 4096, level — 24791, mode — 2.
- 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.