WingedSeal / jmc

A compiler for JMC (JavaScript-like Minecraft Function), a mcfunction extension language for making Minecraft Datapack
https://jmc.wingedseal.com
MIT License
64 stars 10 forks source link

Add `Tag.update()` built-in function #53

Closed Nico314159 closed 1 year ago

Nico314159 commented 1 year ago

Function signature:

Tag.update(selector: Selector, tag: Keyword)

Inspired by Trident

Nico314159 commented 1 year ago

For example,

Tag.update(@e[nbt={OnGround:1b}], onGround);

compiles to

tag @e remove onGround
tag @e[nbt={OnGround:1b}] add onGround
WingedSeal commented 1 year ago

tag @e remove onGround looks really unoptimized?

Nico314159 commented 1 year ago

tag @e remove onGround looks really unoptimized?

Well, the purpose is to remove it from all entities before re-adding to specific ones, so I don't know of a better way to do that.