mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-22 04:29:43 +00:00
fixed players in creative being unable to punch other players, force send movement packet on respawn
This commit is contained in:
parent
bbf506c887
commit
aeffaee590
2 changed files with 27 additions and 6 deletions
|
|
@ -510,9 +510,9 @@ class Player{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$minX = ($X << 4);
|
$minX = ($X << 4);
|
||||||
$maxX = (($X << 4) + 16);
|
$maxX = (($X << 4) + 15);
|
||||||
$minZ = ($Z << 4);
|
$minZ = ($Z << 4);
|
||||||
$maxZ = (($Z << 4) + 16);
|
$maxZ = (($Z << 4) + 15);
|
||||||
|
|
||||||
$pk = new ChunkDataPacket;
|
$pk = new ChunkDataPacket;
|
||||||
$pk->chunkX = $X;
|
$pk->chunkX = $X;
|
||||||
|
|
@ -551,7 +551,11 @@ class Player{
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_array($this->lastChunk)){
|
if(is_array($this->lastChunk)){
|
||||||
$tiles = $this->server->query("SELECT ID FROM tiles WHERE spawnable = 1 AND level = '" . $this->level->getName() . "' AND x >= " . ($this->lastChunk[0] - 1) . " AND x < " . ($this->lastChunk[0] + 17) . " AND z >= " . ($this->lastChunk[1] - 1) . " AND z < " . ($this->lastChunk[1] + 17) . ";");
|
$minX = $this->lastChunk[0];
|
||||||
|
$maxX = $this->lastChunk[0] + 15;
|
||||||
|
$minZ = $this->lastChunk[1];
|
||||||
|
$maxZ = $this->lastChunk[1] + 15;
|
||||||
|
$tiles = $this->server->query("SELECT ID, x, y, z FROM tiles WHERE level = '{$this->level->getName()}' AND x >= $minX AND x <= $maxX AND z >= $minZ AND z <= $maxZ;");
|
||||||
$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){
|
||||||
|
|
@ -1725,7 +1729,7 @@ class Player{
|
||||||
$this->teleport($this->lastCorrect, $this->entity->yaw, $this->entity->pitch, false);
|
$this->teleport($this->lastCorrect, $this->entity->yaw, $this->entity->pitch, false);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$this->entity->setPosition($newPos, $packet->yaw, $packet->pitch);
|
$this->entity->setPosition($newPos, $packet->yaw, $packet->pitch, $packet->bodyYaw);
|
||||||
}
|
}
|
||||||
$this->entity->updateAABB();
|
$this->entity->updateAABB();
|
||||||
}
|
}
|
||||||
|
|
@ -2095,6 +2099,21 @@ class Player{
|
||||||
$this->craftingItems = [];
|
$this->craftingItems = [];
|
||||||
$this->toCraft = [];
|
$this->toCraft = [];
|
||||||
$this->teleport($this->spawnPosition, false, false, true, false);
|
$this->teleport($this->spawnPosition, false, false, true, false);
|
||||||
|
|
||||||
|
$pk = new MovePlayerPacket();
|
||||||
|
$pk->eid = $this->entity->eid;
|
||||||
|
$pk->x = $this->entity->x;
|
||||||
|
$pk->y = $this->entity->y;
|
||||||
|
$pk->z = $this->entity->z;
|
||||||
|
$pk->yaw = $this->entity->yaw;
|
||||||
|
$pk->pitch = $this->entity->pitch;
|
||||||
|
$pk->bodyYaw = $this->entity->headYaw;
|
||||||
|
foreach($this->entity->level->players as $player){
|
||||||
|
if($player->entity->eid != $this->entity->eid){
|
||||||
|
$player->dataPacket(clone $pk);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if($this->entity instanceof Entity){
|
if($this->entity instanceof Entity){
|
||||||
$this->entity->fire = 0;
|
$this->entity->fire = 0;
|
||||||
$this->entity->air = $this->entity->maxAir;
|
$this->entity->air = $this->entity->maxAir;
|
||||||
|
|
|
||||||
|
|
@ -941,7 +941,7 @@ class Entity extends Position
|
||||||
|
|
||||||
public function interactWith(Entity $e, $action)
|
public function interactWith(Entity $e, $action)
|
||||||
{
|
{
|
||||||
if($this->class === ENTITY_PLAYER and ($this->server->api->getProperty("pvp") == false or $this->server->difficulty <= 0 or ($e->player->gamemode & 0x01) === 0x01)){
|
if($this->isPlayer() and ($this->server->api->getProperty("pvp") == false or $this->server->difficulty <= 0 or ($this->player->gamemode & 0x01) === 0x01)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1186,7 +1186,7 @@ class Entity extends Position
|
||||||
$this->updateAABB();
|
$this->updateAABB();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setPosition(Vector3 $pos, $yaw = false, $pitch = false)
|
public function setPosition(Vector3 $pos, $yaw = false, $pitch = false, $headYaw = false)
|
||||||
{
|
{
|
||||||
$this->x = $pos->x;
|
$this->x = $pos->x;
|
||||||
$this->y = $pos->y;
|
$this->y = $pos->y;
|
||||||
|
|
@ -1197,6 +1197,8 @@ class Entity extends Position
|
||||||
if($pitch !== false){
|
if($pitch !== false){
|
||||||
$this->pitch = $pitch;
|
$this->pitch = $pitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($headYaw !== false) $this->headYaw = $headYaw;
|
||||||
}
|
}
|
||||||
public function inBlockNonVector($x, $y, $z, $radius = 0.8)
|
public function inBlockNonVector($x, $y, $z, $radius = 0.8)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue