mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-13 13:25:16 +00:00
Added forced position strong check for Player
This commit is contained in:
parent
50b2f55583
commit
44a30b7fac
@ -1336,6 +1336,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
|||||||
}
|
}
|
||||||
|
|
||||||
$newPos = new Vector3($packet->x, $packet->y, $packet->z);
|
$newPos = new Vector3($packet->x, $packet->y, $packet->z);
|
||||||
|
$oldPos = new Vector3($this->x, $this->y, $this->z);
|
||||||
|
|
||||||
$revert = false;
|
$revert = false;
|
||||||
|
|
||||||
@ -1382,7 +1383,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
|||||||
|
|
||||||
$diff = $diffX ** 2 + $diffY ** 2 + $diffZ ** 2;
|
$diff = $diffX ** 2 + $diffY ** 2 + $diffZ ** 2;
|
||||||
|
|
||||||
if(!$revert and $diff > 0.15 and !$this->isSleeping() and $this->isSurvival()){
|
if(!$revert and $diff > 0.0625 and !$this->isSleeping() and $this->isSurvival()){
|
||||||
$revert = true;
|
$revert = true;
|
||||||
$this->server->getLogger()->warning($this->getName()." moved wrongly!");
|
$this->server->getLogger()->warning($this->getName()." moved wrongly!");
|
||||||
}
|
}
|
||||||
@ -1399,6 +1400,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
|||||||
$pk->yaw = $this->yaw;
|
$pk->yaw = $this->yaw;
|
||||||
$pk->teleport = true;
|
$pk->teleport = true;
|
||||||
$this->directDataPacket($pk);
|
$this->directDataPacket($pk);
|
||||||
|
$this->forceMovement = new Vector3($this->x, $this->y, $this->z);
|
||||||
}else{
|
}else{
|
||||||
$this->forceMovement = null;
|
$this->forceMovement = null;
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,82 @@ class Stair extends Transparent{
|
|||||||
$this->hardness = 30;
|
$this->hardness = 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
public function collidesWithBB(AxisAlignedBB $bb, &$list = []){
|
||||||
|
$damage = $this->getDamage();
|
||||||
|
$j = $damage & 0x03;
|
||||||
|
|
||||||
|
$f = 0;
|
||||||
|
$f1 = 0.5;
|
||||||
|
$f2 = 0.5;
|
||||||
|
$f3 = 1;
|
||||||
|
|
||||||
|
if(($damage & 0x04) > 0){
|
||||||
|
$f = 0.5;
|
||||||
|
$f1 = 1;
|
||||||
|
$f2 = 0;
|
||||||
|
$f3 = 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($bb->intersectsWith($bb2 = new AxisAlignedBB(
|
||||||
|
$this->x,
|
||||||
|
$this->y + $f,
|
||||||
|
$this->z,
|
||||||
|
$this->x + 1,
|
||||||
|
$this->y + $f1,
|
||||||
|
$this->z + 1
|
||||||
|
))){
|
||||||
|
$list[] = $bb2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($j === 0){
|
||||||
|
if($bb->intersectsWith($bb2 = new AxisAlignedBB(
|
||||||
|
$this->x + 0.5,
|
||||||
|
$this->y + $f2,
|
||||||
|
$this->z,
|
||||||
|
$this->x + 1,
|
||||||
|
$this->y + $f3,
|
||||||
|
$this->z + 1
|
||||||
|
))){
|
||||||
|
$list[] = $bb2;
|
||||||
|
}
|
||||||
|
}elseif($j === 1){
|
||||||
|
if($bb->intersectsWith($bb2 = new AxisAlignedBB(
|
||||||
|
$this->x,
|
||||||
|
$this->y + $f2,
|
||||||
|
$this->z,
|
||||||
|
$this->x + 0.5,
|
||||||
|
$this->y + $f3,
|
||||||
|
$this->z + 1
|
||||||
|
))){
|
||||||
|
$list[] = $bb2;
|
||||||
|
}
|
||||||
|
}elseif($j === 2){
|
||||||
|
if($bb->intersectsWith($bb2 = new AxisAlignedBB(
|
||||||
|
$this->x,
|
||||||
|
$this->y + $f2,
|
||||||
|
$this->z + 0.5,
|
||||||
|
$this->x + 1,
|
||||||
|
$this->y + $f3,
|
||||||
|
$this->z + 1
|
||||||
|
))){
|
||||||
|
$list[] = $bb2;
|
||||||
|
}
|
||||||
|
}elseif($j === 3){
|
||||||
|
if($bb->intersectsWith($bb2 = new AxisAlignedBB(
|
||||||
|
$this->x,
|
||||||
|
$this->y + $f2,
|
||||||
|
$this->z,
|
||||||
|
$this->x + 1,
|
||||||
|
$this->y + $f3,
|
||||||
|
$this->z + 0.5
|
||||||
|
))){
|
||||||
|
$list[] = $bb2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
public function getBoundingBox(){
|
public function getBoundingBox(){
|
||||||
if(($this->getDamage() & 0x04) > 0){
|
if(($this->getDamage() & 0x04) > 0){
|
||||||
return new AxisAlignedBB(
|
return new AxisAlignedBB(
|
||||||
|
@ -729,6 +729,7 @@ abstract class Entity extends Position implements Metadatable{
|
|||||||
|
|
||||||
$this->ySize *= 0.4;
|
$this->ySize *= 0.4;
|
||||||
|
|
||||||
|
/*
|
||||||
if($this->isColliding){ //With cobweb?
|
if($this->isColliding){ //With cobweb?
|
||||||
$this->isColliding = false;
|
$this->isColliding = false;
|
||||||
$dx *= 0.25;
|
$dx *= 0.25;
|
||||||
@ -738,6 +739,7 @@ abstract class Entity extends Position implements Metadatable{
|
|||||||
$this->motionY = 0;
|
$this->motionY = 0;
|
||||||
$this->motionZ = 0;
|
$this->motionZ = 0;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
$movX = $dx;
|
$movX = $dx;
|
||||||
$movY = $dy;
|
$movY = $dy;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user