mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-10 15:59:39 +00:00
Removed EntityWorldChangeEvent
there's nothing that can be done with this event that can't be done with EntityTeleportEvent. Having this extra event needlessly increases system complexity.
This commit is contained in:
parent
cb3a225d45
commit
00944eff72
@ -34,7 +34,6 @@ use pocketmine\event\entity\EntityMotionEvent;
|
||||
use pocketmine\event\entity\EntityRegainHealthEvent;
|
||||
use pocketmine\event\entity\EntitySpawnEvent;
|
||||
use pocketmine\event\entity\EntityTeleportEvent;
|
||||
use pocketmine\event\entity\EntityWorldChangeEvent;
|
||||
use pocketmine\math\AxisAlignedBB;
|
||||
use pocketmine\math\Bearing;
|
||||
use pocketmine\math\Facing;
|
||||
@ -1569,12 +1568,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
}
|
||||
|
||||
if($this->isValid()){
|
||||
$ev = new EntityWorldChangeEvent($this, $this->world, $targetWorld);
|
||||
$ev->call();
|
||||
if($ev->isCancelled()){
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->world->removeEntity($this);
|
||||
if($this->chunk !== null){
|
||||
$this->chunk->removeEntity($this);
|
||||
|
@ -1,52 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\event\entity;
|
||||
|
||||
use pocketmine\entity\Entity;
|
||||
use pocketmine\event\Cancellable;
|
||||
use pocketmine\event\CancellableTrait;
|
||||
use pocketmine\world\World;
|
||||
|
||||
class EntityWorldChangeEvent extends EntityEvent implements Cancellable{
|
||||
use CancellableTrait;
|
||||
|
||||
/** @var World */
|
||||
private $originWorld;
|
||||
/** @var World */
|
||||
private $targetWorld;
|
||||
|
||||
public function __construct(Entity $entity, World $originWorld, World $targetWorld){
|
||||
$this->entity = $entity;
|
||||
$this->originWorld = $originWorld;
|
||||
$this->targetWorld = $targetWorld;
|
||||
}
|
||||
|
||||
public function getOrigin() : World{
|
||||
return $this->originWorld;
|
||||
}
|
||||
|
||||
public function getTarget() : World{
|
||||
return $this->targetWorld;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user