-
-
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
Implement Trident #4547
base: minor-next
Are you sure you want to change the base?
Implement Trident #4547
Conversation
Trident enchantments? |
@dktapps When you merged it? It's really good implementation. I thought that it must be in PocketMine-MP |
oh no! |
That's a github bug, don't worry about it. |
I will take up this PR when I have time. |
I don't love that we're breaking BC to implement this. Is there a way to do it while retaining BC? |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
The BC Break is to be able to modify the motion that the projectile will have when impacting a target, previously it was simply set to zero, but the trident has the fature of "bouncing" when hitting an entity. I thought of an alternative of something like getMotionOnHit(ProjectileHitEvent), but I disliked it and we already had onHit which does not have a return value. |
In its beginnings this PR did not contain BCBreak, this was done by creating a new trident inside onHitEntity() with the desired motion. But I discarded that because it felt hacky. |
Seems to me like we should enable the use of setMotion in onHit, as that's the conventional way to set motion. There's also a behavioural BC break wrt. the despawn behaviour when hitting objects. I'm not sure how we could make that non-BC-breaking. |
I think we can avoid BC breaks:
However, the branch will need to be rebased if we retarget this back to minor-next, since there's been stuff merged into it from major-next. |
The base branch was changed.
} | ||
|
||
$item = Item::nbtDeserialize($itemTag); | ||
if($item->isNull() || !$item instanceof TridentItem){ |
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.
Is there a reason to require this to be a TridentItem? It doesn't look like it needs any specific methods.
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.
Consistency, if I do TridentEntity->getItem()
I would expect a TridentItem
.
Co-authored-by: Dylan T. <[email protected]>
Co-authored-by: Dylan T. <[email protected]>
Now if the player has stacked tridents only one will be thrown
@@ -69,7 +69,6 @@ public function onReleaseUsing(Player $player, array &$returnedItems) : ItemUseR | |||
$item = $entity->getItem(); | |||
$item->applyDamage(1); |
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.
I feel like it would make more sense to damage the item before passing it to TridentEntity constructor instead of having to get/set it here
Introduction
Implements item and trident projectile.
Changes
API changes
Projectile::onHit()
now returnsVector3
representing the new projectile motion.Behavioural changes
Projectile::onHitEntity()
no longer flags the projectile for despawn, child classes decide whether the entity should be despawned.Follow-up
Implement enchantments
Implement custom death attack message for thrown tridents
Requires translations:
TODO
death.attack.thrownTrident
{%0} was impaled to death by {%1}
Tests
https://youtu.be/y__tfdHA3FE