Releases: sandstone-mc/sandstone
Scores can be set to a NBT
Added possibility to set Scores to a given Data Point value, with a given scale.
Examples:
const randomScore = Variable();
randomScore.set(myXMotion, 10);
const randomScore = Variable(myXMotion, 10);
Also, NBT parsing output is now more compact.
Added the Data Abstraction
Added the Data
abstraction:
- Create a Data Instance with
const thisData = Data('entity', selector)
/Data('block', rel(0, 0, 0))
/Data('storage', 'storage_name')
. - Create a Data Point by selecting a specific path:
const myNBTs = Data('entity', '@s')
const myMotion = myNBTs.select('Motion')
const myXMotion = myMotion.select([0])
// You can also specify several path components
const myHelmetTags = myNBTs.select('ArmorItems', [0], 'tag')
- All classical operations are available on Data Points:
myMotion.set(0)
myMotion.set(otherMotion)
// prepend, append, merge, insert are all available
- The
set
method also works with Scores:
const randomScore = Variable(5)
myXMotion.set(randomScore, 'double')
// Optionally takes a scale
myXMotion.set(randomScore, 'double', 10)
- You can test for a specific data using
_.if
, orexecute.if
:
execute.if(myHelmetTags).run(...)
_.if(myHelmetTags, ...)
Bug fix
- Fixed a heavy bug, preventing Objective.create from working properly.
Several syntax improvements
Major changes:
- Added a new NBT syntax, which complements the current one. The current syntax will never be removed. This new syntax uses template string to direcly write NBTs, but does not perform any validation:
// Before
{
Invisible: NBT.byte(1),
Rotation: NBT.float([90, 0]),
}
// After
{
Invisible: NBT`1b`,
Rotation: NBT`[90f, 0f]`,
}
-
Added
NBT.stringify
to get the stringified version of a NBT. -
Added
NBT.not
for selectors. It is used to target entities that do not have the given NBT:
Selector('@e', { nbt: NBT.not({ Age: 0 }) })
// => @e[nbt=!{Age: 0}]
-
createObjective
has been refactored, and split into two methods under a single objectObjective
:Objective.create
, which serves the same purpose ascreateObjective
: it creates a new objective.Objective.get
, which gets an existing objective, and allows you to use Sandstone methods on it.
-
Objective.ScoreHolder
has been replaced withObjective(...)
. Therefore, to get the instance of a Score for a player, use this syntax:
const kills = Objective.create('kills')
const myKills = kills('@s')
const skeletonKills = kills(Selector('@e', { type: 'minecraft:skeleton' }))
-
Renamed
NBT.integerArray
toNBT.intArray
-
Added a
notEqualTo
operator onScore
. It allows to directly check whether two scores are different from each other. -
Fixed the error on
runEach
adding the function tominecraft:tick
. -
Variables can now be initialized directly with a Score.
-Minor changes:
- Renamed PlayerScore to Score
- Improved appending & prepending to MCFunctions which uses flow statements
- Fixed a problem with /particles
- Fixed basePath.lootTable(...) not taking options into account
v0.11.1 - Fixed a bunch of bugs & renamed a few internal types
Changes in execute.if and data
v0.10.2 - Fixed a bunch of bugs
v0.10.1 - Conflict strategies
v0.10.0 - The name-breaking update
Updated README
Updated README for npm
Minor Update
See #74