[PR #2178] [MERGED] Make lightning strike the closest lightning rod #4075

Closed
opened 2026-11-03 04:14:31 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2178
Author: @kacpherek
Created: 10/26/2026
Status: ✅ Merged
Merged: 10/26/2026
Merged by: @ludovic111

Base: main ← Head: fix/lightning-rod-attraction


📝 Commits (1)

  • 551a9ee Make lightning strike the closest lightning rod

📊 Changes

1 file changed (+62 additions, -2 deletions)

View changed files

📝 crates/horizon-client/src/game/lightning.rs (+62 -2)

📄 Description

What and why

Lightning rods never drew a strike. lightning_target only looked for a living entity in the column and then fell back to the top of the column, so a rod was only powered when a bolt happened to land on it.

It now looks for the closest lightning rod first, like vanilla. Among the lightning rods within 128 blocks of the column's top, it takes the closest one whose block is the top block of its column, and the bolt strikes one block above it. If there is none, the old behaviour (entity in the column, else the column top) is unchanged. The existing strike_rod then powers the rod as before.

Horizon has no point-of-interest index, so the search scans the loaded chunks the same way /locate poi does, skipping sections whose palette has no lightning rod. Rods in unloaded chunks are not found (vanilla can read them from the saved POI data).

Vanilla reference

  • ServerLevel.findLightningTargetAround: tries findLightningRod(center) before looking for entities.
  • ServerLevel.findLightningRod: PoiManager.findClosest for LIGHTNING_ROD within 128 blocks, filtered to y == getHeight(WORLD_SURFACE, x, z) - 1, result above(1).
  • PoiManager.getInRange / findClosest: squared distance to the center is at most 128 squared; the closest wins.

Self-check

cargo check -p horizon-client passes.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/2178 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/lightning-rod-attraction` --- ### 📝 Commits (1) - [`551a9ee`](https://github.com/horizon-rust/horizon/commit/551a9ee9c53382ed998b38cb1d390e3b57cea959) Make lightning strike the closest lightning rod ### 📊 Changes **1 file changed** (+62 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/lightning.rs` (+62 -2) </details> ### 📄 Description ## What and why Lightning rods never drew a strike. `lightning_target` only looked for a living entity in the column and then fell back to the top of the column, so a rod was only powered when a bolt happened to land on it. It now looks for the closest lightning rod first, like vanilla. Among the lightning rods within 128 blocks of the column's top, it takes the closest one whose block is the top block of its column, and the bolt strikes one block above it. If there is none, the old behaviour (entity in the column, else the column top) is unchanged. The existing `strike_rod` then powers the rod as before. Horizon has no point-of-interest index, so the search scans the loaded chunks the same way `/locate poi` does, skipping sections whose palette has no lightning rod. Rods in unloaded chunks are not found (vanilla can read them from the saved POI data). ## Vanilla reference - `ServerLevel.findLightningTargetAround`: tries `findLightningRod(center)` before looking for entities. - `ServerLevel.findLightningRod`: `PoiManager.findClosest` for `LIGHTNING_ROD` within 128 blocks, filtered to `y == getHeight(WORLD_SURFACE, x, z) - 1`, result `above(1)`. - `PoiManager.getInRange` / `findClosest`: squared distance to the center is at most 128 squared; the closest wins. ## Self-check `cargo check -p horizon-client` passes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:14:31 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#4075
No description provided.