Skip to content

Commit

Permalink
Merge branch 'minor-next' into collision-box-specialization
Browse files Browse the repository at this point in the history
  • Loading branch information
dktapps authored Feb 4, 2025
2 parents cf65171 + ca4debb commit 862ff97
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 56 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
run: echo NAME=$(echo "${GITHUB_REPOSITORY,,}") >> $GITHUB_OUTPUT

- name: Build image for tag
uses: docker/build-push-action@v6.10.0
uses: docker/build-push-action@v6.13.0
with:
push: true
context: ./pocketmine-mp
Expand All @@ -66,7 +66,7 @@ jobs:
- name: Build image for major tag
if: steps.channel.outputs.CHANNEL == 'stable'
uses: docker/build-push-action@v6.10.0
uses: docker/build-push-action@v6.13.0
with:
push: true
context: ./pocketmine-mp
Expand All @@ -79,7 +79,7 @@ jobs:
- name: Build image for minor tag
if: steps.channel.outputs.CHANNEL == 'stable'
uses: docker/build-push-action@v6.10.0
uses: docker/build-push-action@v6.13.0
with:
push: true
context: ./pocketmine-mp
Expand All @@ -92,7 +92,7 @@ jobs:
- name: Build image for latest tag
if: steps.channel.outputs.CHANNEL == 'stable'
uses: docker/build-push-action@v6.10.0
uses: docker/build-push-action@v6.13.0
with:
push: true
context: ./pocketmine-mp
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/draft-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ jobs:
${{ github.workspace }}/core-permissions.rst
- name: Create draft release
uses: ncipollo/release-action@v1.14.0
uses: ncipollo/release-action@v1.15.0
id: create-draft
with:
artifacts: ${{ github.workspace }}/PocketMine-MP.phar,${{ github.workspace }}/start.*,${{ github.workspace }}/build_info.json,${{ github.workspace }}/core-permissions.rst
Expand Down
2 changes: 1 addition & 1 deletion build/php
Submodule php updated from ae9469 to 154943
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@
"pocketmine/locale-data": "~2.22.0",
"pocketmine/log": "^0.4.0",
"pocketmine/math": "~1.0.0",
"pocketmine/nbt": "~1.0.0",
"pocketmine/nbt": "~1.1.0",
"pocketmine/raklib": "~1.1.0",
"pocketmine/raklib-ipc": "~1.0.0",
"pocketmine/snooze": "^0.5.0",
"ramsey/uuid": "~4.7.0",
"symfony/filesystem": "~6.4.0"
},
"require-dev": {
"phpstan/phpstan": "2.1.1",
"phpstan/phpstan": "2.1.2",
"phpstan/phpstan-phpunit": "^2.0.0",
"phpstan/phpstan-strict-rules": "^2.0.0",
"phpunit/phpunit": "^10.5.24"
Expand Down
82 changes: 41 additions & 41 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions src/network/mcpe/cache/ChunkCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,13 @@ public static function pruneCaches() : void{
private int $hits = 0;
private int $misses = 0;

/**
* @phpstan-param DimensionIds::* $dimensionId
*/
private function __construct(
private World $world,
private Compressor $compressor
private Compressor $compressor,
private int $dimensionId = DimensionIds::OVERWORLD
){}

private function prepareChunkAsync(int $chunkX, int $chunkZ, int $chunkHash) : CompressBatchPromise{
Expand All @@ -109,7 +113,7 @@ private function prepareChunkAsync(int $chunkX, int $chunkZ, int $chunkHash) : C
new ChunkRequestTask(
$chunkX,
$chunkZ,
DimensionIds::OVERWORLD, //TODO: not hardcode this
$this->dimensionId,
$chunk,
$promise,
$this->compressor
Expand Down
31 changes: 27 additions & 4 deletions src/player/SurvivalBlockBreakHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

use pocketmine\block\Block;
use pocketmine\entity\animation\ArmSwingAnimation;
use pocketmine\entity\effect\VanillaEffects;
use pocketmine\item\enchantment\VanillaEnchantments;
use pocketmine\math\Facing;
use pocketmine\math\Vector3;
use pocketmine\network\mcpe\protocol\LevelEventPacket;
Expand Down Expand Up @@ -65,11 +67,29 @@ private function calculateBreakProgressPerTick() : float{
if(!$this->block->getBreakInfo()->isBreakable()){
return 0.0;
}
//TODO: improve this to take stuff like swimming, ladders, enchanted tools into account, fix wrong tool break time calculations for bad tools (pmmp/PocketMine-MP#211)
$breakTimePerTick = $this->block->getBreakInfo()->getBreakTime($this->player->getInventory()->getItemInHand()) * 20;

if(!$this->player->isOnGround() && !$this->player->isFlying()){
$breakTimePerTick *= 5;
}
if($this->player->isUnderwater() && !$this->player->getArmorInventory()->getHelmet()->hasEnchantment(VanillaEnchantments::AQUA_AFFINITY())){
$breakTimePerTick *= 5;
}
if($breakTimePerTick > 0){
return 1 / $breakTimePerTick;
$progressPerTick = 1 / $breakTimePerTick;

$haste = $this->player->getEffects()->get(VanillaEffects::HASTE());
if($haste !== null){
$hasteLevel = $haste->getEffectLevel();
$progressPerTick *= (1 + 0.2 * $hasteLevel) * (1.2 ** $hasteLevel);
}

$miningFatigue = $this->player->getEffects()->get(VanillaEffects::MINING_FATIGUE());
if($miningFatigue !== null){
$miningFatigueLevel = $miningFatigue->getEffectLevel();
$progressPerTick *= 0.21 ** $miningFatigueLevel;
}

return $progressPerTick;
}
return 1;
}
Expand All @@ -82,7 +102,10 @@ public function update() : bool{
$newBreakSpeed = $this->calculateBreakProgressPerTick();
if(abs($newBreakSpeed - $this->breakSpeed) > 0.0001){
$this->breakSpeed = $newBreakSpeed;
//TODO: sync with client
$this->player->getWorld()->broadcastPacketToViewers(
$this->blockPos,
LevelEventPacket::create(LevelEvent::BLOCK_BREAK_SPEED, (int) (65535 * $this->breakSpeed), $this->blockPos)
);
}

$this->breakProgress += $this->breakSpeed;
Expand Down
2 changes: 1 addition & 1 deletion tests/plugins/DevTools

0 comments on commit 862ff97

Please sign in to comment.