mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 10:22:56 +00:00
Fixed some issues related to new indexes
This commit is contained in:
@ -272,9 +272,9 @@ abstract class Door extends Transparent{
|
|||||||
if($down->getId() === $this->id){
|
if($down->getId() === $this->id){
|
||||||
$meta = $down->getDamage() ^ 0x04;
|
$meta = $down->getDamage() ^ 0x04;
|
||||||
$this->getLevel()->setBlock($down, Block::get($this->id, $meta), true);
|
$this->getLevel()->setBlock($down, Block::get($this->id, $meta), true);
|
||||||
$players = $this->getLevel()->getUsingChunk($this->x >> 4, $this->z >> 4);
|
$players = $this->getLevel()->getChunkPlayers($this->x >> 4, $this->z >> 4);
|
||||||
if($player instanceof Player){
|
if($player instanceof Player){
|
||||||
unset($players[$player->getId()]);
|
unset($players[$player->getLoaderId()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->level->addSound(new DoorSound($this));
|
$this->level->addSound(new DoorSound($this));
|
||||||
@ -285,9 +285,9 @@ abstract class Door extends Transparent{
|
|||||||
}else{
|
}else{
|
||||||
$this->meta ^= 0x04;
|
$this->meta ^= 0x04;
|
||||||
$this->getLevel()->setBlock($this, $this, true);
|
$this->getLevel()->setBlock($this, $this, true);
|
||||||
$players = $this->getLevel()->getUsingChunk($this->x >> 4, $this->z >> 4);
|
$players = $this->getLevel()->getChunkPlayers($this->x >> 4, $this->z >> 4);
|
||||||
if($player instanceof Player){
|
if($player instanceof Player){
|
||||||
unset($players[$player->getId()]);
|
unset($players[$player->getLoaderId()]);
|
||||||
}
|
}
|
||||||
$this->level->addSound(new DoorSound($this));
|
$this->level->addSound(new DoorSound($this));
|
||||||
}
|
}
|
||||||
|
@ -69,11 +69,11 @@ abstract class Tool extends Item{
|
|||||||
public function getMaxDurability(){
|
public function getMaxDurability(){
|
||||||
|
|
||||||
$levels = [
|
$levels = [
|
||||||
2 => 33,
|
Tool::TIER_GOLD => 33,
|
||||||
1 => 60,
|
Tool::TIER_WOODEN => 60,
|
||||||
3 => 132,
|
Tool::TIER_STONE => 132,
|
||||||
4 => 251,
|
Tool::TIER_IRON => 251,
|
||||||
5 => 1562,
|
Tool::TIER_DIAMOND => 1562,
|
||||||
self::FLINT_STEEL => 65,
|
self::FLINT_STEEL => 65,
|
||||||
self::SHEARS => 239,
|
self::SHEARS => 239,
|
||||||
self::BOW => 385,
|
self::BOW => 385,
|
||||||
|
@ -87,6 +87,7 @@ use pocketmine\nbt\tag\Int;
|
|||||||
use pocketmine\nbt\tag\Short;
|
use pocketmine\nbt\tag\Short;
|
||||||
use pocketmine\nbt\tag\String;
|
use pocketmine\nbt\tag\String;
|
||||||
use pocketmine\network\Network;
|
use pocketmine\network\Network;
|
||||||
|
use pocketmine\network\protocol\LevelEventPacket;
|
||||||
use pocketmine\network\protocol\SetTimePacket;
|
use pocketmine\network\protocol\SetTimePacket;
|
||||||
use pocketmine\network\protocol\UpdateBlockPacket;
|
use pocketmine\network\protocol\UpdateBlockPacket;
|
||||||
use pocketmine\Player;
|
use pocketmine\Player;
|
||||||
@ -548,7 +549,7 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function registerChunkLoader(ChunkLoader $loader, $chunkX, $chunkZ, $autoLoad = true){
|
public function registerChunkLoader(ChunkLoader $loader, $chunkX, $chunkZ, $autoLoad = true){
|
||||||
$hash = spl_object_hash($loader);
|
$hash = $loader->getLoaderId();
|
||||||
|
|
||||||
if(!isset($this->chunkLoaders[$index = Level::chunkHash($chunkX, $chunkZ)])){
|
if(!isset($this->chunkLoaders[$index = Level::chunkHash($chunkX, $chunkZ)])){
|
||||||
$this->chunkLoaders[$index] = [];
|
$this->chunkLoaders[$index] = [];
|
||||||
@ -576,8 +577,8 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function unregisterChunkLoader(ChunkLoader $loader, $chunkX, $chunkZ){
|
public function unregisterChunkLoader(ChunkLoader $loader, $chunkX, $chunkZ){
|
||||||
if(isset($this->chunkLoaders[$index = Level::chunkHash($chunkX, $chunkZ)][$hash = spl_object_hash($loader)])){
|
if(isset($this->chunkLoaders[$index = Level::chunkHash($chunkX, $chunkZ)][$hash = $loader->getLoaderId()])){
|
||||||
unset($this->chunkLoaders[$index][$hash = spl_object_hash($loader)]);
|
unset($this->chunkLoaders[$index][$hash]);
|
||||||
unset($this->playerLoaders[$index][$hash]);
|
unset($this->playerLoaders[$index][$hash]);
|
||||||
if(count($this->chunkLoaders[$index]) === 0){
|
if(count($this->chunkLoaders[$index]) === 0){
|
||||||
unset($this->chunkLoaders[$index]);
|
unset($this->chunkLoaders[$index]);
|
||||||
@ -1445,11 +1446,18 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
}
|
}
|
||||||
$drops = $target->getDrops($item); //Fixes tile entities being deleted before getting drops
|
$drops = $target->getDrops($item); //Fixes tile entities being deleted before getting drops
|
||||||
|
|
||||||
$players = $this->getUsingChunk($target->x >> 4, $target->z >> 4);
|
$players = $this->getChunkPlayers($target->x >> 4, $target->z >> 4);
|
||||||
if($player !== null){
|
if($player !== null){
|
||||||
unset($players[$player->getId()]);
|
unset($players[$player->getLoaderId()]);
|
||||||
$this->addParticle(new DestroyBlockParticle($target->add(0.5, 0.5, 0.5), $target), $players);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$pk = new LevelEventPacket();
|
||||||
|
$pk->evid = 2001;
|
||||||
|
$pk->x = $target->x + 0.5;
|
||||||
|
$pk->y = $target->y + 0.5;
|
||||||
|
$pk->z = $target->z + 0.5;
|
||||||
|
$pk->data = $target->getId() + ($target->getDamage() << 12);
|
||||||
|
Server::broadcastPacket($players, $pk->setChannel(Network::CHANNEL_WORLD_EVENTS));
|
||||||
|
|
||||||
$target->onBreak($item);
|
$target->onBreak($item);
|
||||||
|
|
||||||
@ -2125,7 +2133,7 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
$this->chunkSendQueue[$index] = [];
|
$this->chunkSendQueue[$index] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->chunkSendQueue[$index][spl_object_hash($player)] = $player;
|
$this->chunkSendQueue[$index][$player->getLoaderId()] = $player;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function processChunkRequest(){
|
private function processChunkRequest(){
|
||||||
|
Reference in New Issue
Block a user