Skip to content

fix: Validate region ownership for AI sensor targets - #491

Open
PluginsKers wants to merge 1 commit into
PaperMC:ver/26.2.xfrom
PluginsKers:fix/issue-1-region-owned-sensor-targets
Open

fix: Validate region ownership for AI sensor targets#491
PluginsKers wants to merge 1 commit into
PaperMC:ver/26.2.xfrom
PluginsKers:fix/issue-1-region-owned-sensor-targets

Conversation

@PluginsKers

@PluginsKers PluginsKers commented Aug 9, 2026

Copy link
Copy Markdown

Root cause

NearestLivingEntitySensor stores direct LivingEntity references in Brain memory. Sensors refresh independently at the default 20-tick interval, so region ownership can change before NearestVisibleLivingEntities, AdultSensorAnyType, or BabyFollowAdult consumes a cached target. The Bukkit target event can also replace the target with an entity owned by another region.

Changes

Validate ownership before candidate state reads, cached visibility checks, distance calculations, and event-replaced target access. Erase stale NEAREST_VISIBLE_ADULT memory before stopping the follow behavior.

These checks preserve Folia's ownership boundary instead of bypassing CraftEntity#getHandle thread enforcement.

Validation

.\gradlew.bat applyAllPatches --console=plain

.\gradlew.bat build --console=plain

Refs #203

@Q2297045667

Q2297045667 commented Aug 9, 2026

Copy link
Copy Markdown

请使用英文

哦,看错了我以为自己的项目哪

@Q2297045667

Copy link
Copy Markdown

不过Folia也用英文,中文没人看

Validate entity ownership at AI sensor collection and consumption boundaries.
@PluginsKers
PluginsKers force-pushed the fix/issue-1-region-owned-sensor-targets branch from ff26903 to ef3b376 Compare August 9, 2026 10:25
@PluginsKers PluginsKers changed the title fix: 过滤实体传感器的跨分区候选 fix: Validate region ownership for AI sensor targets Aug 9, 2026
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