mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 10:22:56 +00:00
Removed entanglement between chunks and providers. WARNING: BREAKING API CHANGES.
- All entity and tile constructors now require a \pocketmine\level\Level instead of a \pocketmine\level\format\Chunk. - Chunk->getProvider() and Chunk->setProvider() have been removed. - Chunk::__construct() has had the $provider parameter removed. - Chunk->unload() has had the unused $save parameter removed. - ChunkEvents now take a Level parameter instead of going through the Chunk API bump to 3.0.0-ALPHA4
This commit is contained in:
@ -24,7 +24,6 @@ namespace pocketmine\item;
|
||||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\entity\Entity;
|
||||
use pocketmine\level\format\Chunk;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\nbt\tag\CompoundTag;
|
||||
use pocketmine\nbt\tag\DoubleTag;
|
||||
@ -43,13 +42,6 @@ class SpawnEgg extends Item{
|
||||
}
|
||||
|
||||
public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$entity = null;
|
||||
$chunk = $level->getChunk($block->getX() >> 4, $block->getZ() >> 4);
|
||||
|
||||
if(!($chunk instanceof Chunk)){
|
||||
return false;
|
||||
}
|
||||
|
||||
$nbt = new CompoundTag("", [
|
||||
"Pos" => new ListTag("Pos", [
|
||||
new DoubleTag("", $block->getX() + 0.5),
|
||||
@ -71,7 +63,7 @@ class SpawnEgg extends Item{
|
||||
$nbt->CustomName = new StringTag("CustomName", $this->getCustomName());
|
||||
}
|
||||
|
||||
$entity = Entity::createEntity($this->meta, $chunk, $nbt);
|
||||
$entity = Entity::createEntity($this->meta, $level, $nbt);
|
||||
|
||||
if($entity instanceof Entity){
|
||||
if($player->isSurvival()){
|
||||
|
Reference in New Issue
Block a user