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 8 forks source link

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

Closed Nico314159 closed 9 months ago

Nico314159 commented 10 months ago

Function signature:

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

Inspired by Trident

Nico314159 commented 10 months 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 9 months ago

tag @e remove onGround looks really unoptimized?

Nico314159 commented 9 months 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.