-
Notifications
You must be signed in to change notification settings - Fork 0
Phototaxis and Light Orbiting
| Parameter | Specification Details |
|---|---|
| AI Goal Class | net.vanillaoutsider.betterbats.ai.BatHuntLightGoal |
| Detection Light Level |
Block Light > 8 (LIGHT_DETECT_THRESHOLD) |
| Continue Light Level |
Block Light > 6 (LIGHT_CONTINUE_THRESHOLD) |
| Search Radius |
10 blocks (Deterministic BlockPos.findClosestMatch) |
| Search Throttle | Executes light search once every 30 ticks (~1.5s) |
| Orbit Duration |
200 to 600 ticks ( |
| Goal Cooldown |
200 to 400 ticks ( |
| Approach Mode | Curved banking flight vector ( |
| Orbiting Mode | Tangential velocity vector with sine-wave vertical bobbing |
| Visual Particles |
CRIT (10% tick probability during orbit) |
At night (!level.isBrightOutside()), bats display positive phototaxis, attracting them to artificial block light sources such as torches, lanterns, campfire embers, and glowstone.
Rather than orbiting a single lantern forever, bats operate on a Moth Effect cycle: they seek a nearby lantern, bank towards it, orbit in a gentle bobbing motion for 10โ30 seconds, and then trigger a 10โ20 second cooldown before hopping to another nearby light source or returning to high flight.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Nighttime Ambient โ
โโโโโโโโโโโโโโฌโโโโโโโโโโโโโโ
โ
Scans 10 blocks for Block Light > 8
โ
Light Found (targetLight)?
โโโโโโโโโโโโดโโโโโโโโโโโ
YES NO
โ โ
Distance > 2.5 blocks? Wander / BOIDs
โโโโโโโดโโโโโโ
YES NO
โ โ
Curved Banking Tangential Orbit
Approach Flight + Sine Bobbing (sin(t * 0.15) * 0.03)
+ CRIT Particles
โ โ
โโโโโโโฌโโโโโโ
โ
Ticks >= maxCirclingTicks? (10-30s)
โ
Cooldown 10-20s -> Hop to next light
To prevent rigid straight-line movement, the approach velocity blends the direct direction vector with a perpendicular tangent vector:
Once within 2.5 blocks of the light center, the bat calculates a perpendicular cross-product vector for smooth circular orbiting, combined with a vertical sine-wave oscillation:
Better Bats Wiki โข Copyright ยฉ 2026 Dasik (Rifaditya) โข Licensed under GNU GPLv3
๐ The documentation in this Wiki reflects the current source code state in the repository.
- Bat Ecology & Photophobia
- 3D BOIDs Flocking & Math
- Guano Crop Fertilization
- Phototaxis & Light Orbiting
- Pest Control Combat
- Echolocation & Panic
- Chiroptera Genetics
- Dynamic GameRules
- Ambient Spawning Rules
- HUD & Client GUI Config
- Commands & Advancements
- Sounds & Particle Effects
- Troubleshooting & FAQ