def get_cmd(self, func): if isinstance(self.target, BlockRef): target = self.target.as_cmdref() elif isinstance(self.target, EntitySelection): target = c.EntityReference(self.target.as_resolve()) else: assert False if isinstance(self.source, BlockRef): source = self.source.as_cmdref() elif isinstance(self.source, EntitySelection): source = c.EntityReference(self.source.as_resolve()) else: assert False return c.DataModifyFrom(target, c.NbtPath(str(self.target_path)), self.action, source, c.NbtPath(str(self.source_path)))
def get_cmd(self): if isinstance(self.target, BlockRef): target = self.target.as_cmdref() elif isinstance(self.target, EntitySelection): target = c.EntityReference(self.target.as_resolve()) else: assert False return c.DataModifyValue(target, c.NbtPath(self.path), self.action, self.source)
def get_cmd(self, func): direct = self.var._direct_nbt() assert direct is not None, self.var dest_path, dest_storage = direct if isinstance(self.source, BlockRef): source = self.source.as_cmdref() elif isinstance(self.source, EntitySelection): source = c.EntityReference(self.source.as_resolve()) else: assert False return c.DataModifyFrom(dest_storage, dest_path, self.action, source, c.NbtPath(str(self.source_path)))
def apply(self, out, chain, storechain): assert self.target.is_only_one storechain.entity(self.target.as_resolve(), c.NbtPath(self.path), \ self.nbttype.name, self.scale)
def construct(self): path = c.NbtPath(str(self.path)) return EntityLocalNbtVariable(self.type, self.target, path)
def as_cmd(self): return c.DataGet(self.target, c.NbtPath(self.path), self.scale)
def reset_last_exec(self): return c.DataModifyValue(self.block, c.NbtPath('UpdateLastExecution'), 'set', NBTByte(1))
def clear(self): return c.DataRemove(self.block, c.NbtPath('Command'))
def cmd_set_from(self, path, storage): return c.DataModifyFrom(self.block, c.NbtPath('Command'), 'set', storage, path.subpath('.cmd'))
def get_cmd(self): return c.DataModifyFrom(c.UtilBlockPos.ref, c.NbtPath('Command'), 'set', c.GlobalEntity.ref, c.StackPath(STACK_HEAD, 'cmd'))
def get_cmd(self): return c.DataRemove(c.UtilBlockPos.ref, c.NbtPath('Command'))
def cmd_set_from(self, path, entity): return c.DataModifyFrom(self.block, c.NbtPath('Command'), 'set', entity.ref, path.subpath('.cmd'))