mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-22 12:39:43 +00:00
sending tile entities only once
This commit is contained in:
parent
03d5a05149
commit
0e796c8dd3
2 changed files with 28 additions and 17 deletions
|
|
@ -492,7 +492,7 @@ class Player{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$tiles = $this->server->query("SELECT ID FROM tiles WHERE spawnable = 1 AND level = '" . $this->level->getName() . "' AND x >= " . (($X << 4) - 1) . " AND x < " . (($X << 4) + 17) . " AND z >= " . (($Z << 4) - 1) . " AND z < " . (($Z << 4) + 17) . ";");
|
/*$tiles = $this->server->query("SELECT ID FROM tiles WHERE spawnable = 1 AND level = '" . $this->level->getName() . "' AND x >= " . (($X << 4) - 1) . " AND x < " . (($X << 4) + 17) . " AND z >= " . (($Z << 4) - 1) . " AND z < " . (($Z << 4) + 17) . ";");
|
||||||
$this->lastChunk = false;
|
$this->lastChunk = false;
|
||||||
if($tiles !== false and $tiles !== true){
|
if($tiles !== false and $tiles !== true){
|
||||||
while(($tile = $tiles->fetchArray(SQLITE3_ASSOC)) !== false){
|
while(($tile = $tiles->fetchArray(SQLITE3_ASSOC)) !== false){
|
||||||
|
|
@ -501,7 +501,7 @@ class Player{
|
||||||
$tile->spawn($this);
|
$tile->spawn($this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
//$this->stopUsingChunk($X, $Z); //just in case
|
//$this->stopUsingChunk($X, $Z); //just in case
|
||||||
$pk = new FullChunkDataPacket;
|
$pk = new FullChunkDataPacket;
|
||||||
$pk->chunkX = $X;
|
$pk->chunkX = $X;
|
||||||
|
|
|
||||||
|
|
@ -186,33 +186,44 @@ class Level{
|
||||||
}
|
}
|
||||||
|
|
||||||
$nbt = new NBT_new(NBT_new::LITTLE_ENDIAN);
|
$nbt = new NBT_new(NBT_new::LITTLE_ENDIAN);
|
||||||
foreach($chunkTiles as $tile){ //TODO non-hardcoded nbt data
|
foreach($chunkTiles as $tile){ //TODO rewrite TileEntity system
|
||||||
switch($tile->class){
|
switch($tile->class){
|
||||||
case "Sign":
|
case "Sign":
|
||||||
$text = $tile->getText();
|
$text = $tile->getText();
|
||||||
$nbt->setData(new Compound("", array(
|
$nbt->setData(new Compound("", array(
|
||||||
new StringTag("Text1", $text[0]),
|
new StringTag("Text1", $text[0]),
|
||||||
new StringTag("Text2", $text[1]),
|
new StringTag("Text2", $text[1]),
|
||||||
new StringTag("Text3", $text[2]),
|
new StringTag("Text3", $text[2]),
|
||||||
new StringTag("Text4", $text[3]),
|
new StringTag("Text4", $text[3]),
|
||||||
new StringTag("id", "Sign"),
|
new StringTag("id", "Sign"),
|
||||||
new IntTag("x", (int) $tile->x),
|
new IntTag("x", (int) $tile->x),
|
||||||
new IntTag("y", (int) $tile->y),
|
new IntTag("y", (int) $tile->y),
|
||||||
new IntTag("z", (int) $tile->z)
|
new IntTag("z", (int) $tile->z)
|
||||||
)));
|
)));
|
||||||
$tileEntities .= $nbt->write();
|
$tileEntities .= $nbt->write();
|
||||||
break;
|
break;
|
||||||
case "Furnace":
|
case "Furnace":
|
||||||
//nutting, not spawnable :D
|
//nutting, not spawnable :D
|
||||||
break;
|
break;
|
||||||
case "Chest":
|
case "Chest":
|
||||||
|
if($tile->isPaired()){
|
||||||
$nbt->setData(new Compound("", array(
|
$nbt->setData(new Compound("", array(
|
||||||
new StringTag("id", "Chest"),
|
new StringTag("id", "Chest"),
|
||||||
new IntTag("x", (int) $tile->x),
|
new IntTag("x", (int) $tile->x),
|
||||||
new IntTag("y", (int) $tile->y),
|
new IntTag("y", (int) $tile->y),
|
||||||
new IntTag("z", (int) $tile->z)
|
new IntTag("z", (int) $tile->z),
|
||||||
|
new IntTag("pairx", (int) $tile->x),
|
||||||
|
new IntTag("pairz", (int) $tile->z)
|
||||||
)));
|
)));
|
||||||
$tileEntities .= $nbt->write();
|
}else{
|
||||||
|
$nbt->setData(new Compound("", array(
|
||||||
|
new StringTag("id", "Chest"),
|
||||||
|
new IntTag("x", (int) $tile->x),
|
||||||
|
new IntTag("y", (int) $tile->y),
|
||||||
|
new IntTag("z", (int) $tile->z),
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
$tileEntities .= $nbt->write();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue