[PR #6204] [MERGED] Make a bat flap the sculk sensors while it is awake #6719

Closed
opened 2026-11-03 06:25:25 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6204
Author: @MSedgeMC
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: fix/bat-flap


📝 Commits (1)

  • e35d095 Make a bat flap the sculk sensors while it is awake

📊 Changes

1 file changed (+32 additions, -5 deletions)

View changed files

📝 crates/horizon-client/src/game/sculk.rs (+32 -5)

📄 Description

Entity.move ends its airborne branch with

if (blockStateBelow.isAir()) this.processFlappingMovement();

and processFlappingMovement posts GameEvent.FLAP when isFlapping() is true. Two mobs
override it:

// Bee.isFlapping
invokevirtual isFlying; ifeq false; getfield tickCount; getstatic TICKS_PER_FLAP(=2); irem
// Bat.isFlapping, javap -p -c on Bat
0: aload_0  1: invokevirtual isResting  4: ifne 24
7: aload_0  8: getfield tickCount  11: i2f  12: ldc 10.0f  14: frem
15: fconst_0  16: fcmpl  17: ifne 24

Horizon's sculk loop had only the bee (!on_ground && age % 2 == 0), so a flying bat made no
flap event: sculk sensors ignored it and a warden never heard it, where vanilla hears a bat
every ten ticks.

Proven: on the build VM, cargo test -q -p horizon-client --bin horizon-client game::sculk::tests
→ 3 passed, including the new a_bat_flaps_every_tenth_tick_unless_it_is_resting
(the formula, a resting bat, a bee on the ground, and a cow making none).

Not proven: the emission into a live sensor is not tested — the flap loop needs a running
Game, and the test covers the per-tick gate it calls. The in-game check: fly a bat near a
calibrated sculk sensor and see the vibration, then let the bat hang and see it stop.

One thing carried over unchanged: the air-below test stays where it was, outside the new gate,
because it is Entity.move's own condition rather than part of isFlapping.


🔄 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/6204 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/bat-flap` --- ### 📝 Commits (1) - [`e35d095`](https://github.com/horizon-rust/horizon/commit/e35d09582c664d08186746c7f8ffe1a216c57a7b) Make a bat flap the sculk sensors while it is awake ### 📊 Changes **1 file changed** (+32 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/sculk.rs` (+32 -5) </details> ### 📄 Description `Entity.move` ends its airborne branch with ```java if (blockStateBelow.isAir()) this.processFlappingMovement(); ``` and `processFlappingMovement` posts `GameEvent.FLAP` when `isFlapping()` is true. Two mobs override it: ```java // Bee.isFlapping invokevirtual isFlying; ifeq false; getfield tickCount; getstatic TICKS_PER_FLAP(=2); irem // Bat.isFlapping, javap -p -c on Bat 0: aload_0 1: invokevirtual isResting 4: ifne 24 7: aload_0 8: getfield tickCount 11: i2f 12: ldc 10.0f 14: frem 15: fconst_0 16: fcmpl 17: ifne 24 ``` Horizon's sculk loop had only the bee (`!on_ground && age % 2 == 0`), so a flying bat made no flap event: sculk sensors ignored it and a warden never heard it, where vanilla hears a bat every ten ticks. **Proven:** on the build VM, `cargo test -q -p horizon-client --bin horizon-client game::sculk::tests` → `3 passed`, including the new `a_bat_flaps_every_tenth_tick_unless_it_is_resting` (the formula, a resting bat, a bee on the ground, and a cow making none). **Not proven:** the emission into a live sensor is not tested — the flap loop needs a running `Game`, and the test covers the per-tick gate it calls. The in-game check: fly a bat near a calibrated sculk sensor and see the vibration, then let the bat hang and see it stop. One thing carried over unchanged: the air-below test stays where it was, outside the new gate, because it is `Entity.move`'s own condition rather than part of `isFlapping`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:25:25 +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#6719
No description provided.