Compare commits

..

1 Commits

Author SHA1 Message Date
fbe6a89777 EndCrystal: defer explosion until next tick update 2025-09-10 20:55:20 +01:00
3 changed files with 30 additions and 35 deletions

50
composer.lock generated
View File

@ -818,20 +818,20 @@
}, },
{ {
"name": "ramsey/uuid", "name": "ramsey/uuid",
"version": "4.9.1", "version": "4.9.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/ramsey/uuid.git", "url": "https://github.com/ramsey/uuid.git",
"reference": "81f941f6f729b1e3ceea61d9d014f8b6c6800440" "reference": "4e0e23cc785f0724a0e838279a9eb03f28b092a0"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/ramsey/uuid/zipball/81f941f6f729b1e3ceea61d9d014f8b6c6800440", "url": "https://api.github.com/repos/ramsey/uuid/zipball/4e0e23cc785f0724a0e838279a9eb03f28b092a0",
"reference": "81f941f6f729b1e3ceea61d9d014f8b6c6800440", "reference": "4e0e23cc785f0724a0e838279a9eb03f28b092a0",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"brick/math": "^0.8.8 || ^0.9 || ^0.10 || ^0.11 || ^0.12 || ^0.13 || ^0.14", "brick/math": "^0.8.8 || ^0.9 || ^0.10 || ^0.11 || ^0.12 || ^0.13",
"php": "^8.0", "php": "^8.0",
"ramsey/collection": "^1.2 || ^2.0" "ramsey/collection": "^1.2 || ^2.0"
}, },
@ -890,9 +890,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/ramsey/uuid/issues", "issues": "https://github.com/ramsey/uuid/issues",
"source": "https://github.com/ramsey/uuid/tree/4.9.1" "source": "https://github.com/ramsey/uuid/tree/4.9.0"
}, },
"time": "2025-09-04T20:59:21+00:00" "time": "2025-06-25T14:20:11+00:00"
}, },
{ {
"name": "symfony/filesystem", "name": "symfony/filesystem",
@ -1684,16 +1684,16 @@
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
"version": "10.5.54", "version": "10.5.53",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "b1dbbaaf96106b76d500b9d3db51f9b01f6a3589" "reference": "32768472ebfb6969e6c7399f1c7b09009723f653"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b1dbbaaf96106b76d500b9d3db51f9b01f6a3589", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/32768472ebfb6969e6c7399f1c7b09009723f653",
"reference": "b1dbbaaf96106b76d500b9d3db51f9b01f6a3589", "reference": "32768472ebfb6969e6c7399f1c7b09009723f653",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1765,7 +1765,7 @@
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues", "issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy", "security": "https://github.com/sebastianbergmann/phpunit/security/policy",
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.54" "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.53"
}, },
"funding": [ "funding": [
{ {
@ -1789,7 +1789,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2025-09-11T06:19:38+00:00" "time": "2025-08-20T14:40:06+00:00"
}, },
{ {
"name": "sebastian/cli-parser", "name": "sebastian/cli-parser",
@ -1961,16 +1961,16 @@
}, },
{ {
"name": "sebastian/comparator", "name": "sebastian/comparator",
"version": "5.0.4", "version": "5.0.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/comparator.git", "url": "https://github.com/sebastianbergmann/comparator.git",
"reference": "e8e53097718d2b53cfb2aa859b06a41abf58c62e" "reference": "a18251eb0b7a2dcd2f7aa3d6078b18545ef0558e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/e8e53097718d2b53cfb2aa859b06a41abf58c62e", "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/a18251eb0b7a2dcd2f7aa3d6078b18545ef0558e",
"reference": "e8e53097718d2b53cfb2aa859b06a41abf58c62e", "reference": "a18251eb0b7a2dcd2f7aa3d6078b18545ef0558e",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2026,27 +2026,15 @@
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/comparator/issues", "issues": "https://github.com/sebastianbergmann/comparator/issues",
"security": "https://github.com/sebastianbergmann/comparator/security/policy", "security": "https://github.com/sebastianbergmann/comparator/security/policy",
"source": "https://github.com/sebastianbergmann/comparator/tree/5.0.4" "source": "https://github.com/sebastianbergmann/comparator/tree/5.0.3"
}, },
"funding": [ "funding": [
{ {
"url": "https://github.com/sebastianbergmann", "url": "https://github.com/sebastianbergmann",
"type": "github" "type": "github"
},
{
"url": "https://liberapay.com/sebastianbergmann",
"type": "liberapay"
},
{
"url": "https://thanks.dev/u/gh/sebastianbergmann",
"type": "thanks_dev"
},
{
"url": "https://tidelift.com/funding/github/packagist/sebastian/comparator",
"type": "tidelift"
} }
], ],
"time": "2025-09-07T05:25:07+00:00" "time": "2024-10-18T14:56:07+00:00"
}, },
{ {
"name": "sebastian/complexity", "name": "sebastian/complexity",

View File

@ -52,6 +52,8 @@ class EndCrystal extends Entity implements Explosive{
protected bool $showBase = false; protected bool $showBase = false;
protected ?Vector3 $beamTarget = null; protected ?Vector3 $beamTarget = null;
private bool $primed = false;
protected function getInitialSizeInfo() : EntitySizeInfo{ return new EntitySizeInfo(2.0, 2.0); } protected function getInitialSizeInfo() : EntitySizeInfo{ return new EntitySizeInfo(2.0, 2.0); }
protected function getInitialDragMultiplier() : float{ return 1.0; } protected function getInitialDragMultiplier() : float{ return 1.0; }
@ -88,11 +90,9 @@ class EndCrystal extends Entity implements Explosive{
parent::attack($source); parent::attack($source);
if( if(
$source->getCause() !== EntityDamageEvent::CAUSE_VOID && $source->getCause() !== EntityDamageEvent::CAUSE_VOID &&
!$this->isFlaggedForDespawn() &&
!$source->isCancelled() !$source->isCancelled()
){ ){
$this->flagForDespawn(); $this->primed = true;
$this->explode();
} }
} }
@ -125,6 +125,13 @@ class EndCrystal extends Entity implements Explosive{
return $nbt; return $nbt;
} }
protected function onDeathUpdate(int $tickDiff) : bool{
if($this->primed){
$this->explode();
}
return true;
}
public function explode() : void{ public function explode() : void{
$ev = new EntityPreExplodeEvent($this, 6); $ev = new EntityPreExplodeEvent($this, 6);
$ev->call(); $ev->call();