Beispiel #1
0
 /**
  * @param Block $sourceBlock a Block with the absolute X, Y and Z from the original level
  */
 public function addEntry(Block $sourceBlock)
 {
     if (!$this->isWritable) {
         throw new \InvalidStateException("This clip is not writable");
     }
     if (!$sourceBlock->isValid()) {
         throw new \InvalidArgumentException("Source block must contain a level and absolute coords");
     }
     if ($sourceBlock->getLevel()->getName() !== $this->levelName) {
         throw new \InvalidStateException("Block is not from the level clip is being written in");
     }
     $delta = $sourceBlock->subtract($this->anchor);
     $insert = Block::get($sourceBlock->getId(), $sourceBlock->getDamage(), Position::fromObject($delta->subtract($this->anchor)));
     $this->entries[] = $insert;
 }