diff --git a/src/Player.php b/src/Player.php index 1be56a19..170b0d67 100755 --- a/src/Player.php +++ b/src/Player.php @@ -238,7 +238,7 @@ class Player{ $this->entity->calculateVelocity(); if($terrain === true){ $this->orderChunks(); - $this->getNextChunk(); + //$this->getNextChunk(); } $this->entity->check = true; if($force === true){ @@ -428,7 +428,27 @@ class Player{ } asort($this->chunksOrder); } + + public function useChunk($X, $Z){ + $Yndex = 0; + for($iY = 0; $iY < 8; ++$iY){ + if(isset($this->chunksOrder["$X:$iY:$Z"])){ + unset($this->chunksOrder["$X:$iY:$Z"]); + $this->chunksLoaded["$X:$iY:$Z"] = true; + $Yndex |= 1 << $iY; + } + } + $pk = new ChunkDataPacket; + $pk->chunkX = $X; + $pk->chunkZ = $Z; + $pk->data = $this->level->getOrderedChunk($X, $Z, $Yndex); + $cnt = $this->dataPacket($pk); + if($cnt === false){ + return false; + } + } + public function getNextChunk(){ if($this->connected === false){ return false; @@ -457,7 +477,7 @@ class Player{ } $c = key($this->chunksOrder); - $d = $c != null ? $this->chunksOrder[$c] : null; //not sure why was ?? placed here + $d = $c != null ? $this->chunksOrder[$c] : null; if($c === null or $d === null){ $this->server->schedule(40, [$this, "getNextChunk"]); return false; @@ -1538,6 +1558,7 @@ class Player{ } break; case ProtocolInfo::REQUEST_CHUNK_PACKET: + $this->useChunk($packet->chunkX, $packet->chunkZ); break; case ProtocolInfo::USE_ITEM_PACKET: if(!($this->entity instanceof Entity)){ diff --git a/src/entity/animal/Sheep.php b/src/entity/animal/Sheep.php index 9f0aa9f0..5ea8380e 100644 --- a/src/entity/animal/Sheep.php +++ b/src/entity/animal/Sheep.php @@ -26,7 +26,7 @@ class Sheep extends Animal{ public function getMetadata(){ $d = parent::getMetadata(); if(!isset($this->data["Sheared"])){ - $this->data["Sheared"] = NOT_SHEARED; + $this->data["Sheared"] = Sheep::NOT_SHEARED; } if(!isset($this->data["Color"])){ //Make a new random color if it is not in data $this->data["Color"] = $this->sheepColor(); diff --git a/src/material/block/misc/NetherReactor.php b/src/material/block/misc/NetherReactor.php index f1a3afc3..b692c9fd 100644 --- a/src/material/block/misc/NetherReactor.php +++ b/src/material/block/misc/NetherReactor.php @@ -9,7 +9,7 @@ class NetherReactorBlock extends SolidBlock{ public function onActivate(Item $item, Player $player){ //if(($item->getID() === IRON_SWORD || $item->getID() === WOODEN_SWORD || $item->getID() === STONE_SWORD || $item->getID() === DIAMOND_SWORD || $item->getID() === GOLD_SWORD) /*&& $player->gamemode === 0*/){ - if($this->isCorrect($this->getX(),$this->getY(),$this->getZ()) && $this->getY() < 101){ + if($this->isCorrect($this->getX(),$this->getY(),$this->getZ()) && $this->getY() < 101 && NetherReactorBlock::$enableReactor){ NetherReactorStructure::buildReactor($this->level, $this->getX(),$this->getY(),$this->getZ()); $this->meta = 1; $this->level->setBlock($this,$this);