mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-20 07:39:42 +00:00
first look at separating Entity and Location
This commit is contained in:
@@ -91,11 +91,12 @@ class ParticleCommand extends VanillaCommand{
|
||||
}
|
||||
|
||||
if($sender instanceof Player){
|
||||
$world = $sender->getWorld();
|
||||
$senderPos = $sender->getPosition();
|
||||
$world = $senderPos->getWorld();
|
||||
$pos = new Vector3(
|
||||
$this->getRelativeDouble($sender->getX(), $sender, $args[1]),
|
||||
$this->getRelativeDouble($sender->getY(), $sender, $args[2], 0, World::Y_MAX),
|
||||
$this->getRelativeDouble($sender->getZ(), $sender, $args[3])
|
||||
$this->getRelativeDouble($senderPos->getX(), $sender, $args[1]),
|
||||
$this->getRelativeDouble($senderPos->getY(), $sender, $args[2], 0, World::Y_MAX),
|
||||
$this->getRelativeDouble($senderPos->getZ(), $sender, $args[3])
|
||||
);
|
||||
}else{
|
||||
$world = $sender->getServer()->getWorldManager()->getDefaultWorld();
|
||||
|
@@ -44,7 +44,7 @@ class SeedCommand extends VanillaCommand{
|
||||
}
|
||||
|
||||
if($sender instanceof Player){
|
||||
$seed = $sender->getWorld()->getSeed();
|
||||
$seed = $sender->getPosition()->getWorld()->getSeed();
|
||||
}else{
|
||||
$seed = $sender->getServer()->getWorldManager()->getDefaultWorld()->getSeed();
|
||||
}
|
||||
|
@@ -51,8 +51,9 @@ class SetWorldSpawnCommand extends VanillaCommand{
|
||||
|
||||
if(count($args) === 0){
|
||||
if($sender instanceof Player){
|
||||
$world = $sender->getWorld();
|
||||
$pos = (new Vector3($sender->x, $sender->y, $sender->z))->round();
|
||||
$location = $sender->getPosition();
|
||||
$world = $location->getWorld();
|
||||
$pos = $location->asVector3()->round();
|
||||
}else{
|
||||
$sender->sendMessage(TextFormat::RED . "You can only perform this command as a player");
|
||||
|
||||
|
@@ -82,7 +82,8 @@ class SpawnpointCommand extends VanillaCommand{
|
||||
return true;
|
||||
}elseif(count($args) <= 1){
|
||||
if($sender instanceof Player){
|
||||
$pos = new Position($sender->getFloorX(), $sender->getFloorY(), $sender->getFloorZ(), $sender->getWorld());
|
||||
$cpos = $sender->getPosition();
|
||||
$pos = Position::fromObject($cpos->floor(), $cpos->getWorld());
|
||||
$target->setSpawn($pos);
|
||||
|
||||
Command::broadcastCommandMessage($sender, new TranslationContainer("commands.spawnpoint.success", [$target->getName(), round($pos->x, 2), round($pos->y, 2), round($pos->z, 2)]));
|
||||
|
@@ -96,8 +96,10 @@ class TeleportCommand extends VanillaCommand{
|
||||
}
|
||||
}
|
||||
|
||||
$targetLocation = $target->getLocation();
|
||||
|
||||
if(count($args) < 3){
|
||||
$origin->teleport($target);
|
||||
$origin->teleport($targetLocation);
|
||||
Command::broadcastCommandMessage($sender, new TranslationContainer("commands.tp.success", [$origin->getName(), $target->getName()]));
|
||||
|
||||
return true;
|
||||
@@ -108,11 +110,11 @@ class TeleportCommand extends VanillaCommand{
|
||||
$pos = 0;
|
||||
}
|
||||
|
||||
$x = $this->getRelativeDouble($target->x, $sender, $args[$pos++]);
|
||||
$y = $this->getRelativeDouble($target->y, $sender, $args[$pos++], 0, 256);
|
||||
$z = $this->getRelativeDouble($target->z, $sender, $args[$pos++]);
|
||||
$yaw = $target->getYaw();
|
||||
$pitch = $target->getPitch();
|
||||
$x = $this->getRelativeDouble($targetLocation->x, $sender, $args[$pos++]);
|
||||
$y = $this->getRelativeDouble($targetLocation->y, $sender, $args[$pos++], 0, 256);
|
||||
$z = $this->getRelativeDouble($targetLocation->z, $sender, $args[$pos++]);
|
||||
$yaw = $targetLocation->getYaw();
|
||||
$pitch = $targetLocation->getPitch();
|
||||
|
||||
if(count($args) === 6 or (count($args) === 5 and $pos === 3)){
|
||||
$yaw = (float) $args[$pos++];
|
||||
|
Reference in New Issue
Block a user