[PR #3475] [CLOSED] fix(gameplay): allow extinguishing fire with weapons in creative mode #5006

Closed
opened 2026-11-03 05:09:33 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3475
Author: @josegil1909
Created: 10/29/2026
Status: ❌ Closed

Base: main ← Head: fix/extinguish-fire-sword-creative


📝 Commits (1)

  • 67a1a03 fix(gameplay): allow extinguishing fire with weapons in creative mode

📊 Changes

5 files changed (+69 additions, -20 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+7 -3)
📝 crates/horizon-client/src/game/hand.rs (+8 -7)
📝 crates/horizon-client/src/game/remote.rs (+11 -10)
📝 crates/horizon-items/src/items.rs (+37 -0)
📝 tests/test_remote_mining.py (+6 -0)

📄 Description

What and why

Fixes #3469

In Creative mode, holding a weapon (sword, trident, mace) prevented players from extinguishing fire by left-clicking it. This was because can_destroy_block only checked whether the held weapon can destroy blocks in creative mode, without checking whether the targeted block was fire.

In vanilla Minecraft (Item.canAttackBlock), breaking blocks with weapons in Creative mode is forbidden (!this.canDestroyBlocksInCreative()), but attacks on fire (state.is(BlockTags.FIRE)) are explicitly allowed so players can extinguish fires without switching items.

This PR adds Items::can_attack_block(held, creative, is_fire) and uses it across player block break/attack entry points (break_block_as_player, tick_mining, remote_mining, and GameHands::destroy_block).

Vanilla reference

net.minecraft.world.item.Item.canAttackBlock(BlockState state, Level level, BlockPos pos, Player player):

public boolean canAttackBlock(BlockState state, Level level, BlockPos pos, Player player) {
    return !player.isCreative() || this.canDestroyBlocksInCreative() || state.is(BlockTags.FIRE);
}

Self-check

  • Touched crates checked and tested clean (cargo test -p horizon-items, cargo check -p horizon-client).
  • Added unit test in horizon-items verifying survival and creative interactions with weapons against fire and non-fire blocks.
  • Fixed mock resources in tests/test_remote_mining.py to match remote_mining contract; passes python3 -m unittest -v tests/test_remote_mining.py.
  • Formatted with cargo fmt --all -- --check.

🔄 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/3475 **Author:** [@josegil1909](https://github.com/josegil1909) **Created:** 10/29/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/extinguish-fire-sword-creative` --- ### 📝 Commits (1) - [`67a1a03`](https://github.com/horizon-rust/horizon/commit/67a1a03acf603da187acc9a58714b6237dbb9312) fix(gameplay): allow extinguishing fire with weapons in creative mode ### 📊 Changes **5 files changed** (+69 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+7 -3) 📝 `crates/horizon-client/src/game/hand.rs` (+8 -7) 📝 `crates/horizon-client/src/game/remote.rs` (+11 -10) 📝 `crates/horizon-items/src/items.rs` (+37 -0) 📝 `tests/test_remote_mining.py` (+6 -0) </details> ### 📄 Description ## What and why Fixes #3469 In Creative mode, holding a weapon (sword, trident, mace) prevented players from extinguishing fire by left-clicking it. This was because `can_destroy_block` only checked whether the held weapon can destroy blocks in creative mode, without checking whether the targeted block was fire. In vanilla Minecraft (`Item.canAttackBlock`), breaking blocks with weapons in Creative mode is forbidden (`!this.canDestroyBlocksInCreative()`), but attacks on fire (`state.is(BlockTags.FIRE)`) are explicitly allowed so players can extinguish fires without switching items. This PR adds `Items::can_attack_block(held, creative, is_fire)` and uses it across player block break/attack entry points (`break_block_as_player`, `tick_mining`, `remote_mining`, and `GameHands::destroy_block`). ## Vanilla reference `net.minecraft.world.item.Item.canAttackBlock(BlockState state, Level level, BlockPos pos, Player player)`: ```java public boolean canAttackBlock(BlockState state, Level level, BlockPos pos, Player player) { return !player.isCreative() || this.canDestroyBlocksInCreative() || state.is(BlockTags.FIRE); } ``` ## Self-check - Touched crates checked and tested clean (`cargo test -p horizon-items`, `cargo check -p horizon-client`). - Added unit test in `horizon-items` verifying survival and creative interactions with weapons against fire and non-fire blocks. - Fixed mock resources in `tests/test_remote_mining.py` to match `remote_mining` contract; passes `python3 -m unittest -v tests/test_remote_mining.py`. - Formatted with `cargo fmt --all -- --check`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:09:33 +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#5006
No description provided.