Skip to content

Ported entities to 26.1.x#2640

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

Ported entities to 26.1.x#2640
albazavr-alba wants to merge 8 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.

Comment thread src/main/java/twilightforest/entity/ProtectionBox.java Outdated

@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.

Looks pretty good to me, see review comment for my remaining question. We should also decide what to do with effects in TFArrow at some point, but don't worry about that.

@albazavr-alba
albazavr-alba requested a review from a6tumn July 20, 2026 17:51
Comment thread src/main/java/twilightforest/entity/ProtectionBox.java Outdated
@albazavr-alba
albazavr-alba requested a review from a6tumn July 20, 2026 20:51

public static AttributeSupplier.Builder registerAttributes() {
return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 10.0D).add(Attributes.MOVEMENT_SPEED, 0.25D);
return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 10.0D).add(Attributes.MOVEMENT_SPEED, 0.25D).add(Attributes.TEMPT_RANGE, 16.0D);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

TEMPT_RANGE is hardcoded as 10.0 in TemptGoal In 1.21.1. Also, I think it's better to use Animal.createAnimalAttributes().

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

That looks right to me if we were already implicitly using 10.0 on 1.21.1.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Where did 16.0 come from?

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.

3 participants