상속: extends Entity
예제 #1
0
파일: Level.php 프로젝트: xpyctum/Genisys
 public function addExperienceOrb(Vector3 $pos, $exp = 2)
 {
     if ($exp > 0) {
         $nbt = new CompoundTag("", ["Pos" => new EnumTag("Pos", [new DoubleTag("", $pos->getX()), new DoubleTag("", $pos->getY() + 0.5), new DoubleTag("", $pos->getZ())]), "Motion" => new EnumTag("Motion", [new DoubleTag("", 0), new DoubleTag("", 0), new DoubleTag("", 0)]), "Rotation" => new EnumTag("Rotation", [new FloatTag("", 0), new FloatTag("", 0)]), "Experience" => new LongTag("Experience", $exp)]);
         $chunk = $this->getChunk($pos->x >> 4, $pos->z >> 4, false);
         $expOrb = new ExperienceOrb($chunk, $nbt);
         //$expBall->setExperience($exp);
         $expOrb->spawnToAll();
         return $expOrb;
     }
     return false;
 }
예제 #2
0
 public function spawnExperienceOrb(Vector3 $pos, $exp = 1)
 {
     $ExpPerBall = mt_rand(1, 5);
     while ($exp >= $ExpPerBall) {
         $nbt = new Compound("", ["Pos" => new Enum("Pos", [new Double("", $pos->getX() + mt_rand(-1, 1) + mt_rand(100, 999) / 1000), new Double("", $pos->getY()), new Double("", $pos->getZ() + mt_rand(-1, 1) + mt_rand(100, 999) / 1000)]), "Motion" => new Enum("Motion", [new Double("", 0), new Double("", 0), new Double("", 0)]), "Rotation" => new Enum("Rotation", [new Float("", 0), new Float("", 0)]), "Experience" => new Long("Experience", $exp)]);
         $chunk = $this->getChunk($pos->x >> 4, $pos->z >> 4, false);
         $expOrb = new ExperienceOrb($chunk, $nbt);
         $expOrb->spawnToAll();
         $exp -= $ExpPerBall;
         $ExpPerBall = mt_rand(1, 5);
     }
     if ($exp > 0) {
         $nbt = new Compound("", ["Pos" => new Enum("Pos", [new Double("", $pos->getX() + mt_rand(-1, 1) + mt_rand(100, 999) / 1000), new Double("", $pos->getY()), new Double("", $pos->getZ() + mt_rand(-1, 1) + mt_rand(100, 999) / 1000)]), "Motion" => new Enum("Motion", [new Double("", 0), new Double("", 0), new Double("", 0)]), "Rotation" => new Enum("Rotation", [new Float("", 0), new Float("", 0)]), "Experience" => new Long("Experience", $exp)]);
         $chunk = $this->getChunk($pos->x >> 4, $pos->z >> 4, false);
         $expOrb = new ExperienceOrb($chunk, $nbt);
         $expOrb->spawnToAll();
     }
 }
예제 #3
0
 public function addExperienceOrb(Vector3 $pos, $exp = 2)
 {
     $nbt = new Compound("", ["Pos" => new Enum("Pos", [new Double("", $pos->getX()), new Double("", $pos->getY()), new Double("", $pos->getZ())]), "Motion" => new Enum("Motion", [new Double("", 0), new Double("", 0), new Double("", 0)]), "Rotation" => new Enum("Rotation", [new Float("", 0), new Float("", 0)]), "Experience" => new Long("Experience", $exp)]);
     $chunk = $this->getChunk($pos->x >> 4, $pos->z >> 4, false);
     $expBall = new ExperienceOrb($chunk, $nbt);
     //$expBall->setExperience($exp);
     $expBall->spawnToAll();
 }