diff --git a/src/Player.php b/src/Player.php index fbf9bb92c..0434d0ca8 100644 --- a/src/Player.php +++ b/src/Player.php @@ -1628,21 +1628,6 @@ class Player{ $this->entity->updateMetadata(); } break; - /*case MC_SIGN_UPDATE: - if($this->spawned === false or $this->blocked === true){ - break; - } - $this->craftingItems = array(); - $this->toCraft = array(); - $t = $this->server->api->tile->get(new Position($data["x"], $data["y"], $data["z"], $this->level)); - if(($t instanceof Tile) and $t->class === TILE_SIGN){ - if($t->data["creator"] !== $this->username){ - $t->spawn($this); - }else{ - $t->setText($data["line0"], $data["line1"], $data["line2"], $data["line3"]); - } - } - break;*/ case MC_CHAT: if($this->spawned === false){ break; @@ -1786,6 +1771,28 @@ class Player{ break; } break; + case MC_ENTITY_DATA: + if($this->spawned === false or $this->blocked === true){ + break; + } + $this->craftingItems = array(); + $this->toCraft = array(); + $t = $this->server->api->tile->get(new Position($data["x"], $data["y"], $data["z"], $this->level)); + if(($t instanceof Tile) and $t->class === TILE_SIGN){ + if($t->data["creator"] !== $this->username){ + $t->spawn($this); + }else{ + $nbt = new NBT(); + $nbt->load($data["namedtag"]); + $d = array_shift($nbt->tree); + if($d["id"] !== TILE_SIGN){ + $t->spawn($this); + }else{ + $t->setText($d["Text1"], $d["Text2"], $d["Text3"], $d["Text4"]); + } + } + } + break; default: console("[DEBUG] Unhandled 0x".dechex($pid)." Data Packet for Client ID ".$this->clientID.": ".print_r($data, true), true, true, 2); break; diff --git a/src/network/CustomPacketHandler.php b/src/network/CustomPacketHandler.php index d06232e59..fe137d523 100644 --- a/src/network/CustomPacketHandler.php +++ b/src/network/CustomPacketHandler.php @@ -844,7 +844,7 @@ class CustomPacketHandler{ $this->raw .= Utils::writeShort($this->data["x"]); $this->raw .= chr($this->data["y"]); $this->raw .= Utils::writeShort($this->data["z"]); - $this->raw .= Utils::writeShort($this->data["namedtag"]); + $this->raw .= $this->data["namedtag"]; } break; default: diff --git a/src/world/Tile.php b/src/world/Tile.php index 78b756fd1..7aa80e757 100644 --- a/src/world/Tile.php +++ b/src/world/Tile.php @@ -244,24 +244,24 @@ class Tile extends Position{ $nbt->write(chr(NBT::TAG_INT)); $nbt->writeTAG_String("x"); - $nbt->writeTAG_String((int) $this->x); + $nbt->writeTAG_Int((int) $this->x); $nbt->write(chr(NBT::TAG_INT)); $nbt->writeTAG_String("y"); - $nbt->writeTAG_String((int) $this->y); + $nbt->writeTAG_Int((int) $this->y); $nbt->write(chr(NBT::TAG_INT)); $nbt->writeTAG_String("z"); - $nbt->writeTAG_String((int) $this->z); + $nbt->writeTAG_Int((int) $this->z); if($this->isPaired()){ $nbt->write(chr(NBT::TAG_INT)); $nbt->writeTAG_String("pairx"); - $nbt->writeTAG_String((int) $this->data["pairx"]); + $nbt->writeTAG_Int((int) $this->data["pairx"]); $nbt->write(chr(NBT::TAG_INT)); $nbt->writeTAG_String("pairz"); - $nbt->writeTAG_String((int) $this->data["pairz"]); + $nbt->writeTAG_Int((int) $this->data["pairz"]); } $nbt->write(chr(NBT::TAG_END)); @@ -299,15 +299,15 @@ class Tile extends Position{ $nbt->write(chr(NBT::TAG_INT)); $nbt->writeTAG_String("x"); - $nbt->writeTAG_String((int) $this->x); + $nbt->writeTAG_Int((int) $this->x); $nbt->write(chr(NBT::TAG_INT)); $nbt->writeTAG_String("y"); - $nbt->writeTAG_String((int) $this->y); + $nbt->writeTAG_Int((int) $this->y); $nbt->write(chr(NBT::TAG_INT)); $nbt->writeTAG_String("z"); - $nbt->writeTAG_String((int) $this->z); + $nbt->writeTAG_Int((int) $this->z); $nbt->write(chr(NBT::TAG_END));