[PR #7581] A thrown snowball catches fire in flames #7690

Open
opened 2026-11-03 07:22:03 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7581
Author: @MSedgeMC
Created: 11/2/2026
Status: 🔄 Open

Base: main ← Head: fix/thrown-projectile-fire


📝 Commits (2)

  • 4855d0c fix: a thrown snowball catches fire in a fire block
  • 0837ca9 test: pin a snowball's 160 fire ticks and the water that ends them

📊 Changes

2 files changed (+168 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/game/creatures.rs (+17 -0)
📝 crates/horizon-client/src/projectiles.rs (+151 -0)

📄 Description

Vanilla

ThrowableProjectile.tick ends with this.applyEffectsFromBlocks(), right
after setPos and updateRotation and before super.tick():

 53: aload_0  54: aload_2  55: invokevirtual  setPos:(Lnet/minecraft/world/phys/Vec3;)V
 58: aload_0  59: invokevirtual  updateRotation:()V
 62: aload_0  63: invokevirtual  applyEffectsFromBlocks:()V
 66: aload_0  67: invokespecial  Projectile.tick:()V

Entity.applyEffectsFromBlocks sweeps the blocks under the box
(checkInsideBlocks) and applies their entityInside. BaseFireBlock.entityInside
registers InsideBlockEffectType.FIRE_IGNITE with a runAfter, and
BaseFireBlock.fireIgnite is

  1: invokevirtual Entity.fireImmune:()Z          // a snowball is not immune
 11: ifge 27                                      // remainingFireTicks < 0 → +1
 66: ldc 8.0f
 69: invokevirtual Entity.igniteForSeconds:(F)V   // 8 s = 160 ticks

so a thrown projectile that is not fire immune and has no negative count is
ignited for 160 ticks. Entity.baseTick then counts remainingFireTicks down
one a tick and clearFires the entity in water. Because the entity is on fire,
Entity.displayFireAnimation (isOnFire() && !isSpectator()) is true and
EntityRenderDispatcher draws the flame billboard over it — the same billboard
Horizon already draws for a burning arrow from ThrownItemRenderer's
counterpart, ArrowRenderer.

What Horizon got wrong

projectiles::Projectile, which ticks every throwable — snowballs, eggs, ender
pearls, potions, llama spit and a content mod's thrown item — had no
remainingFireTicks at all, and its tick applied no block effects, so nothing
could set a thrown snowball alight however long it sat in the flames: the
report is a snowball thrown through fire showing no fire. The
ThrownItemRenderer arm in the projectile geometry pass drew the item's
billboard and nothing else, so even a burning projectile would have looked
cold.

ProjectileWorld gains ignites (false by default; the game answers it from
the block name at that cell — fire and soul fire), the tick applies the fire
phase after the move with the box deflated by 1e-7 the way
Entity.checkInsideBlocks does, and the throwable arm draws the same
flame_geometry the arrow arm already used.

Proven: the new unit test, in a world whose cell (0, 99, 0) answers
ignites: a snowball sitting in it ticks to fire_ticks 159 (160 at the
ignite, then the tick's own Entity.baseTick countdown), one fewer each tick
in open air, 0 when the 160 run out, and 0 at once in water. Without
the change the first assertion fails with left: 0, right: 159 — the fire was
never set. A SmallFireball in the same block stays at 0, because an
AbstractHurtingProjectile does not apply the blocks it flies through; and
cargo test -p horizon-client-lib --lib projectiles:: passes (21 tests).

Not proven: the drawn billboard is not exercised here — this box has no
prepared assets, so the frame was never rendered; what is pinned is the fire
the projectile carries and the arm that draws it. Rain does not put a thrown
projectile out (the port's ProjectileWorld has no isInRain), so a burning
snowball in the rain keeps its ticks; that is unchanged by this PR and is a
separate gap. The player's own thrown trident (game/trident.rs
ThrownTrident) is a separate entity with no fire state of its own and is not
covered here.

Fixes #7456


🔄 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/7581 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/thrown-projectile-fire` --- ### 📝 Commits (2) - [`4855d0c`](https://github.com/horizon-rust/horizon/commit/4855d0c2c8193850c751f7643e182791fa12207b) fix: a thrown snowball catches fire in a fire block - [`0837ca9`](https://github.com/horizon-rust/horizon/commit/0837ca900e44695b6c121f2b440576ad145b3b1b) test: pin a snowball's 160 fire ticks and the water that ends them ### 📊 Changes **2 files changed** (+168 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/creatures.rs` (+17 -0) 📝 `crates/horizon-client/src/projectiles.rs` (+151 -0) </details> ### 📄 Description ## Vanilla `ThrowableProjectile.tick` ends with `this.applyEffectsFromBlocks()`, right after `setPos` and `updateRotation` and before `super.tick()`: ``` 53: aload_0 54: aload_2 55: invokevirtual setPos:(Lnet/minecraft/world/phys/Vec3;)V 58: aload_0 59: invokevirtual updateRotation:()V 62: aload_0 63: invokevirtual applyEffectsFromBlocks:()V 66: aload_0 67: invokespecial Projectile.tick:()V ``` `Entity.applyEffectsFromBlocks` sweeps the blocks under the box (`checkInsideBlocks`) and applies their `entityInside`. `BaseFireBlock.entityInside` registers `InsideBlockEffectType.FIRE_IGNITE` with a `runAfter`, and `BaseFireBlock.fireIgnite` is ``` 1: invokevirtual Entity.fireImmune:()Z // a snowball is not immune 11: ifge 27 // remainingFireTicks < 0 → +1 66: ldc 8.0f 69: invokevirtual Entity.igniteForSeconds:(F)V // 8 s = 160 ticks ``` so a thrown projectile that is not fire immune and has no negative count is ignited for 160 ticks. `Entity.baseTick` then counts `remainingFireTicks` down one a tick and `clearFire`s the entity in water. Because the entity is on fire, `Entity.displayFireAnimation` (`isOnFire() && !isSpectator()`) is true and `EntityRenderDispatcher` draws the flame billboard over it — the same billboard Horizon already draws for a burning arrow from `ThrownItemRenderer`'s counterpart, `ArrowRenderer`. ## What Horizon got wrong `projectiles::Projectile`, which ticks every throwable — snowballs, eggs, ender pearls, potions, llama spit and a content mod's thrown item — had no `remainingFireTicks` at all, and its tick applied no block effects, so nothing could set a thrown snowball alight however long it sat in the flames: the report is a snowball thrown through fire showing no fire. The `ThrownItemRenderer` arm in the projectile geometry pass drew the item's billboard and nothing else, so even a burning projectile would have looked cold. `ProjectileWorld` gains `ignites` (false by default; the game answers it from the block name at that cell — fire and soul fire), the tick applies the fire phase after the move with the box deflated by 1e-7 the way `Entity.checkInsideBlocks` does, and the throwable arm draws the same `flame_geometry` the arrow arm already used. **Proven:** the new unit test, in a world whose cell `(0, 99, 0)` answers `ignites`: a snowball sitting in it ticks to `fire_ticks` **159** (160 at the ignite, then the tick's own `Entity.baseTick` countdown), one fewer each tick in open air, **0** when the 160 run out, and **0** at once in water. Without the change the first assertion fails with `left: 0, right: 159` — the fire was never set. A `SmallFireball` in the same block stays at `0`, because an `AbstractHurtingProjectile` does not apply the blocks it flies through; and `cargo test -p horizon-client-lib --lib projectiles::` passes (21 tests). **Not proven:** the drawn billboard is not exercised here — this box has no prepared assets, so the frame was never rendered; what is pinned is the fire the projectile carries and the arm that draws it. Rain does not put a thrown projectile out (the port's `ProjectileWorld` has no `isInRain`), so a burning snowball in the rain keeps its ticks; that is unchanged by this PR and is a separate gap. The player's own thrown trident (`game/trident.rs` `ThrownTrident`) is a separate entity with no fire state of its own and is not covered here. Fixes #7456 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#7690
No description provided.