made items placeable in creative

This commit is contained in:
GameHerobrine 2023-02-21 09:35:04 +03:00
parent 3289ecdd1b
commit 1a6f30526f

View file

@ -236,10 +236,10 @@ class Player{
$this->entity->resetSpeed(); $this->entity->resetSpeed();
$this->entity->updateLast(); $this->entity->updateLast();
$this->entity->calculateVelocity(); $this->entity->calculateVelocity();
/*if($terrain === true){ if($terrain === true){
$this->orderChunks(); $this->orderChunks();
$this->getNextChunk($this->level); $this->getNextChunk($this->level);
}*/ }
$this->entity->check = true; $this->entity->check = true;
if($force === true){ if($force === true){
$this->forceMovement = $pos; $this->forceMovement = $pos;
@ -527,9 +527,9 @@ class Player{
$pk->chunkZ = $Z; $pk->chunkZ = $Z;
$pk->data = $this->level->getOrderedFullChunk($X, $Z); $pk->data = $this->level->getOrderedFullChunk($X, $Z);
$cnt = $this->dataPacket($pk); $cnt = $this->dataPacket($pk);
if($cnt === false){ /*if($cnt === false){
return false; return false;
} }*/
$this->chunkCount = []; $this->chunkCount = [];
foreach($cnt as $i => $count){ foreach($cnt as $i => $count){
$this->chunkCount[$count] = true; $this->chunkCount[$count] = true;
@ -1461,12 +1461,12 @@ class Player{
$this->evid[] = $this->server->event("tile.update", [$this, "eventHandler"]); $this->evid[] = $this->server->event("tile.update", [$this, "eventHandler"]);
$this->lastMeasure = microtime(true); $this->lastMeasure = microtime(true);
$this->server->schedule(50, [$this, "measureLag"], [], true); $this->server->schedule(50, [$this, "measureLag"], [], true);
/*
$pk = new SetTimePacket; $pk = new SetTimePacket;
$pk->time = (int) $this->level->getTime(); $pk->time = (int) $this->level->getTime();
$pk->started = !$this->level->isTimeStopped(); $pk->started = !$this->level->isTimeStopped();
$this->dataPacket($pk); $this->dataPacket($pk);
*/
console("[INFO] " . FORMAT_AQUA . $this->username . FORMAT_RESET . "[/" . $this->ip . ":" . $this->port . "] logged in with entity id " . $this->eid . " at (" . $this->entity->level->getName() . ", " . round($this->entity->x, 2) . ", " . round($this->entity->y, 2) . ", " . round($this->entity->z, 2) . ")"); console("[INFO] " . FORMAT_AQUA . $this->username . FORMAT_RESET . "[/" . $this->ip . ":" . $this->port . "] logged in with entity id " . $this->eid . " at (" . $this->entity->level->getName() . ", " . round($this->entity->x, 2) . ", " . round($this->entity->y, 2) . ", " . round($this->entity->z, 2) . ")");
//spawn! //spawn!
@ -1492,14 +1492,14 @@ class Player{
$this->server->schedule(5, [$this->entity, "update"], [], true); $this->server->schedule(5, [$this->entity, "update"], [], true);
$this->server->schedule(2, [$this->entity, "updateMovement"], [], true); $this->server->schedule(2, [$this->entity, "updateMovement"], [], true);
$this->sendArmor(); //$this->sendArmor();
$array = explode("@n", (string)$this->server->motd); $array = explode("@n", (string)$this->server->motd);
foreach($array as $msg){ foreach($array as $msg){
$this->sendChat($msg."\n"); $this->sendChat($msg."\n");
} }
$this->sendInventory(); /*$this->sendInventory();
$this->sendSettings(); $this->sendSettings();*/
$this->orderChunks(); $this->orderChunks();
$this->getNextChunk($this->level); $this->getNextChunk($this->level);
$this->blocked = false; $this->blocked = false;
@ -1612,6 +1612,9 @@ class Player{
//$this->useChunk($packet->chunkX, $packet->chunkZ); //$this->useChunk($packet->chunkX, $packet->chunkZ);
//$this->lastChunk = [$packet->chunkX, $packet->chunkZ]; //$this->lastChunk = [$packet->chunkX, $packet->chunkZ];
break; break;
case ProtocolInfo::UPDATE_BLOCK_PACKET:
$this->level->setBlock(new Vector3($packet->x, $packet->y, $packet->z), BlockAPI::get($packet->block, $packet->meta));
break;
case ProtocolInfo::USE_ITEM_PACKET: case ProtocolInfo::USE_ITEM_PACKET:
if(!($this->entity instanceof Entity)){ if(!($this->entity instanceof Entity)){
break; break;