Releases: rx-modules/bolt-expressions
Releases · rx-modules/bolt-expressions
v0.19.2
v0.19.2 (2026-01-18)
This release is published under the MIT License.
Bug Fixes
- Bug related to converting source into components for tellraws, etc. (
d24aeff)
Detailed Changes: v0.19.1...v0.19.2
v0.19.1
v0.19.1 (2026-01-18)
This release is published under the MIT License.
Detailed Changes: v0.19.0...v0.19.1
v0.19.0
v0.19.0 (2026-01-18)
This release is published under the MIT License.
Chores
-
chore: change to uv
-
chore: format imports
Co-authored-by: rx97
Features
-
feat: fix up examples, linting, and more
-
fixes using tellraw with Sources
-
chore: fix up gh action
-
chore: fix pyproject.toml version lookup
-
chore: fix up pyproject st uff
-
chore: update rich
-
chore: git checkout
-
chore: condition to semantic release
Detailed Changes: v0.18.0...v0.19.0
v0.18.0
Feature
- Add temp_score_prefix and const_score_prefix options (
32a0ab6)
meta:
bolt_expressions:
const_score_prefix: "#"
temp_score_prefix: "%"obj["$a"] = 100 - obj["$b"] * 2
# scoreboard players operation %i0 bolt.expr.temp = $b abc.obj
# scoreboard players operation %i0 bolt.expr.temp *= #2 bolt.expr.const
# scoreboard players set $a abc.obj 100
# scoreboard players operation $a abc.obj -= %i0 bolt.expr.tempv0.17.1
v0.17.0
Feature
Fix
v0.16.1
v0.16.0
Feature
- Overloaded len function for data sources (
792657b)
obj["$length"] = len(storage.arr)
# execute store result score $length obj run data get storage name:path arr
storage.last_slot[Byte] = len(storage.Items) - 1
# execute store result score $i0 bolt.expr.temp run data get storage name:path Items
# execute store result storage name:path last_slot byte 1 run scoreboard players remove $i0 bolt.expr.temp 1
- Add string data source indexing and slicing (
4b5fa58)
# must specify the data type
message = storage.msg[str]
storage.a = message[5:]
# data modify storage name:path a set string storage name:path msg 5
storage.chars.append(message[0])
# data modify storage name:path chars append string storage name:path msg 0 1
message[0] = "c"
# TypeError: String data source does not support index/slice assignment.
storage.value[0] # list indexing
storage.value[0:5] # generic data sources dont accept slicesFix
v0.15.0
Feature
- Add source branching and comparison operators (
f8d8ec4)
a, b, c = obj["$a", "$b", "$c"]
value = storage.value
if not a:
a = 0
if a > b:
say a greater than b!
c = (a <= b)*50 + (value >= 3)*3- Improved if..elif..else with
__multibranch__(1746226)
if not a:
say a is 0 or does not exist
elif a < 0:
say a is negative
elif a > 0:
say a is positive
else:
say impossible- Data comparison operator (
749dd79)
from nbtlib import Byte
item = storage.item
# execute if data storage test:temp item{id: "minecraft:stone"} ...
if item.id == "minecraft:stone":
say holding a stone!
# execute if data storage test:temp item{Count: 1b}
if item.Count == Byte(1):
say just one item.
# matching a compound
if item == {id: "minecraft:diamond", Count: Byte(3)}:
...
# matching a score
if storage.time == obj["$time"]:
say ...
# comparing two data sources
if storage.value != storage.prev_value:
say value changed!
storage.prev_value = storage.value
else:
say value not changed.- Add and/or operator support for sources/lazy sources (
f8013e9)
Fix
- Strip run execute from commands (
c8648f2)
v0.14.0
Feature
- Operations now return lazy sources (
6832b91)
a = 5 + obj["@s"] / 2
# $2384k242hd495_2 bolt.expr.temp (generated name)
# does not emit any command yet
print(a.is_lazy()) # True
obj["$value"] = obj["$b"] * a
# expanded on expression while it's lazy.
# might produce repeated commands if "a" switches
# to early evaluation later on.
a.evaluate()
# triggers early evaluation of "a".
# commands are inserted where "a" was originally evaluated.
print(a.is_lazy()) # False
obj["$value2"] = a # copies "a"- Support dicts, lists, arrays and union types as data source types (
1097f5f)
class Item(TypedDict): # from the typing module
id: str
Count: Byte # from nbtlib
tag: dict[str, Any]
hotbar = storage.hotbar[list[Item]]
first_item = hotbar[0]
first_item.Count = obj["$count"]
# execute store result storage ... hotbar[0].Count byte 1 run scoreboard players get ...- Type checking (
b031303)
first_item.id = 5
# "Int" does not match "String"
hotbar.append({id: "stone"})
# "{id: String}" is missing required key "Count" of type "Byte"
hotbar[0].merge({x:5})
# "{x: Int}" has extra key "x" not present in "Item"
hotbar = [1, 2, 3]
# Elements of "list[Int]" and "list[Item]" are not compatible
# "Int" is not a compound type with fixed keys and is not compatible with "Item"
message = storage.msg[str | list[str]]
message = ["hello", "world"]
# fine
message = "hello world"
# fine
message = [{a: "b"}, {b: 5}]
# "list[{a: String} | {b: Int}]" is not compatible with "String | list[String]"- Numeric literal casting (
9874ca9)
storage.pos[list[Double]] = [43, 0, 5]
# [43.0d, 0.0d, 5.0d]
storage.item[Item] = {id: "glass", Count: 5, tag: {}}
# {id: "glass", Count: 5b, tag: {}}
storage.flag[Byte] = 128
# raises an exception because 128 can't be represented as Byte.
storage.number[Byte | Long] = 4 # can't cast when write type is a union
# "Int" is not compatible with "Byte | Long"
storage.number[Byte | None] = 4 # only if it's optional
# 4b- Separate data source interfaces for each nbt type (
dbe9a74)
storage.msg[str] - 1
# TypeError: unsupported operand type(s) for -: 'DataSource' and 'int'
storage.value[int].oops
# TypeError: Data source of type 'Int' does not have named keys
storage.c[dict[str, Any]][0]
# TypeError: Data source of type 'dict[String, typing.Any]' object is not indexable
storage.arr[list[int]]({a: 0})
# TypeError: Data source of type 'list[Int]' does not support compound matchingFix
- Only cast numeric nbt types (
86d49b1)