コード例 #1
0
 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)))
コード例 #2
0
 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)
コード例 #3
0
    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)))
コード例 #4
0
 def get_cmd(self):
     if isinstance(self.target, BlockRef):
         ref = self.target.as_cmdref()
     else:
         ref = c.EntityReference(self.target.as_resolve())
     return c.DataMerge(ref, self.data)
コード例 #5
0
 def construct(self):
     if isinstance(self.target, BlockRef):
         target = self.target.as_cmdref()
     else:
         target = c.EntityReference(self.target.as_resolve())
     return NBTGetterFunc(target, str(self.path), self.scale)