mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-20 07:39:42 +00:00
Merge 'minor-next' into 'major-next'
Automatic merge performed by: https://github.com/pmmp/RestrictedActions/actions/runs/18636079241
This commit is contained in:
32
.github/workflows/crowdin-download-cron-trigger.yml
vendored
Normal file
32
.github/workflows/crowdin-download-cron-trigger.yml
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
#Since GitHub automatically disables cron actions after 60 days of repo inactivity, we need the active repo (PM)
|
||||
#to trigger the branch merge workflow explicitly. This avoids the need for TOS-violating actions which we previously
|
||||
#used to keep the restricted action active, as the workflow depends on the activity of this repo anyway.
|
||||
|
||||
name: Trigger Crowdin download
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 21 * * *"
|
||||
workflow_dispatch: #for testing
|
||||
|
||||
jobs:
|
||||
trigger:
|
||||
name: Trigger Crowdin download RestrictedActions workflow
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: Generate access token
|
||||
id: generate-token
|
||||
uses: actions/create-github-app-token@v2
|
||||
with:
|
||||
app-id: ${{ vars.RESTRICTED_ACTIONS_DISPATCH_ID }}
|
||||
private-key: ${{ secrets.RESTRICTED_ACTIONS_DISPATCH_KEY }}
|
||||
owner: ${{ github.repository_owner }}
|
||||
repositories: RestrictedActions
|
||||
|
||||
- name: Dispatch branch sync restricted action
|
||||
uses: peter-evans/repository-dispatch@v3
|
||||
with:
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
repository: ${{ github.repository_owner }}/RestrictedActions
|
||||
event-type: pocketmine_mp_crowdin_download
|
34
.github/workflows/crowdin-upload-trigger.yml
vendored
Normal file
34
.github/workflows/crowdin-upload-trigger.yml
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
name: Upload translations to Crowdin
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- resources/translations/eng.ini
|
||||
branches:
|
||||
- stable
|
||||
- minor-next
|
||||
- major-next
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
upload:
|
||||
name: Upload translations
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Generate access token
|
||||
id: generate-token
|
||||
uses: actions/create-github-app-token@v2
|
||||
with:
|
||||
app-id: ${{ vars.RESTRICTED_ACTIONS_DISPATCH_ID }}
|
||||
private-key: ${{ secrets.RESTRICTED_ACTIONS_DISPATCH_KEY }}
|
||||
owner: ${{ github.repository_owner }}
|
||||
repositories: RestrictedActions
|
||||
|
||||
- name: Dispatch restricted action
|
||||
uses: peter-evans/repository-dispatch@v3
|
||||
with:
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
repository: ${{ github.repository_owner }}/RestrictedActions
|
||||
event-type: pocketmine_mp_crowdin_upload
|
||||
client-payload: '{"branch": "${{ github.ref_name }}"}'
|
66
.github/workflows/download-translations.yml
vendored
66
.github/workflows/download-translations.yml
vendored
@@ -1,66 +0,0 @@
|
||||
name: Download new translations from Crowdin
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: 0 21 * * * #every day at 9pm
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
download:
|
||||
name: Download translations
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
branch:
|
||||
- stable
|
||||
- minor-next
|
||||
- major-next
|
||||
fail-fast: false
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ matrix.branch }}
|
||||
|
||||
- name: Download translations
|
||||
uses: crowdin/github-action@v2
|
||||
with:
|
||||
upload_sources: false
|
||||
upload_translations: false
|
||||
download_translations: true
|
||||
create_pull_request: false
|
||||
push_translations: false
|
||||
export_only_approved: true #irrespective of project config, only accept approved translations here
|
||||
crowdin_branch_name: ${{ matrix.branch }}
|
||||
env:
|
||||
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
|
||||
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
|
||||
|
||||
- name: Post-process placeholders back into PocketMine format
|
||||
working-directory: resources/translations
|
||||
run: |
|
||||
sed -i -r 's/\{([A-Za-z0-9]+)\}/\{%\1\}/g' *.ini
|
||||
git diff
|
||||
git status
|
||||
|
||||
- name: Delete translation files with no translations
|
||||
working-directory: resources/translations
|
||||
run: |
|
||||
for file in *.ini; do
|
||||
if grep -q -P '^[A-Za-z0-9_\-\.]+=' $file; then
|
||||
echo "Not empty: $file"
|
||||
else
|
||||
echo "Deleting empty file: $file"
|
||||
rm "$file"
|
||||
fi
|
||||
done
|
||||
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v7
|
||||
with:
|
||||
add-paths: '*.ini'
|
||||
commit-message: 'New translations from Crowdin (${{ matrix.branch }})'
|
||||
branch: crowdin-auto-fetch/${{ matrix.branch }}
|
||||
title: 'New translations from Crowdin'
|
||||
base: ${{ matrix.branch }}
|
38
.github/workflows/upload-translations.yml
vendored
38
.github/workflows/upload-translations.yml
vendored
@@ -1,38 +0,0 @@
|
||||
name: Upload translations to Crowdin
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- resources/translations/eng.ini
|
||||
branches:
|
||||
- stable
|
||||
- minor-next
|
||||
- major-next
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
upload:
|
||||
name: Upload translations
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- name: Preprocess eng.ini placeholders so Crowdin can understand them
|
||||
working-directory: resources/translations
|
||||
run: |
|
||||
sed -i -r 's/\{%([A-Za-z0-9]+)\}/\{\1\}/g' eng.ini
|
||||
cat eng.ini
|
||||
|
||||
- name: Upload eng.ini to Crowdin
|
||||
uses: crowdin/github-action@v2
|
||||
with:
|
||||
upload_sources: true
|
||||
upload_translations: false
|
||||
download_translations: false
|
||||
create_pull_request: false
|
||||
crowdin_branch_name: ${{ github.ref_name }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
|
||||
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
|
@@ -25,14 +25,53 @@ namespace pocketmine\block;
|
||||
|
||||
use pocketmine\block\utils\StaticSupportTrait;
|
||||
use pocketmine\block\utils\TallGrassTrait;
|
||||
use pocketmine\item\Fertilizer;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\math\Facing;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\player\Player;
|
||||
|
||||
class TallGrass extends Flowable{
|
||||
use TallGrassTrait;
|
||||
use StaticSupportTrait;
|
||||
|
||||
/** @phpstan-var \Closure() : DoublePlant|null */
|
||||
private ?\Closure $doublePlantVariant;
|
||||
|
||||
/**
|
||||
* @phpstan-param \Closure() : DoublePlant|null $doublePlantVariant
|
||||
*/
|
||||
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo, ?\Closure $doublePlantVariant = null){
|
||||
parent::__construct($idInfo, $name, $typeInfo);
|
||||
$this->doublePlantVariant = $doublePlantVariant;
|
||||
}
|
||||
|
||||
private function canBeSupportedAt(Block $block) : bool{
|
||||
$supportBlock = $block->getSide(Facing::DOWN);
|
||||
return $supportBlock->hasTypeTag(BlockTypeTags::DIRT) || $supportBlock->hasTypeTag(BlockTypeTags::MUD);
|
||||
}
|
||||
|
||||
public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null, array &$returnedItems = []) : bool{
|
||||
$world = $this->position->getWorld();
|
||||
$upPos = $this->position->getSide(Facing::UP);
|
||||
if(!$world->isInWorld($upPos->getFloorX(), $upPos->getFloorY(), $upPos->getFloorZ()) || $this->getSide(Facing::UP)->getTypeId() !== BlockTypeIds::AIR){
|
||||
return false;
|
||||
}
|
||||
|
||||
if($item instanceof Fertilizer && ($doubleVariant = $this->getDoublePlantVariant()) !== null){
|
||||
$bottom = (clone $doubleVariant)->setTop(false);
|
||||
$top = (clone $doubleVariant)->setTop(true);
|
||||
$world->setBlock($this->position, $bottom);
|
||||
$world->setBlock($this->position->getSide(Facing::UP), $top);
|
||||
$item->pop();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private function getDoublePlantVariant() : ?DoublePlant{
|
||||
return $this->doublePlantVariant !== null ? ($this->doublePlantVariant)() : null;
|
||||
}
|
||||
}
|
||||
|
@@ -1230,8 +1230,8 @@ final class VanillaBlocks{
|
||||
self::register("sugarcane", fn(BID $id) => new Sugarcane($id, "Sugarcane", new Info(BreakInfo::instant())));
|
||||
self::register("sweet_berry_bush", fn(BID $id) => new SweetBerryBush($id, "Sweet Berry Bush", new Info(BreakInfo::instant())));
|
||||
self::register("tnt", fn(BID $id) => new TNT($id, "TNT", new Info(BreakInfo::instant())));
|
||||
self::register("fern", fn(BID $id) => new TallGrass($id, "Fern", new Info(BreakInfo::instant(ToolType::SHEARS, 1), [Tags::POTTABLE_PLANTS])));
|
||||
self::register("tall_grass", fn(BID $id) => new TallGrass($id, "Tall Grass", new Info(BreakInfo::instant(ToolType::SHEARS, 1))));
|
||||
self::register("fern", fn(BID $id) => new TallGrass($id, "Fern", new Info(BreakInfo::instant(ToolType::SHEARS, 1), [Tags::POTTABLE_PLANTS]), fn() => VanillaBlocks::LARGE_FERN()));
|
||||
self::register("tall_grass", fn(BID $id) => new TallGrass($id, "Tall Grass", new Info(BreakInfo::instant(ToolType::SHEARS, 1)), fn() => VanillaBlocks::DOUBLE_TALLGRASS()));
|
||||
|
||||
self::register("blue_torch", fn(BID $id) => new Torch($id, "Blue Torch", new Info(BreakInfo::instant())));
|
||||
self::register("copper_torch", fn(BID $id) => new Torch($id, "Copper Torch", new Info(BreakInfo::instant())));
|
||||
|
@@ -1316,7 +1316,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer, Nev
|
||||
}
|
||||
|
||||
protected function checkGroundState(float $wantedX, float $wantedY, float $wantedZ, float $dx, float $dy, float $dz) : void{
|
||||
if($this->gamemode === GameMode::SPECTATOR){
|
||||
if(!$this->blockCollision){
|
||||
$this->onGround = false;
|
||||
}else{
|
||||
//TODO: AxisAlignedBB::withComponents() would be nice here
|
||||
|
Reference in New Issue
Block a user