mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-22 04:29:43 +00:00
Changed speed check
This commit is contained in:
parent
cbe0692696
commit
fef0b27f7c
4 changed files with 9 additions and 5 deletions
|
|
@ -188,7 +188,10 @@ class Player{
|
||||||
}
|
}
|
||||||
|
|
||||||
if($repeat === false){
|
if($repeat === false){
|
||||||
$this->getNextChunk(true);
|
$r = (int) ((PLAYER_CHUNKS_PER_SECOND - 20) / 20);
|
||||||
|
for($i = 0; $i < $r; ++$i){
|
||||||
|
$this->getNextChunk(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->server->schedule(1, array($this, "getNextChunk"));
|
$this->server->schedule(1, array($this, "getNextChunk"));
|
||||||
|
|
@ -1152,7 +1155,7 @@ class Player{
|
||||||
}
|
}
|
||||||
if(($this->entity instanceof Entity) and $data["counter"] > $this->lastMovement){
|
if(($this->entity instanceof Entity) and $data["counter"] > $this->lastMovement){
|
||||||
$this->lastMovement = $data["counter"];
|
$this->lastMovement = $data["counter"];
|
||||||
$speed = $this->entity->speed;
|
$speed = $this->entity->getSpeedMeasure();
|
||||||
if($this->blocked === true or ($this->server->api->getProperty("allow-flight") !== true and (($speed > 7 and ($this->gamemode & 0x01) === 0x00) or $speed > 15)) or $this->server->api->handle("player.move", $this->entity) === false){
|
if($this->blocked === true or ($this->server->api->getProperty("allow-flight") !== true and (($speed > 7 and ($this->gamemode & 0x01) === 0x00) or $speed > 15)) or $this->server->api->handle("player.move", $this->entity) === false){
|
||||||
if($this->lastCorrect instanceof Vector3){
|
if($this->lastCorrect instanceof Vector3){
|
||||||
$this->teleport($this->lastCorrect, $this->entity->yaw, $this->entity->pitch, false);
|
$this->teleport($this->lastCorrect, $this->entity->yaw, $this->entity->pitch, false);
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ class PocketMinecraftServer{
|
||||||
return $info;
|
return $info;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function close($reason = "stop"){
|
public function close($reason = "server stop"){
|
||||||
if($this->stop !== true){
|
if($this->stop !== true){
|
||||||
if(is_int($reason)){
|
if(is_int($reason)){
|
||||||
$reason = "signal stop";
|
$reason = "signal stop";
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ define("VIEWER", 3);
|
||||||
|
|
||||||
|
|
||||||
//Players
|
//Players
|
||||||
|
define("PLAYER_CHUNKS_PER_SECOND", 60);
|
||||||
define("PLAYER_RECOVERY_BUFFER", 1024);
|
define("PLAYER_RECOVERY_BUFFER", 1024);
|
||||||
define("PLAYER_MAX_PACKET_LOSS", 0.20);
|
define("PLAYER_MAX_PACKET_LOSS", 0.20);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ class Entity extends Position{
|
||||||
public $fallY;
|
public $fallY;
|
||||||
public $fallStart;
|
public $fallStart;
|
||||||
private $tickCounter;
|
private $tickCounter;
|
||||||
private $speedMeasure = array(0, 0, 0, 0, 0);
|
private $speedMeasure = array(0, 0, 0);
|
||||||
private $server;
|
private $server;
|
||||||
private $isStatic;
|
private $isStatic;
|
||||||
public $level;
|
public $level;
|
||||||
|
|
@ -778,7 +778,7 @@ class Entity extends Position{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function resetSpeed(){
|
public function resetSpeed(){
|
||||||
$this->speedMeasure = array(0, 0, 0, 0, 0);
|
$this->speedMeasure = array(0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSpeed(){
|
public function getSpeed(){
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue