-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wind Charge Implementation #6427
base: minor-next
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newly re-based PR...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Except this it looks good to me, I don't understand why does Github web preview looks like indentation is off but it seems not to.
It's seems like fall distance compensation is missing. In vanilla, a player launched by wind charges shot by a player accumulates fall damage only when falling below the Y level where the wind burst hit. |
@@ -91,4 +89,19 @@ public function onNearbyBlockChange() : void{ | |||
private function canBeSupportedAt(Block $block, int $face) : bool{ | |||
return $block->getAdjacentSupportType(Facing::opposite($face))->hasCenterSupport(); | |||
} | |||
|
|||
public function onProjectileInteraction(Projectile $projectile) : void{ | |||
if($projectile instanceof WindCharge) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to check if its not pressed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$this->pressed(); in this context, thereby extending the pushed duration if already down, I do not see a need to change this, thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by checking that it is not activated, you will avoid extra sound.
// This is to avoid calling Door::onProjectileInteraction() twice due to two tiles. | ||
if($this->top) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, if the projectile hit the upper one, no toggle will be happened ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this is my best attempt at handling this issue, if it hits both blocks the door hits, (open, close)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be useful before toggling to check the other state. If its not the same as ours when projectile hits, we can ignore ? Just a theory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
feels a little hacky to be honest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe hacky but can avoid to have unexpected side effect if only the top block is hitten by the effect area.
src/block/Trapdoor.php
Outdated
if($this->getTypeId() === BlockTypeIds::IRON_TRAPDOOR) { | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be better to moove it into the condition above?
An additional comment: isn't it better to check whether it's a windcharge by the typeId rather than the instance? |
Introduction
Implementation for the 1.21.0
Wind Charge
Relevant issues
N/A
Details
Wind charges can be deflected if hit with another projectile or a melee attack, similar to ghast fireballs.
Wind charges are distance attenuated by liquids such as water and lava. They also appear to fly in a straight line, similar to fireballs
Wind charges are set to despawn after five minuets due to the gravity less nature of the entity.
https://minecraft.wiki/w/Wind_Charge
Changes
One method has been added to pocketmine\block\Block:
Both class' for the Wind Charge item and Projectile have been created:
One class has been created to handle the wind charge explode particle:
One class has been added to handle wind charge burst sound:
The Wind Charge has been implemented as a vanilla item.
The Wind Charge Entity has been implemented as an Entity.
API changes
N/A
Behavioural changes
N/A
Backwards compatibility
N/A
Follow-up
N/A
Tests
I tested this PR by doing the following (tick all that apply):
tests/phpunit
folder)Behavior With Other Blocks
Behavior.mp4
Behavior With Players (shows less effective under water.)
minecraft-2024-06-26-02-45-54-online-video-cuttercom-1_T9Woq9fd.mp4
Behavior Multi Hit
Minecraft.2024-06-26.03-18-39.mp4