Skip to content

Ported entities to 26.1.x#2640

Open
albazavr-alba wants to merge 6 commits into
TeamTwilight:latestfrom
albazavr-alba:port-entities
Open

Ported entities to 26.1.x#2640
albazavr-alba wants to merge 6 commits into
TeamTwilight:latestfrom
albazavr-alba:port-entities

Conversation

@albazavr-alba

Copy link
Copy Markdown

No description provided.

Comment thread src/main/java/twilightforest/entity/projectile/TFArrow.java

@a6tumn a6tumn left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment


@Override
public void doPostHurtEffects(LivingEntity target) {
if (this.parentArrow != null) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to leave this snippet here as a potential replacement for the removed behavior:

@Override
public void doPostHurtEffects(LivingEntity target) {
    if (this.parentArrow != null) {
        if (this.parentArrow instanceof Arrow arrow) {
            arrow.getPotionContents().forEachEffect(
                effect -> target.addEffect(effect, arrow.getEffectSource()),
                arrow.getPotionDurationScale()
            );
        }
        if (this.parentArrow instanceof SpectralArrow spectralArrow) {
            target.addEffect(
                new MobEffectInstance(MobEffects.GLOWING, spectralArrow.duration, 0),
                spectralArrow.getEffectSource()
            );
        }
    }

    super.doPostHurtEffects(target);
}

It would require widening the visibility of getPotionContents(), getPotionDurationScale(), and duration. It also has the drawback of only applying effects for these two types of arrows. Another option could be a mixin accessor(likely bytecode transformer in the case of this project) for the original method in AbstractArrow, but I think this is a lot simpler for now. The intention of this comment is to provide context for other reviewers, please do not make changes based on it until someone from the team is able to review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants