Skip to content

Validate beacon effect selections#13833

Open
NoahvdAa wants to merge 1 commit intoPaperMC:mainfrom
NoahvdAa:fix/13631
Open

Validate beacon effect selections#13833
NoahvdAa wants to merge 1 commit intoPaperMC:mainfrom
NoahvdAa:fix/13631

Conversation

@NoahvdAa
Copy link
Copy Markdown
Member

Beacons don't do any validation on the selected effects except for checking whether the effects are in the whitelist. This commit adds validation to check if a secondary-only effect (regeneration) is used as a primary and whether the effect is allowed to be selected according to the beacon's level.

Closes #13631.

Beacons don't do any validation on the selected effects except for checking whether the effects are in the whitelist.
This commit adds validation to check if a secondary-only effect (regeneration) is used as a primary and whether the effect is allowed to be selected according to the beacon's level.

Closes PaperMC#13631.
@NoahvdAa NoahvdAa requested a review from a team as a code owner April 27, 2026 20:00
@github-project-automation github-project-automation Bot moved this to Awaiting review in Paper PR Queue Apr 27, 2026
- public void updateEffects(final Optional<Holder<MobEffect>> primary, final Optional<Holder<MobEffect>> secondary) {
+ public void updateEffects(final Optional<Holder<MobEffect>> primary, Optional<Holder<MobEffect>> secondary) { // Paper - fix MC-174630 - make non-final
+ public void updateEffects(Optional<Holder<MobEffect>> primary, Optional<Holder<MobEffect>> secondary) { // Paper - fix MC-174630 - make non-final
+ // Paper start - fix MC-174630 - validate secondary power
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should update the comment now, and move the MC fixes comment to the relevant if statement

+ if (secondary.isPresent() && secondary.get() != net.minecraft.world.effect.MobEffects.REGENERATION && (primary.isPresent() && secondary.get() != primary.get())) {
+ secondary = Optional.empty();
+ }
+ if (!(this.access.getWorld().getBlockEntity(this.access.getPosition()) instanceof net.minecraft.world.level.block.entity.BeaconBlockEntity beaconEntity)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Better to do this first to early return.

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

Labels

None yet

Projects

Status: Awaiting review

Development

Successfully merging this pull request may close these issues.

Illegal Effects on Beacon

3 participants