mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-18 11:45:30 +00:00
Sign NBT data on Player, send chests NBT
This commit is contained in:
parent
291ba5c499
commit
4a05f04a00
@ -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;
|
||||
|
@ -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:
|
||||
|
@ -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));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user