Compatibility
Minecraft: Java Edition
Platforms
Tags
Creators
Details
For any questions or requests, the best way to reach me is through Discord (@skeleton.toast).
Silver Star Library is a development tool for datapack creators. It was originally a library I created for my own use, but its usage is not specifically catered to my own projects, and can be used across a wide variety of applications.
If you'd like an updated version of SSL for an older Minecraft version, please reach out! It is likely not too difficult for me to backport it, and I'm happy to do so, though it may take some time.
NOTE 10/09/26: If you previously installed version 26.10.08, and have not yet downloaded a later version, PLEASE DO SO. If you want to make the change on your end, the error is in the function ss_lib:load_constants. The value of #const.10 is incorrectly set to -1 on line 2.
Developers: Please note!
For many features of SSL, you will be required to invoke the ss_lib:_pre_function and ss_lib:_post_function functions. These files are designed to be run before all other functions, and after all other functions, respectively. I achieve this in my other projects by having a "core" module which invokes these functions at the proper time, but do it however you like.
This datapack is offered "as-is". I make no guarantees about the robustness or legibility of included code. Updates and patches will be offered as long as I continue to work on the project.
Features
- Score Parsing into functions
- Raycasting
- Custom potion effects (Elixir Framework)
- Easy-to-reference UUIDs (SSIDs)
- Efficient player data fetching
- Bitpacking
- Custom Gamerules
- Shorthand math functions
A full breakdown is provided on my GitHub. Information on the most important modules is provided below.
Score Parse Module
The Score Parse Module is a sub-module of SSL that takes a macro input of a scoreboard objective and a function, and outputs the value of the scoreboard objective into the target function, as a macro. For example, if a player has a Test score of 50, and they want their maximum health attribute to always match their Test score, the Score Parse Module can read their score and output a string of "50" into the target function. SPM also has the ability to prepend, append, and insert special characters, allowing scores to be converted to floats.
In essence, the Score Parse Module is used to convert scores into macro strings.
Raycast Module
The Raycast module adds a group of functions for creating raycasts, for instant straight-line block or entity detection. It allows input of how far the raycast should travel, the integer between each raycast node, and the target block, entity, or both. If the raycast succeeds, and detects the target, it will then run the specified function.
This is a recursive function. With every recursion, it steps forward a short amount, checks if any of the termination conditions are true, checks if it has reached its maximum distance, and otherwise, calls itself to continue traveling.
Custom Potion Effects / Elixir Framework
Elixir is a module that sets up the framework necessary for fully custom potion effects, including stacking applications, which is difficult to do with just scores. The Elixir Framework lets you apply an effect at any time, and intelligently orders the active applications so that they match vanilla potion effects, e.g., the application with the highest amplifier is the one that's prioritized.
Elixir is written in a way so that it can be easily accessed and used by other datapacks, without having to write anything in the Silver Star Library itself. In order to add your own custom potion effect, you need to create two functions:
- The function that is run on entities which have the custom effect active
- The function that is run when an application expires
For example, one of the preset effects, or "statuses" for clarity, is called Lightweight. The active function applies attributes that reduce gravity and knockback resistance, and the expire function removes these attributes.
A handful of preset statuses come with SSL. Feel free to use them, or delete them if you're not going to use them.
SSID
The Silver Star Identifier, or SSID, is a numerical value that is assigned to entities, that essentially gives them a UUID that can be interacted with like a score. SSIDs are an evolution on the previous URID system, and as such, they replace URIDs, which are no longer supported. An SSID is a 9-digit number assigned upon request to any entity, which is stored as a scoreboard value, and cannot be used more than once, EVER, PER WORLD. They're assigned by running the following function as the entity to be assigned: ssid:assign.
SSIDs are meant to be used as a scoreboard-based identifier for entities, which also allows global data storage on a per-entity basis. If you pass their SSID through the Parse module, and use that to create/access a data storage location, this allows for complex (as in more than just scoreboards) storage, that will only be accessed by the right entity.
Scores / Smart Score "Fetching"
SSL adds a wide array of scores that cover entity data, condition, location, and more. These scores can be called as needed through a group of "fetch" functions, which have a built-in check for whether they've already been called in the same tick. This drastically increases efficiency compared to calculating scores every tick, because it allows scores to only be calculated when necessary, and means that there won't be redundant calculations.
SSL also adds "generic" scores, along with basic integer scores. "generic" scores are meant to be assigned and used in a single function, as they act just as temporary, placeholder scores. 26 generic scores exist by default: one for each letter of the English alphabet, in the format generic_<letter> (for example, generic_k).
Constants are automatically added, from -100 to 100. These can be accessed through the value score of the phantom player #const.<number>.
The "Fetch" module is one that allows you to store player data into a score, only when needed, so as to cut down on extra processing power. Fetch functions are contained under ss_lib:fetch/, and include many commonly accessed data locations, including the player's health, their selected item, their equipped weapons and armor, and more.
The reason these Fetch functions exist is so that they can be called at any time, but if that data has already been accessed in the same tick (and assigned to the relevant score), the function will terminate without re-accessing the data, since you already have the data. This means that you could run a fetch function 10,000 times, and it would only actually fetch the player's data once. Functions that might change midway through a tick itself, such as fetching the player's health or absorption, typically have an override that allows you to re-run the function even if it has already been run this tick.
The Fetch module adds the following functions:
ss_lib:fetch/absorptionss_lib:fetch/healthss_lib:fetch/health_attributesss_lib:fetch/armorss_lib:fetch/attack_damagess_lib:fetch/attack_speedss_lib:fetch/fall_flyingss_lib:fetch/firess_lib:fetch/in_waterss_lib:fetch/is_sprintingss_lib:fetch/item_selectedss_lib:fetch/locationss_lib:fetch/coordinatesss_lib:fetch/moon_phasess_lib:fetch/on_groundss_lib:fetch/using_bowss_lib:fetch/using_shieldss_lib:fetch/weaponss_lib:fetch/gear/armor_typess_lib:fetch/gear/weapon_materialss_lib:fetch/gear/weapon_typess_lib:fetch/gear/weapon_weight
Binary Dissection / Bitpacking
SSL also introduces a module for "bitpacking": using an integer to store a bunch of true/false conditions by reading it as a binary number.
What this does is allows you to store up to 32 boolean conditions, 0-31, in a single score, by adding a value to the score that represents an exponential multiple of 2. For example, if you want to set condition #10 and condition #14 to true, and leave all others false, the disambiguation value would be set to 17408 (2^10 + 2^14), which can only be created when those two conditions are true. The Binary Dissection file then dissects this value, reads that conditions #10 and #14 are true, and executes functions based on those files.
This is useful mainly just for simplicity. If you want to have however many true/false conditions (for example, in one of my projects, I use it to see if players have certain "talismans" equipped), but don't want to create 32 scores or 32 tags, you can use one single score to group them all together.
Gamerule Module
This is a system designed to simulate vanilla gamerules, allowing developers to set global gamerules that they can change at will, and reference when needed. This is a good way to keep track of backend settings that apply to the world at large.
To reference a gamerule, once it's been instantiated, reference the score true (for boolean gamerules) or value (for range-based gamerules), held by the phantom player $source.gamerule.gamerule_name. Of course, replace "source" and "gamerule_name" with the relevant information for your gamerule. This might look like:
execute if score $awesomepack.gamerule.pvp_enabled run...
Players with an ssl.permissions.level score of 4 or higher can also run the command /trigger ssl.gamerule.query to see a list of SSL-base gamerules across all datapacks, their type, their range if applicable, and their current value.
Math Module
Round Function
The Rounding sub-module is used to increase precision of scores when they're divided. By default, Minecraft will always round quotients of two scores down to the nearest integer. However, the Rounding module will properly round these values instead of rounding them down every time.
The rounding module is pretty straightforward. It takes three input parameters: score, which is the scoreboard objective that will be rounded for the executing entity, round, which is the divisor for rounding purposes, and reduce, which is a boolean that determines whether or not to divide the rounded number by round at the end of calculation. If you want to round score to the nearest multiple of 7, for example, set round to 7. If you want this value to be divided by 7, set reduce to true, and otherwise, set reduce to false.
For versions 26.10.22 and later: These functions are replaced by the following functions:
math:round/intmath:round/scoremath:round/up/intmath:round/up/scoremath:round/down/intmath:round/down/score
Other Functions
Exponent Functions
Two new exponent functions are added, namely: math:power/integer and math:power/score. math:power/integer takes two input parameters, $(base_score) and $(exponent).
Absolute Value
The function math:absolute_value is added, that simply makes the input score positive, if it is negative. It takes one input parameter, $(score). This is extremely trivial code, but I found it nice to have a shorthand.
Digit Counter
The function math:digit_counter is added, which counts the number of digits of the input score and returns it to a specified output score. It takes two input parameters: $(input_score) and $(output_score). The number of digits in $(input_score) is written to $(output_score).
Note: An input score with a value of 0 will still return 1 digit.
Even Function
The function math:even is added, which will round the input score to an even number, if it is not already even. It takes two input parameters: $(score) and $(sign). $(score) is the name of the scoreboard objective that will be modified, and $(sign) is a string that must be either "-" or "+". This parameter specifies whether the function will round up or down.
Chance Functions
Two chance functions are added: math:chance/percentage and math:chance/score. These have a random chance to trigger your specified function, and the probability of the function triggering depends on your input.
math:chance/percentage takes two inputs: $(value) and $(function). $(value) is a float from 0.00 to 1.00, which determines the likelihood of $(function) triggering. $(function) should be the name of a function, obviously.
Similarly, math:chance/score does the same thing, only using a score instead of a hard value. This function takes three inputs: $(score), a scoreboard objective, $(max_value), which is an integer to compare the value of $(score) against, and $(function), which is the name of whatever function will be triggered, if the chance succeeds. As an example, if your objective specified by $(score) has a value of 15, and you input a value of 30 for $(max_value), then $(function) will have a 15/30 chance of triggering, or 50%.
Although math:chance/percentage is extremely basic code, I found it helpful to have a shorthand. Plus, math:chance/score needed some sort of function to pass the parsed value to.
Action Tags
SSL adds a handful of functionalities for "action tags", tags that are applied to an entity to perform code that isn't easily executable with commands. There are currently three action tags:
For SSL versions 26.09.22 or earlier:
Extinguished, Pacified, and FallDamageNegated
For SSL versions later than 26.09.22:
ssl.action.extinguish, ssl.action.pacify, and ssl.action.negate_fall_damage
The extinguish tag will immediately extinguish any entity that's currently on fire. The pacify tag will de-aggro any hostile mob, though they might re-aggro immediately if there's a target in range. The fall damage negation tag will prevent that entity from taking any fall damage the next time they touch the ground, though be aware: if this tag is applied to an entity that's currently on the ground, it will be immediately removed and have no effect.
All action tags only trigger once before they must be re-applied. To trigger these behaviors, all you need to do is apply your desired tag (/tag <target> add <tag>) to the entity you want to affect.
Roadmap - Planned Changes
- Optimize and polish circle module
- Port over now-defunct statuses to Elixir
- Additional math module functions
- In version 26.3, Mojang added more math capabilities with data storage, including square root calculation, sin/cos/tan, and a couple others. Since these functions aren't currently compatible with scoreboard objectives, additional math functions will be added to SSL that allow these calculations to be performed on scores, as well as stored data.
- Distance calculation module
- Using the square root function added in the math module update, SSL will also be able to calculate the distance between two points by finding the hypotenuse of a "triangle" drawn between those two points. Although it's currently possible for selectors to filter by entities' distance from the executing location, there's no easy way to compute and store the exact distance itself, which is what this module aims to fix.
- Actionbar title queueing
- Using the current actionbar system, this modification will allow actionbar titles to be "queued", meaning they're stored, and displayed as soon as the previous actionbar's duration runs out. This will allow for better use of the actionbar system.
- Collisions module
- This module will provide functions that can be invoked at any location, to see if that location is directly colliding with a block. The current method for block detection will give a false positive if there is a block at the executing coordinates, even if that block isn't actually colliding with the specific sub-coordinates.
- This will be used in the raycast module to allow for significantly more precise raycasting.
Silver Star Library
This is a project I've been working on for a long time, and I've found it very helpful in my datapack projects. I hope you find it to be just as useful.


