Merge branch 'master' into pr

This commit is contained in:
yefengeeeeeeeeeee 2025-05-10 15:47:11 +08:00 • committed by GitHub
commit b003448ac5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 427 additions and 262 deletions

View file

@ -106,8 +106,10 @@ class MobController
$v10 = (atan2($diffZ, $diffX) * 180 / M_PI) - 90;
$this->entity->yaw = self::limitAngle($this->entity->yaw, $v10, 30);
$this->entity->setAIMoveSpeed($this->speedMultiplier * $this->entity->getSpeed() * $this->entity->getSpeedModifer());
if($diffY > 0 && $diffX * $diffX + $diffZ * $diffZ < 1) $this->setJumping(true);
if($diffY > 0 && $diffX*$diffX + $diffZ*$diffZ < 1 && $this->entity->isCollidedHorizontally){
$this->setJumping(true);
}
}
}
//TODO handle jumps somewhere

View file

@ -27,6 +27,18 @@ class FallingSand extends Entity{
$this->close();
return;
}
//$level->fastSetBlockUpdate($x, $y, $z, 0, 0, true);
if($this->fallTime == 0){
$x = floor($this->x);
$y = floor($this->y);
$z = floor($this->z);
if($this->level->level->getBlockID($x, $y, $z) != $this->data["Tile"]){
$this->close();
return;
}
$this->level->fastSetBlockUpdate($x, $y, $z, 0, 0, true);
}
$this->lastX = $this->x;
$this->lastY = $this->y;
$this->lastZ = $this->z;
@ -41,6 +53,15 @@ class FallingSand extends Entity{
$x = floor($this->x);
$y = floor($this->y);
$z = floor($this->z);
if(($blockAt = $this->level->level->getBlockID($x, $y, $z)) != 0){
//TODO vanilla-like checking?
if(StaticBlock::getIsTransparent($blockAt) && !StaticBlock::getIsLiquid($blockAt)){
$this->close();
ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem($this->data["Tile"], 0, 1)); //TODO add metadata
return;
}
}
if($this->onGround){
$this->speedX *= 0.7;
@ -49,12 +70,6 @@ class FallingSand extends Entity{
$this->close();
//TODO vanilla-like checking?
$this->level->fastSetBlockUpdate($x, $y, $z, $this->data["Tile"], 0, true); //TODO add metadata
}elseif(($blockAt = $this->level->level->getBlockID($x, $y, $z)) != 0){
//TODO vanilla-like checking?
if(StaticBlock::getIsTransparent($blockAt) && !StaticBlock::getIsLiquid($blockAt)){
$this->close();
ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem($this->data["Tile"], 0, 1)); //TODO add metadata
}
}
}
}
}

View file

@ -43,10 +43,10 @@ class Painting extends Entity{
public $counter = 0;
public function update($now){
if($this->closed === true){
return false;
}
if($this->closed === true){
return false;
}
if(++$this->counter >= 100){
$this->counter = 0;
if(!$this->survives() && !$this->dead){ //maybe dont check entity collision?