From d4036d8ac922ad0fc2ff0960d8d6f87510b65f3c Mon Sep 17 00:00:00 2001 From: GameHerobrine Date: Wed, 25 Jun 2025 03:22:24 +0300 Subject: [PATCH] tile entity related packets use block update queue, cleaned up unused code, some phpdocs --- src/API/AchievementAPI.php | 29 +++- src/API/BanAPI.php | 38 ++-- src/Player.php | 164 ++++++++++-------- src/material/block/plant/BeetrootBlock.php | 1 - src/material/block/plant/CactusBlock.php | 1 - src/material/block/plant/CarrotBlock.php | 1 - src/material/block/plant/MelonStemBlock.php | 1 - src/material/block/plant/PotatoBlock.php | 1 - src/material/block/plant/PumpkinStemBlock.php | 1 - src/material/block/plant/SaplingBlock.php | 1 - src/material/block/plant/WheatBlock.php | 1 - src/material/block/solid/IceBlock.php | 1 - .../protocol/packet/EntityEventPacket.php | 4 + src/world/Explosion.php | 18 +- src/world/Tile.php | 15 +- 15 files changed, 165 insertions(+), 112 deletions(-) diff --git a/src/API/AchievementAPI.php b/src/API/AchievementAPI.php index beabe308..9f5d6e0d 100644 --- a/src/API/AchievementAPI.php +++ b/src/API/AchievementAPI.php @@ -81,7 +81,7 @@ class AchievementAPI{ ], ]; - + /** @var PocketMinecraftServer */ private $server; function __construct(){ @@ -91,9 +91,9 @@ class AchievementAPI{ /** * Add an achievement * @param string $achievementId - * @param string $achievementName - * @param array $requires - * @return boolean + * @param string $achievementName display name + * @param array $requires a list of achievement ids, optional + * @return boolean true if the achievement was added. false if the achievement with this id already exists. */ public static function addAchievement($achievementId, $achievementName, array $requires = []){ if(!isset(self::$achievements[$achievementId])){ @@ -106,6 +106,12 @@ class AchievementAPI{ return false; } + /** + * Gives the achievement to player + * @param Player $player + * @param string $achievementId + * @return boolean + */ public static function grantAchievement(Player $player, $achievementId){ if(isset(self::$achievements[$achievementId]) and !self::hasAchievement($player, $achievementId)){ foreach(self::$achievements[$achievementId]["requires"] as $requerimentId){ @@ -124,6 +130,11 @@ class AchievementAPI{ return false; } + /** + * @param Player $player + * @param string $achievementId + * @return boolean + */ public static function hasAchievement(Player $player, $achievementId){ if(!isset(self::$achievements[$achievementId]) or !isset($player->achievements)){ $player->achievements = []; @@ -136,6 +147,11 @@ class AchievementAPI{ return true; } + /** + * @param Player $player + * @param string $achievementId + * @return boolean + */ public static function broadcastAchievement(Player $player, $achievementId){ if(isset(self::$achievements[$achievementId])){ $result = ServerAPI::request()->api->dhandle("achievement.broadcast", ["player" => $player, "achievementId" => $achievementId]); @@ -151,6 +167,11 @@ class AchievementAPI{ return false; } + /** + * Removes achievement from player. + * @param Player $player + * @param string $achievementId + */ public static function removeAchievement(Player $player, $achievementId){ if(self::hasAchievement($player, $achievementId)){ $player->achievements[$achievementId] = false; diff --git a/src/API/BanAPI.php b/src/API/BanAPI.php index 7ab128b6..ecd2f7be 100644 --- a/src/API/BanAPI.php +++ b/src/API/BanAPI.php @@ -1,11 +1,8 @@ server = ServerAPI::request(); } @@ -56,7 +57,6 @@ class BanAPI{ /** * @param mixed $data * @param string $event - * * @return boolean */ public function permissionsCheck($data, $event){ @@ -106,11 +106,11 @@ class BanAPI{ } /** + * Checks is player op or not * @param string $username - * * @return boolean */ - public function isOp($username){//Is a player op? + public function isOp($username){ $username = strtolower($username); if($this->server->api->dhandle("op.check", $username) === true){ return true; @@ -121,6 +121,7 @@ class BanAPI{ } /** + * Bans a player. * @param string $username */ public function ban($username){ @@ -316,14 +317,16 @@ class BanAPI{ } /** - * @param string $username - * @param string $reason + * Kicks a player + * @param string $username - player's username + * @param string $reason - kick reason, optional */ public function kick($username, $reason = "No Reason"){ $this->commandHandler("kick", [$username, $reason], "console", ""); } /** + * Unbans a player * @param string $username */ public function pardon($username){ @@ -331,6 +334,7 @@ class BanAPI{ } /** + * Bans some ip * @param string $ip */ public function banIP($ip){ @@ -338,12 +342,16 @@ class BanAPI{ } /** + * Unbans some ip * @param string $ip */ public function pardonIP($ip){ $this->commandHandler("banip", ["pardon", $ip], "console", ""); } + /** + * Rereads ban list, kick list and banip list + */ public function reload(){ $this->commandHandler("ban", ["reload"], "console", ""); $this->commandHandler("banip", ["reload"], "console", ""); @@ -351,8 +359,8 @@ class BanAPI{ } /** + * Checks is ip banned or not * @param string $ip - * * @return boolean */ public function isIPBanned($ip){ @@ -366,8 +374,8 @@ class BanAPI{ } /** + * Checks is username banned or not. * @param string $username - * * @return boolean */ public function isBanned($username){ @@ -382,8 +390,8 @@ class BanAPI{ } /** + * Checks is username in the whitelist or not * @param string $username - * * @return boolean */ public function inWhitelist($username){ diff --git a/src/Player.php b/src/Player.php index cf6fc528..25738e78 100755 --- a/src/Player.php +++ b/src/Player.php @@ -38,7 +38,6 @@ class Player{ public $lastCorrect; public $craftingItems = []; public $toCraft = []; - public $lastCraft = 0; public $loginData = []; /** @var Level */ public $level; @@ -95,6 +94,7 @@ class Player{ public $entityMovementQueue; public $entityMovementQueuePrevSentCnt = 0; public $entityMovementQueueLength = 0; + /** * Used only for statistic in ping command. * @var integer @@ -104,13 +104,13 @@ class Player{ public $blockUpdateQueue; public $blockUpdateQueueLength = 0; - public $blockUpdateQueuePrevSentCnt = 0; public $blockUpdateQueueOrderIndex = 0; public $chatMessagesQueue; public $chatMessagesQueueLength = 0; - public $chatMessagesQueuePrevSentCnt = 0; public $chatMessagesOrderIndex = 0; + + public $chunkDataSent = []; /** @@ -408,10 +408,32 @@ class Player{ } /** - * @param integer $id - * @param array $data - * - * @return array|bool + * Sends data packet that wont be buffered. Packets are not ordered. + * @param RakNetDataPacket $packet + * @param int $reliability=0 unused + * @param bool $recover=true can the packet be recovered or not. If true the packet will be recovered only once. Otherwise, it won't be recovered at all. + * @returns int[]|false - array with seqNumber of the packet. false if player is not connected. empty array if cancelled by DataPacketSendEvent. + */ + public function directDataPacket(RakNetDataPacket $packet, $reliability = 0, $recover = true){ + if($this->connected === false) return false; + if(EventHandler::callEvent(new DataPacketSendEvent($this, $packet)) === BaseEvent::DENY) return []; + + $packet->encode(); + $pk = new RakNetPacket(RakNetInfo::DATA_PACKET_0); + $pk->data[] = $packet; + $pk->seqNumber = $this->counter[0]++; + $pk->sendtime = microtime(true); + if($recover !== false){ + $this->recoveryQueue[$pk->seqNumber] = $pk; + } + + $this->send($pk); + return [$pk->seqNumber]; + } + + /** + * Sends data packet that will be recovered only once. Packet MAY not arrive at all or arrive out of order. + * @param RakNetDataPacket $packet */ public function dataPacket(RakNetDataPacket $packet){ if($this->connected === false) return false; @@ -435,9 +457,13 @@ class Player{ return []; } + /** + * Sends data packet that will always be recovered. Packets MAY arrive out of order. + * @param RakNetDataPacket $packet + */ public function dataPacketAlwaysRecover(RakNetDataPacket $packet){ if($this->connected === false) return false; - if(EventHandler::callEvent(new DataPacketSendEvent($this, $packet)) === BaseEvent::DENY) return; + if(EventHandler::callEvent(new DataPacketSendEvent($this, $packet)) === BaseEvent::DENY) return false; $pk = new RakNetPacket(RakNetInfo::DATA_PACKET_0); $pk->data[] = $packet; @@ -459,11 +485,7 @@ class Player{ return [$pk->seqNumber]; } - public function sendChunkDataPacket(RakNetDataPacket $pk){ - if($this->connected === false) return false; - if(EventHandler::callEvent(new DataPacketSendEvent($this, $pk)) === BaseEvent::DENY) return; - - $pk->encode(); + public function blockQueueDataPacket_big(RakNetDataPacket $pk){ $sendtime = microtime(true); $size = $this->MTU - 34; if($size <= 0) return false; @@ -719,7 +741,7 @@ class Player{ $pk->chunkX = $X; $pk->chunkZ = $Z; $pk->data = $this->level->getOrderedChunk($X, $Z, $Yndex); - $cnt = $this->sendChunkDataPacket($pk); + $cnt = $this->blockQueueDataPacket($pk); $this->chunkDataSent["$X:$Z"] = true; $tiles = $this->server->query("SELECT ID FROM tiles WHERE spawnable = 1 AND level = '{$this->level->getName()}' AND x >= $minX AND x <= $maxX AND z >= $minZ AND z <= $maxZ;"); @@ -816,7 +838,7 @@ class Player{ $pk->chunkX = $X; $pk->chunkZ = $Z; $pk->data = $this->level->getOrderedChunk($X, $Z, $Yndex); - $cnt = $this->sendChunkDataPacket($pk); + $cnt = $this->blockQueueDataPacket($pk); $this->chunkDataSent["$X:$Z"] = true; if($cnt === false){ @@ -934,13 +956,13 @@ class Player{ $pk->windowid = $id; $pk->property = 0; //Smelting $pk->value = floor($data->data["CookTime"]); - $this->dataPacket($pk); + $this->blockQueueDataPacket($pk); $pk = new ContainerSetDataPacket; $pk->windowid = $id; $pk->property = 1; //Fire icon $pk->value = $data->data["BurnTicks"]; - $this->dataPacket($pk); + $this->blockQueueDataPacket($pk); } } } @@ -954,7 +976,7 @@ class Player{ $pk->windowid = $id; $pk->slot = $data["slot"] + ($data["offset"] ?? 0); $pk->item = $data["slotdata"]; - $this->dataPacket($pk); + $this->blockQueueDataPacket($pk); } } } @@ -1029,7 +1051,6 @@ class Player{ $this->dataPacket($pk); break; case "entity.animate": - $pk = new AnimatePacket; $pk->eid = $data["eid"]; $pk->action = $data["action"]; //1 swing arm, @@ -1495,12 +1516,48 @@ class Player{ $this->blockUpdateQueue->data = []; } + /** + * Sends packet in block order channel. Packets are always delivered and ordered. + * Used for sending tileentity data, chunk data, updateblock packets. + * @param RakNetPacket $pk + */ + public function blockQueueDataPacket(RakNetDataPacket $pk){ + if($this->connected === false) return false; + if(EventHandler::callEvent(new DataPacketSendEvent($this, $pk)) === BaseEvent::DENY) return; + + $pk->encode(); + + $len = 1 + strlen($pk->buffer); + $MTU = $this->MTU - 24; + if($len > $MTU) return $this->blockQueueDataPacket_big($pk); + + if(($this->blockUpdateQueueLength + $len) >= $MTU){ + $this->sendBlockUpdateQueue(); + } + + $pk->messageIndex = $this->counter[3]++; + $pk->reliability = 3; + $pk->orderChannel = Player::BLOCKUPDATE_ORDER_CHANNEL; + $pk->orderIndex = $this->blockUpdateQueueOrderIndex++; + @$this->blockUpdateQueue->data[] = $pk; + $this->blockUpdateQueueLength += 10 + $len; + } + + /** + * Adds block update into queue. Does nothing if chunk wasnt loaded. + * @param int $x + * @param int $y + * @param int $z + * @param int $id + * @param int $meta + * @return boolean + */ public function addBlockUpdateIntoQueue($x, $y, $z, $id, $meta){ $xC = $x >> 4; $zC = $z >> 4; if(!isset($this->chunkDataSent["$xC:$zC"])){ ConsoleAPI::debug("Ignoring block update $x $y $z $id $meta: chunk data was not sent."); - return; //dont send updateblockpacket as it will be buffered and updated only after all chunks will load + return false; //dont send updateblockpacket as it will be buffered and updated only after all chunks will load } $packet = new UpdateBlockPacket(); $packet->x = $x; @@ -1508,21 +1565,7 @@ class Player{ $packet->z = $z; $packet->block = $id; $packet->meta = $meta; - $packet->encode(); - - $len = 1 + strlen($packet->buffer); - $MTU = $this->MTU - 24; - - if(($this->blockUpdateQueueLength + $len) >= $MTU){ - $this->sendBlockUpdateQueue(); - } - - $packet->messageIndex = $this->counter[3]++; - $packet->reliability = 3; - $packet->orderChannel = Player::BLOCKUPDATE_ORDER_CHANNEL; - $packet->orderIndex = $this->blockUpdateQueueOrderIndex++; - @$this->blockUpdateQueue->data[] = $packet; - $this->blockUpdateQueueLength += 10 + $len; + $this->blockQueueDataPacket($packet); } public function addEntityMovementUpdateToQueue(Entity $e){ @@ -1699,28 +1742,12 @@ class Player{ $this->data->set("gamemode", $this->gamemode); } } - - public function directDataPacket(RakNetDataPacket $packet, $reliability = 0, $recover = true){ - if($this->connected === false) return false; - if(EventHandler::callEvent(new DataPacketSendEvent($this, $packet)) === BaseEvent::DENY) return []; - - $packet->encode(); - $pk = new RakNetPacket(RakNetInfo::DATA_PACKET_0); - $pk->data[] = $packet; - $pk->seqNumber = $this->counter[0]++; - $pk->sendtime = microtime(true); - if($recover !== false){ - $this->recoveryQueue[$pk->seqNumber] = $pk; - } - - $this->send($pk); - return [$pk->seqNumber]; - } public function sendChatMessagePacket(RakNetDataPacket $packet){ if($this->connected === false) return false; if(EventHandler::callEvent(new DataPacketSendEvent($this, $packet)) === BaseEvent::DENY) return false; + //TODO big chat messages support $packet->encode(); $len = strlen($packet->buffer) + 1; $MTU = $this->MTU - 24; @@ -2271,7 +2298,6 @@ class Player{ if($slotItem !== false){ if($slotItem->count == 1) $this->inventory[$this->slot] = BlockAPI::getItem(AIR, 0, 0); else $slotItem->count -= 1; - //$this->sendInventory(); } } @@ -2516,7 +2542,7 @@ class Player{ if($this->entity->getHealth() < 20 && $foodHeal != 0){ $pk = new EntityEventPacket; $pk->eid = 0; - $pk->event = 9; + $pk->event = EntityEventPacket::ENTITY_COMPLETE_USING_ITEM; $this->dataPacket($pk); $this->entity->heal($foodHeal, "eating"); @@ -2743,18 +2769,18 @@ class Player{ $slot = $tile->getSlot($slotn); if($this->server->api->dhandle("player.container.slot", [ - "tile" => $tile, - "slot" => $packet->slot, - "offset" => $offset, - "slotdata" => $slot, - "itemdata" => $item, - "player" => $this - ]) === false){ + "tile" => $tile, + "slot" => $packet->slot, + "offset" => $offset, + "slotdata" => $slot, + "itemdata" => $item, + "player" => $this + ]) === false){ $pk = new ContainerSetSlotPacket; $pk->windowid = $packet->windowid; $pk->slot = $packet->slot; $pk->item = $slot; - $this->dataPacket($pk); + $this->blockQueueDataPacket($pk); break; } @@ -2782,17 +2808,17 @@ class Player{ $slot = $tile->getSlot($packet->slot); if($this->server->api->dhandle("player.container.slot", [ - "tile" => $tile, - "slot" => $packet->slot, - "slotdata" => $slot, - "itemdata" => $item, - "player" => $this, - ]) === false){ + "tile" => $tile, + "slot" => $packet->slot, + "slotdata" => $slot, + "itemdata" => $item, + "player" => $this, + ]) === false){ $pk = new ContainerSetSlotPacket; $pk->windowid = $packet->windowid; $pk->slot = $packet->slot; $pk->item = $slot; - $this->dataPacket($pk); + $this->blockQueueDataPacket($pk); break; } diff --git a/src/material/block/plant/BeetrootBlock.php b/src/material/block/plant/BeetrootBlock.php index 05d2c646..312b63bd 100644 --- a/src/material/block/plant/BeetrootBlock.php +++ b/src/material/block/plant/BeetrootBlock.php @@ -14,7 +14,6 @@ class BeetrootBlock extends FlowableBlock{ $down = $this->getSide(0); if($down->getID() === FARMLAND){ $this->level->setBlock($block, $this, true, false, true); - $this->level->scheduleBlockUpdate(new Position($this, 0, 0, $this->level), Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM); return true; } return false; diff --git a/src/material/block/plant/CactusBlock.php b/src/material/block/plant/CactusBlock.php index b218d8b9..5c6bdd6b 100644 --- a/src/material/block/plant/CactusBlock.php +++ b/src/material/block/plant/CactusBlock.php @@ -62,7 +62,6 @@ class CactusBlock extends TransparentBlock{ $block3 = $this->getSide(5); if($block0->isFlowable === true and $block1->isFlowable === true and $block2->isFlowable === true and $block3->isFlowable === true){ $this->level->setBlock($this, $this, true, false, true); - $this->level->scheduleBlockUpdate(new Position($this, 0, 0, $this->level), Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM); ServerAPI::request()->api->block->scheduleBlockUpdate(clone $this, 10, BLOCK_UPDATE_NORMAL); return true; } diff --git a/src/material/block/plant/CarrotBlock.php b/src/material/block/plant/CarrotBlock.php index 98717892..4bcd86b9 100644 --- a/src/material/block/plant/CarrotBlock.php +++ b/src/material/block/plant/CarrotBlock.php @@ -14,7 +14,6 @@ class CarrotBlock extends FlowableBlock{ $down = $this->getSide(0); if($down->getID() === FARMLAND){ $this->level->setBlock($block, $this, true, false, true); - $this->level->scheduleBlockUpdate(new Position($this, 0, 0, $this->level), Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM); return true; } return false; diff --git a/src/material/block/plant/MelonStemBlock.php b/src/material/block/plant/MelonStemBlock.php index 10500032..c98d8677 100644 --- a/src/material/block/plant/MelonStemBlock.php +++ b/src/material/block/plant/MelonStemBlock.php @@ -13,7 +13,6 @@ class MelonStemBlock extends FlowableBlock{ $down = $this->getSide(0); if($down->getID() === FARMLAND){ $this->level->setBlock($block, $this, true, false, true); - $this->level->scheduleBlockUpdate(new Position($this, 0, 0, $this->level), Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM); return true; } return false; diff --git a/src/material/block/plant/PotatoBlock.php b/src/material/block/plant/PotatoBlock.php index d8f86f38..15866171 100644 --- a/src/material/block/plant/PotatoBlock.php +++ b/src/material/block/plant/PotatoBlock.php @@ -14,7 +14,6 @@ class PotatoBlock extends FlowableBlock{ $down = $this->getSide(0); if($down->getID() === FARMLAND){ $this->level->setBlock($block, $this, true, false, true); - $this->level->scheduleBlockUpdate(new Position($this, 0, 0, $this->level), Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM); return true; } return false; diff --git a/src/material/block/plant/PumpkinStemBlock.php b/src/material/block/plant/PumpkinStemBlock.php index ac34ed7d..c662af3a 100644 --- a/src/material/block/plant/PumpkinStemBlock.php +++ b/src/material/block/plant/PumpkinStemBlock.php @@ -13,7 +13,6 @@ class PumpkinStemBlock extends FlowableBlock{ $down = $this->getSide(0); if($down->getID() === FARMLAND){ $this->level->setBlock($block, $this, true, false, true); - $this->level->scheduleBlockUpdate(new Position($this, 0, 0, $this->level), Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM); return true; } return false; diff --git a/src/material/block/plant/SaplingBlock.php b/src/material/block/plant/SaplingBlock.php index bd5635d0..49ae119e 100644 --- a/src/material/block/plant/SaplingBlock.php +++ b/src/material/block/plant/SaplingBlock.php @@ -29,7 +29,6 @@ class SaplingBlock extends FlowableBlock{ $down = $this->getSide(0); if($down->getID() === GRASS or $down->getID() === DIRT or $down->getID() === FARMLAND){ $this->level->setBlock($block, $this, true, false, true); - $this->level->scheduleBlockUpdate(new Position($this, 0, 0, $this->level), Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM); return true; } return false; diff --git a/src/material/block/plant/WheatBlock.php b/src/material/block/plant/WheatBlock.php index 97f3d39f..3e25d2ea 100644 --- a/src/material/block/plant/WheatBlock.php +++ b/src/material/block/plant/WheatBlock.php @@ -14,7 +14,6 @@ class WheatBlock extends FlowableBlock{ $down = $this->getSide(0); if($down->getID() === FARMLAND){ $this->level->setBlock($block, $this, true, false, true); - $this->level->scheduleBlockUpdate(new Position($this, 0, 0, $this->level), Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM); return true; } return false; diff --git a/src/material/block/solid/IceBlock.php b/src/material/block/solid/IceBlock.php index 52079e10..3b74cab2 100644 --- a/src/material/block/solid/IceBlock.php +++ b/src/material/block/solid/IceBlock.php @@ -17,7 +17,6 @@ class IceBlock extends TransparentBlock{ public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $ret = $this->level->setBlock($this, $this, true, false, true); - $this->level->scheduleBlockUpdate(new Position($this, 0, 0, $this->level), Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM); return $ret; } diff --git a/src/network/protocol/packet/EntityEventPacket.php b/src/network/protocol/packet/EntityEventPacket.php index 05cf7770..44e9b06a 100644 --- a/src/network/protocol/packet/EntityEventPacket.php +++ b/src/network/protocol/packet/EntityEventPacket.php @@ -6,6 +6,10 @@ class EntityEventPacket extends RakNetDataPacket{ const ENTITY_DAMAGE = 2; const ENTITY_DEAD = 3; + /** + * Works only for player entities + */ + const ENTITY_COMPLETE_USING_ITEM = 9; const ENTITY_ANIM_10 = 10; public function __construct($eid = null, $event = null){ diff --git a/src/world/Explosion.php b/src/world/Explosion.php index e44c7bd3..0a8e041d 100644 --- a/src/world/Explosion.php +++ b/src/world/Explosion.php @@ -1,16 +1,10 @@ DIRT, - STONE => COBBLESTONE, - COAL_ORE => COAL, - DIAMOND_ORE => DIAMOND, - REDSTONE_ORE => REDSTONE, - ]; public static $enableExplosions = true; - public $level; //Rays + /** @var Level */ + public $level; + /** @var Position */ public $source; public $size; public $affectedBlocks = []; @@ -222,4 +216,10 @@ class Explosion{ $pk->records = $send; $server->api->player->broadcastPacket($this->level->players, $pk); } + + + /** + * @deprecated unused + */ + public static $specialDrops = []; } diff --git a/src/world/Tile.php b/src/world/Tile.php index 66b20280..5f4714a5 100644 --- a/src/world/Tile.php +++ b/src/world/Tile.php @@ -283,7 +283,10 @@ class Tile extends Position{ $pk->z = $this->z; $pk->case1 = 1; $pk->case2 = 2; - $this->server->api->player->broadcastPacket($this->server->api->player->getAll($this->level), $pk); + foreach($this->level->players as $player){ + $player->blockQueueDataPacket(clone $pk); + } + for($s = 0; $s < CHEST_SLOTS; ++$s){ $slot = $this->getSlot($s); if($slot->getID() > AIR and $slot->count > 0){ @@ -297,7 +300,7 @@ class Tile extends Position{ $pk = new ContainerSetContentPacket; $pk->windowid = $id; $pk->slots = $slots; - $player->dataPacket($pk); + $player->blockQueueDataPacket($pk); return true; }elseif($this->class === TILE_FURNACE){ $player->windowCnt++; @@ -311,7 +314,7 @@ class Tile extends Position{ $pk->x = $this->x; $pk->y = $this->y; $pk->z = $this->z; - $player->dataPacket($pk); + $player->blockQueueDataPacket($pk); $slots = []; for($s = 0; $s < FURNACE_SLOTS; ++$s){ @@ -325,7 +328,7 @@ class Tile extends Position{ $pk = new ContainerSetContentPacket; $pk->windowid = $id; $pk->slots = $slots; - $player->dataPacket($pk); + $player->blockQueueDataPacket($pk); return true; } } @@ -375,7 +378,7 @@ class Tile extends Position{ $pk->y = $this->y; $pk->z = $this->z; $pk->namedtag = $nbt->binary; - $player->dataPacketAlwaysRecover($pk); + $player->blockQueueDataPacket($pk); break; case TILE_SIGN: $nbt = new NBT(); @@ -420,7 +423,7 @@ class Tile extends Position{ $pk->y = $this->y; $pk->z = $this->z; $pk->namedtag = $nbt->binary; - $player->dataPacketAlwaysRecover($pk); + $player->blockQueueDataPacket($pk); break; } }