paintings were fixed

This commit is contained in:
GameHerobrine 2023-10-24 11:21:17 +03:00
parent 102f515469
commit c7e509960e

View file

@ -404,23 +404,23 @@ class Entity extends Position
$endZ = ceil($this->boundingBox->maxZ); $endZ = ceil($this->boundingBox->maxZ);
$waterDone = false; $waterDone = false;
//$bup = new AxisAlignedBB($startX, $startY + 1, $startZ, $endX, $endY, $endZ); //$bup = new AxisAlignedBB($startX, $startY + 1, $startZ, $endX, $endY, $endZ);
if(!($this instanceof Painting)){ //TODO better way to fix
for($i = 0; $i < 8; ++$i){
$x = ((($i >> 0) % 2) - 0.5) * $this->width * 0.8;
$y= ((($i >> 1) % 2) - 0.5) * 0.1;
$z = ((($i >> 2) % 2) - 0.5) * $this->width * 0.8;
for($i = 0; $i < 8; ++$i){ $blockX = (int) ($this->x + $x);
$x = ((($i >> 0) % 2) - 0.5) * $this->width * 0.8; $blockY = (int) ($this->y + $this->getEyeHeight() + $y);
$y= ((($i >> 1) % 2) - 0.5) * 0.1; $blockZ = (int) ($this->z + $z);
$z = ((($i >> 2) % 2) - 0.5) * $this->width * 0.8;
$blockX = (int) ($this->x + $x); if(!StaticBlock::getIsTransparent($this->level->level->getBlockID($blockX, $blockY, $blockZ))){
$blockY = (int) ($this->y + $this->getEyeHeight() + $y); $this->harm(1, "suffocation"); // Suffocation
$blockZ = (int) ($this->z + $z); $hasUpdate = true;
break;
if(!StaticBlock::getIsTransparent($this->level->level->getBlockID($blockX, $blockY, $blockZ))){ }
$this->harm(1, "suffocation"); // Suffocation
$hasUpdate = true;
break;
} }
} }
for ($y = $startY; $y <= $endY; ++$y){ for ($y = $startY; $y <= $endY; ++$y){
for ($x = $startX; $x <= $endX; ++$x){ for ($x = $startX; $x <= $endX; ++$x){
for ($z = $startZ; $z <= $endZ; ++$z){ for ($z = $startZ; $z <= $endZ; ++$z){
@ -1429,6 +1429,7 @@ class Entity extends Position
$pk->event = EntityEventPacket::ENTITY_DEAD; $pk->event = EntityEventPacket::ENTITY_DEAD;
$this->server->api->player->broadcastPacket($this->level->players, $pk); $this->server->api->player->broadcastPacket($this->level->players, $pk);
} }
if($this->player instanceof Player){ if($this->player instanceof Player){
$this->player->blocked = true; $this->player->blocked = true;
$this->server->api->dhandle("player.death", [ $this->server->api->dhandle("player.death", [
@ -1439,7 +1440,12 @@ class Entity extends Position
$this->server->api->ban->ban($this->player->username); $this->server->api->ban->ban($this->player->username);
} }
} else{ } else{
$this->server->api->schedule(40, [$this, "close"], []); if($this instanceof Painting){ //TODO better fix
$this->close();
}
else{
$this->server->api->schedule(40, [$this, "close"], []);
}
} }
} }