fixed division by zero when breaking tnt, (hopefully?) fixed empty chests

This commit is contained in:
GameHerobrine 2025-07-03 20:57:00 +03:00
parent 6c7bcf014b
commit a62986a8d6
3 changed files with 7 additions and 5 deletions

View file

@ -1696,7 +1696,6 @@ class Player{
$len = 1 + strlen($pk->buffer);
$MTU = $this->MTU - 24;
if($len > $MTU) return $this->blockQueueDataPacket_big($pk);
if(($this->blockUpdateQueueLength + $len) >= $MTU){
$this->sendBlockUpdateQueue();
}

View file

@ -271,12 +271,13 @@ abstract class Block extends Position{
public function getDestroyProgress(Player $player){
if($this->breakTime < 0) return 0;
if($this->breakTime == 0) return INF; //instabreak
$id = $this->getID();
$meta = $this->getMetadata();
if($player->canDestroy($id, $meta)){
return $player->getDestroySpeed($id, $meta) / $this->breakTime / 30;
}
if($this->breakTime == 0) return INF; //instabreak
return (1 / $this->breakTime) / 100;
}

View file

@ -266,7 +266,9 @@ class Tile extends Position{
$pk->z = $ob->z;
$pk->case1 = 1;
$pk->case2 = 2;
$this->server->api->player->broadcastPacket($all, $pk);
foreach($this->level->players as $pl){
$pl->blockQueueDataPacket(clone $pk);
}
for($s = 0; $s < CHEST_SLOTS; ++$s){
$slot = $ob->getSlot($s);
if($slot->getID() > AIR and $slot->count > 0){
@ -283,8 +285,8 @@ class Tile extends Position{
$pk->z = $this->z;
$pk->case1 = 1;
$pk->case2 = 2;
foreach($this->level->players as $player){
$player->blockQueueDataPacket(clone $pk);
foreach($this->level->players as $pl){
$pl->blockQueueDataPacket(clone $pk);
}
for($s = 0; $s < CHEST_SLOTS; ++$s){