diff --git a/src/Player.php b/src/Player.php index c76db12d..679f9698 100755 --- a/src/Player.php +++ b/src/Player.php @@ -1784,19 +1784,12 @@ class Player{ if($target->linkedEntity != null){ break; } - $players = $this->server->api->player->getAll($this->level); - $pk = new SetEntityLinkPacket; - $pk->rider = $target->eid; - $pk->riding = $this->entity->eid; - $pk->type = 2; - $this->server->api->player->broadcastPacket([$this], $pk); - $target->linkedEntity = $this->entity; $this->entity->isInMinecart = true; $pk = new SetEntityLinkPacket(); $pk->rider = $target->eid; $pk->riding = $this->entity->eid; - $pk->type = 2; + $pk->type = 1; $this->dataPacket($pk); $needsBreak = true; @@ -2272,6 +2265,8 @@ class Player{ } } break; + case ProtocolInfo::PLAYER_INPUT_PACKET: + break; //TODO player input- default: console("[DEBUG] Unhandled 0x" . dechex($packet->pid()) . " data packet for " . $this->username . " (" . $this->clientID . "): " . print_r($packet, true), true, true, 2); break; diff --git a/src/dependencies.php b/src/dependencies.php index 6eb46070..21110b9c 100644 --- a/src/dependencies.php +++ b/src/dependencies.php @@ -96,7 +96,6 @@ require_once(FILE_PATH . "/src/material/Item.php"); require_once(FILE_PATH . "/src/material/item/armor/ArmorItem.php"); - require_all(FILE_PATH . "src/"); $inc = get_included_files(); diff --git a/src/material/block/nonfull/Rail.php b/src/material/block/nonfull/Rail.php index 78ee223b..2ffafd91 100644 --- a/src/material/block/nonfull/Rail.php +++ b/src/material/block/nonfull/Rail.php @@ -2,23 +2,16 @@ class RailBlock extends FlowableBlock{ public function __construct($meta = 0){ - parent::__construct(RAIL, 0, "Rail"); + parent::__construct(RAIL, $meta, "Rail"); $this->hardness = 0.7; $this->isFullBlock = false; - $this->isSolid = true; - $this->meta = $meta; + $this->isSolid = false; } public static $shouldconnectrails = false; private function isRailBlock($id){ - switch($id){ - case RAIL: - case POWERED_RAIL: - return true; - default: - return false; - } + return $id === RAIL || $id === POWERED_RAIL; } private function isValidRailMeta($meta){ @@ -61,14 +54,15 @@ class RailBlock extends FlowableBlock{ $rail->getFloorY() + $y, $rail->getFloorZ() + $blocks[0][1] ); - $idToConnect = $rail->level->getBlock(v3.getFloorX(), v3.getFloorY(), v3.getFloorZ())->getID(); - $metaToConnect = $rail->level->getBlock(v3.getFloorX(), v3.getFloorY(), v3.getFloorZ())->getMetadata(); + $railBlock = $rail->level->getBlock($v3); + $idToConnect = $railBlock->getID(); + $metaToConnect = $railBlock->getMetadata(); if (!$this->isRailBlock($idToConnect) || !$this->isValidRailMeta($metaToConnect)) continue; - $xDiff = $damage - $v3->getFloorX(); - $zDiff = $damage - $v3->getFloorZ(); + $xDiff = $this->getFloorX() - $v3->getFloorX(); + $zDiff = $this->getFloorZ() - $v3->getFloorZ(); foreach($blocks as $xz) { - if($xz[0] !== xDiff || $xz[1] !== zDiff) continue; - array_push($connected[], $v3); + if($xz[0] !== $xDiff || $xz[1] !== $zDiff) continue; + $connected[] = $v3; } } foreach($deltaY as $y){ @@ -77,14 +71,15 @@ class RailBlock extends FlowableBlock{ $rail->getFloorY() + $y, $rail->getFloorZ() + $blocks[1][1] ); - $idToConnect = $rail->level->getBlock(v3.getFloorX(), v3.getFloorY(), v3.getFloorZ())->getID(); - $metaToConnect = $rail->level->getBlock(v3.getFloorX(), v3.getFloorY(), v3.getFloorZ())->getMetadata(); + $railBlock = $rail->level->getBlock($v3); + $idToConnect = $railBlock->getID(); + $metaToConnect = $railBlock->getMetadata(); if(!$this->isRailBlock($idToConnect) || !$this->isValidRailMeta($metaToConnect)) continue; - $xDiff = $damage - $v3.getFloorX(); - $zDiff = $damage - $v3.getFloorZ(); + $xDiff = $this->getFloorX() - $v3->getFloorX(); + $zDiff = $this->getFloorZ() - $v3->getFloorZ(); foreach($blocks as $xz){ if ($xz[0] !== $xDiff || $xz[1] !== $zDiff) continue; - array_push($connected[], $v3); + $connected[] = $v3; } } return $connected; @@ -111,7 +106,7 @@ class RailBlock extends FlowableBlock{ $this->meta = $subtract[0]->x === 0 ? 0 : 1; } } - $this->level->setBlock($rail, new RailBlock($this.getDamage()), true, true); + $this->level->setBlock($rail, new RailBlock($this->meta), true, true); } public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ diff --git a/src/network/protocol/ProtocolInfo.php b/src/network/protocol/ProtocolInfo.php index 44327fe7..09404291 100644 --- a/src/network/protocol/ProtocolInfo.php +++ b/src/network/protocol/ProtocolInfo.php @@ -73,7 +73,7 @@ abstract class ProtocolInfo{ const CHAT_PACKET = 0xb6; const ADVENTURE_SETTINGS_PACKET = 0xb7; const ENTITY_DATA_PACKET = 0xb8; - //const PLAYER_INPUT_PACKET = 0xb9; + const PLAYER_INPUT_PACKET = 0xb9; } /*Unused: diff --git a/src/network/raknet/RakNetParser.php b/src/network/raknet/RakNetParser.php index d0738753..fbfab4f5 100644 --- a/src/network/raknet/RakNetParser.php +++ b/src/network/raknet/RakNetParser.php @@ -325,6 +325,9 @@ class RakNetParser{ break; case ProtocolInfo::SET_ENTITY_LINK_PACKET: $data = new SetEntityLinkPacket; + case ProtocolInfo::PLAYER_INPUT_PACKET: + $data = new PlayerInputPacket; + break; default: $data = new UnknownPacket(); $data->packetID = $pid;