[PR #5175] [MERGED] fix(mods): property setters return false when nothing changed #6121

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5175
Author: @reservedbytes
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @rdbtCVS

Base: main ← Head: fix/native-set-property-no-change


📝 Commits (1)

  • 135c4a8 fix(mods): property setters return false when nothing changed

📊 Changes

2 files changed (+51 additions, -16 deletions)

View changed files

📝 crates/horizon-client/src/game/native_hooks.rs (+49 -14)
📝 docs/native-mods.md (+2 -2)

📄 Description

What and why

The level's native_set_block_property and Game::native_set_block_property_with (which Game::native_set_block_property goes through) returned true when the property already had the value
Both now return false there and write nothing, as vanilla's Level.setBlock does for an unchanged state
native_set_block already returns false there, so the three helpers now agree
Both setters go through one new property_change
A test without .local data checks it on a from_facts_json registry, as with_property_finds_the_state does
A second test checks that neither setter returns true on its own
docs/native-mods.md and the doc comments now say false when the property already has the value
A mod that reads true as "the block now has this value" now gets false when the block already had it
The previous return contradicted vanilla's setBlock and native_set_block
This changes a documented return value, so I think it falls under rule 6 of docs/native-hooks-neoforge.md

@levzzz5154 i know the mod work is waiting on ludovic right now, just pinging so your agents take note of it and come back to it later

do you want it changed, or kept as documented?
if kept, i can change the docs instead to say it differs from Level.setBlock there

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

LevelChunk.setBlockState returns null when oldState == state (net/minecraft/world/level/chunk/LevelChunk.java:284-285)
Level.setBlock returns false when oldState == null (net/minecraft/world/level/Level.java:226-228)

Other projects' code

none

Self-check

Check Result
Scope ✅ 2 files, +51 −16
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 495 passed (57 s)
rustfmt ✅ (8 s)
clippy ✅ (1 min 57 s)
tests: horizon-client ✅ 1341 passed (5 min 14 s)
doc tests ✅ 0 passed (1 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🔄 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/5175 **Author:** [@reservedbytes](https://github.com/reservedbytes) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix/native-set-property-no-change` --- ### 📝 Commits (1) - [`135c4a8`](https://github.com/horizon-rust/horizon/commit/135c4a8872fad9799fca1e6f76f924c8b33c7551) fix(mods): property setters return false when nothing changed ### 📊 Changes **2 files changed** (+51 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/native_hooks.rs` (+49 -14) 📝 `docs/native-mods.md` (+2 -2) </details> ### 📄 Description ## What and why The level's `native_set_block_property` and `Game::native_set_block_property_with` (which `Game::native_set_block_property` goes through) returned `true` when the property already had the value Both now return `false` there and write nothing, as vanilla's `Level.setBlock` does for an unchanged state `native_set_block` already returns `false` there, so the three helpers now agree Both setters go through one new `property_change` A test without `.local` data checks it on a `from_facts_json` registry, as `with_property_finds_the_state` does A second test checks that neither setter returns `true` on its own `docs/native-mods.md` and the doc comments now say `false` when the property already has the value A mod that reads `true` as "the block now has this value" now gets `false` when the block already had it The previous return contradicted vanilla's `setBlock` and `native_set_block` This changes a documented return value, so I think it falls under rule 6 of `docs/native-hooks-neoforge.md` @levzzz5154 i know the mod work is waiting on ludovic right now, just pinging so your agents take note of it and come back to it later do you want it changed, or kept as documented? if kept, i can change the docs instead to say it differs from `Level.setBlock` there ## Kind - [x] parity: Horizon now does what vanilla 26.3 does - [ ] bug: a crash or a breakage - [ ] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [ ] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference `LevelChunk.setBlockState` returns `null` when `oldState == state` (`net/minecraft/world/level/chunk/LevelChunk.java:284-285`) `Level.setBlock` returns `false` when `oldState == null` (`net/minecraft/world/level/Level.java:226-228`) ## Other projects' code none ## Self-check | Check | Result | | --- | --- | | Scope | ✅ 2 files, +51 −16 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 495 passed (57 s) | | rustfmt | ✅ (8 s) | | clippy | ✅ (1 min 57 s) | | tests: horizon-client | ✅ 1341 passed (5 min 14 s) | | doc tests | ✅ 0 passed (1 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:12:15 +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#6121
No description provided.