Skip to content

Releases: rx-modules/bolt-expressions

v0.8.0

27 Jul 02:38
Compare
Choose a tag to compare

Feature

  • API method to cast expressions to any nbt type. Data.cast converts an expression, score or data to the specified nbt type and returns a temporary DataSource as output. (eb3d532)
temp.Count = Data.cast(obj["$count"], "byte")

# scale down by 0.01 during the conversion
temp.pos[0] = Data.cast(obj["$x"] / 100, "double")

temp.mean = Data.cast((obj["$a"] + obj["$b"]) / 2, "double")

temp.a = Data.cast(5, "short")

temp.Count = Data.cast(temp.Count - 1, "byte")

temp.a = obj["$a"] / 100 # gets converted to double

temp.a = Data.cast(obj["$a"] / 100, "int") # gets truncated

Fix

  • Better nbt type handling (9f63995)
  • Scaling/casting between data sources doesn't work (5074414)

v0.7.0

15 Jun 23:39
Compare
Choose a tag to compare

Feature

  • Scale nbt data with multiplication/division. Make sure to properly use parentheses when composing a more complex expression. (ebf9420)
obj["#motion"] = (player.Motion[0] * 100) + 3
# execute store result score #motion obj run data get entity @s Motion[0] 100
# scoreboard players add #motion obj 3

temp.out = (obj["$motion"] + 1) / 100
# scoreboard players operation $i0 bolt.expr.temp = $motion obj
# execute store result storage temp out 0.01 float run scoreboard players operation $i0 bolt.expr.temp += $1 bolt.expr.const
  • Directly create score sources using the Scoreboard API by passing the score holder as the second argument. Multiple score holders can be provided to create multiple score sources. (4d42c97) (Removed on v0.9.0 due to conflict with criteria argument)
foo = Scoreboard("obj.example", "$foo")
foo += 1

a, b, c = Scoreboard("obj.example", "$a", "$b", "$c")
a = b + c
  • Create multiple score sources at once by passing multiple arguments to an objective's subscript operator. (4eca574)
example = Scoreboard("obj.example")

foo = example["$foo"]
foo *= 314

a, b, c = example["$a", "$b", "$c"]
a = b * c

pos = example["$x", "$y", "$z"]
temp["$value"] = sum(pos)

v0.6.1

30 Apr 01:32
Compare
Choose a tag to compare

Fix

  • Use bolt package instead of mecha.contrib.bolt in api.py (ace4b1a)

Documentation

  • Changes related to the new bolt package. (6ceac3b)
  • Fix tutorial codeblocks not using mcfunction lang (aff3d90)

v0.6.0

14 Apr 21:45
Compare
Choose a tag to compare

Feature

Add expression node methods (97b5a44)

For scores: reset, enable
For data: append, prepend, insert, merge and remove

from bolt_expressions import Scoreboard, Data

demo = Scoreboard("demo")
temp = Data.storage("demo:temp")

temp.numbers = []

temp.numbers.append(1)
# data modify storage demo:temp numbers append value 1
temp.numbers.prepend(demo["$value"] * 2)
# data modify storage demo:temp numbers prepend value 0
# execute store result storage demo:temp numbers[0] int 2 run scoreboard players get $value demo

temp.numbers.insert(-1, temp.value)
# ata modify storage demo:temp numbers insert -1 from storage demo:temp item_data

temp.numbers.remove(0)
temp.numbers[0].remove() # equivalent
# data remove storage demo:temp numbers[0]

temp.merge({"foo":True,"merging_root":"yes"})
# data merge storage demo:temp {foo:True,merging_root:"yes"}

temp.item.tag.merge({"Unbreakable":True})
# data modify storage demo:temp item.tag merge value {Unbreakable:True}

temp.item.tag.merge(temp.item_data)
# data modify storage demo:temp item.tag merge from storage demo:temp item_data

# removing keys
temp.remove("item")
temp.item.remove()

value = demo["$value"]
value = 5
value.reset()
value.enable()

v0.5.0

02 Apr 17:28
Compare
Choose a tag to compare

Feature

  • objective_prefix config, optional prefixed flag when creating an objective. (6c43d51)
  • holder and obj property aliases for score sources. (e6bfdb8)

Documentation

  • Fix docs for now (8a0f02a)
  • Add generated commands to tutorial.md (8711845)

v0.4.5

31 Mar 18:21
Compare
Choose a tag to compare

Fix

  • Init function would be prepended to load tag even if Expression.init was called (34080fe)

Documentation

v0.4.4

31 Mar 17:16
Compare
Choose a tag to compare

Fix

  • Expression.init() creates function with incorrect init path (665edcc)

v0.4.3

31 Mar 17:11
Compare
Choose a tag to compare

Fix

v0.4.2

31 Mar 06:14
Compare
Choose a tag to compare

Fix

  • Forcing a release to build new docs ffs (e30adf7)

Documentation

  • Fix workflow (3.10 versus "3.10") (9cbc582)
  • Auto build and deploy docs (3f8bf8e)
  • Old usage on README.md fixed (60808b1)
  • Added tutorial and cleaned README.md (b786052)

v0.4.1

31 Mar 05:18
Compare
Choose a tag to compare

Fix

  • Scoreboard.objective now works and is preferred (e292d99)