Add /data, /tag and NBT summoning

/data now supports get, merge, modify and remove on entities, block entities and command storage, with NBT paths (children, indices, [] and [{...}] matches, root matches), scaling for numeric reads, the append, prepend, insert, set and merge modifiers, and from, string and value sources. Command storage is saved per namespace in data/<namespace>/command_storage.dat. /tag adds, removes and lists entity tags, which selectors' tag=, nbt= and advancements= options now check. /summon accepts a full NBT compound (custom name, tags, health, NoAI, Invulnerable, item contents and so on), and armor stands, item frames, paintings, boats and minecarts can now be selected, teleported and killed like other entities.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-09 13:01:12 +02:00
parent 2872884cb9
commit d5d87f23a2
19 changed files with 2885 additions and 34 deletions
+10 -1
View File
@@ -515,6 +515,12 @@ pub struct Mob {
pub extra: Extra,
pub fluids: living::Fluids,
pub no_gravity: bool,
/// `NoAI`: no goals and no movement.
pub no_ai: bool,
/// `Silent`.
pub silent: bool,
/// `Invulnerable`: immune to damage (but not to `/kill`).
pub invulnerable_flag: bool,
pub climbing: bool,
pub fire_ticks: i32,
pub air: i32,
@@ -785,6 +791,9 @@ impl Mob {
extra: Extra::default(),
fluids: living::Fluids::default(),
no_gravity: false,
no_ai: false,
silent: false,
invulnerable_flag: false,
climbing: false,
fire_ticks: 0,
air: 300,
@@ -858,7 +867,7 @@ impl Mob {
.fold((0.0, 0.0), |(a, t), (x, y)| (a + x, t + y))
}
pub fn damage(&mut self, amount: f32, source: Damage) -> bool {
if !self.alive() || self.removed {
if !self.alive() || self.removed || self.invulnerable_flag {
return false;
}
if source.is_fire() && (self.kind.flags.fire_immune) {