Skip to content

Commit d2aadbd

Browse files
authored
Refactor all of entity physics alongside other stability improvements (#200)
1 parent f58bb6a commit d2aadbd

181 files changed

Lines changed: 74123 additions & 24117 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
/players
1414

1515
# Misc
16-
AGENTS.md
16+
CLAUDE.md
1717
.env
1818
/minecraft-src
1919

CLAUDE.md renamed to AGENTS.md

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
**ASK, DON'T GUESS** — Ambiguity is a stop signal. If types, error handling, or architecture is unclear, ask. No speculative coding.
22

3-
**FOUNDATIONAL INTEGRITY** — Don't implement features on missing foundations. No stubs, mocks, or hardcoded values (`todo!()`, `const user = {id:1}`) unless explicitly prototyping.
3+
**HONEST BLOCKERS** — Don't hide uncertainty behind speculative changes or workarounds. State the real issue and ask the user for missing logs, paths, data, or vanilla references.
44

5-
**VANILLA FUNCTIONALITY** - We should keep 1:1 Vanilla functionality. If a compromise can be made you MUST present the issue at hand to the user first.
5+
**FOUNDATIONAL INTEGRITY** — Don't implement features on missing foundations. No stubs, mocks, or hardcoded values (`todo!()`, `const user = {id:1}`) unless explicitly prototyping.
66

7-
**BIOME DETERMINISM** - Steel and the SteelExtractor hash harness use deterministic per-sampler biome caching. Do not dismiss feature hash mismatches as vanilla `ThreadLocal` biome-cache nondeterminism, and do not add thread-local biome behavior without an explicit design discussion.
7+
**VANILLA FUNCTIONALITY** - Keep 1:1 Vanilla functionality. If a faster or more idiomatic Rust solution diverges from vanilla behavior or structure, get explicit permission first and leave a concise comment/doc explaining why.
88

99
**SKETCHY WORKAROUND PROTOCOL** — Halt and ask permission before using:
1010
- `.clone()` to appease borrow checker, `.unwrap()`/`.expect()` in production, `unsafe`
@@ -13,7 +13,7 @@
1313

1414
Template: *"This requires [Hack] which risks [Consequence]. Proceed or solve root cause?"*
1515

16-
**CONSTRUCTIVE DISSENT**Challenge XY problems. *"I can do X, but it introduces [Issue]. Standard pattern is Y. How proceed?"*
16+
**CONSTRUCTIVE DISSENT**Treat user claims as hypotheses. Verify against local code/vanilla, call out mismatches, and challenge XY problems. Before building a complex system, state the simplest vanilla-compatible design and ask when a simpler architecture would change scope.
1717

1818
**Registries**
1919
- We should only generate what is needed. Does minecraft use a hardcoded transform? Then we do as well.
@@ -23,17 +23,17 @@ Template: *"This requires [Hack] which risks [Consequence]. Proceed or solve roo
2323
- Avoid raw `BlockStateId` in generated registry data. Use `BlockRef` plus explicit properties/default-state resolution so registry ordering can still evolve for plugin support.
2424

2525
**Code standard**
26-
- Usually vanilla is decent at naming stuff, sometimes we want to deviate from this though in cases where names are bad or non descriptive. Or we want a whole other solution to the system at hand. In that case we should add a doc comment above the struct, method or module that clearly states the differences so next time someone new picks it up they have an easy time understanding your system.
26+
- Use vanilla names unless they are misleading or a Rust design is explicitly approved. Document intentional differences on the relevant struct, method, or module.
2727
- We should try to minimize code duplication, but a few lines are usually fine.
28-
- When working on foundation we must be extra sure we aren't taking any shortcuts or leaving stuff out, this can cause issues later down the line where a foundational system has to be completely redesigned. Foundational code is code like a system or interface other code depends on, an example being the block behavior trait, if that's badly designed from the start and we have 100 block implementations building off it good luck getting it changed.
29-
- No workarounds. Don't be lazy and skip creating a helper function just cause you only needed it once for your use case.
28+
- Treat foundational systems with extra rigor; shortcuts in shared interfaces like block behavior become expensive once implementations depend on them.
29+
- No workarounds. Create the right helper/abstraction when the code needs one.
3030
- Don't add trivial wrapper methods that just alias an existing method. If `height()` already exists, don't add `get_y_size()` that returns `self.height()`. Use the existing method directly.
3131
- Prefer associated functions on the relevant type over standalone free functions when there's a clear owner.
32-
- Try to not go deep in indentation, guard clauses are useful for this and rust has some really nice `if let` and `let Some() = x else {return}`
33-
- Don't use panics unless the case never happens or is fatal to the program. Otherwise use Results
32+
- Avoid deep indentation; prefer guard clauses, `if let`, and `let Some(...) = ... else { return }`.
33+
- Use `Result` for recoverable failures; panic only for impossible or fatal states.
3434
- Don't multithread something unless you can explain why it needs multithreading.
3535
- Don't use async unless you need disk or network I/O.
36-
- If you haven't fully implemented a feature, make sure to add a // TODO: comment
36+
- If you haven't fully implemented a feature, add a `// TODO:` comment.
3737
- Keep comments concise
3838
- After fixing something don't leave a comment
3939
- Currently this project is in early development, we don't need to provide migrations
@@ -43,9 +43,12 @@ Template: *"This requires [Hack] which risks [Consequence]. Proceed or solve roo
4343
- Suppress clippy lints with `#[expect(clippy::lint_name, reason = "...")]`. False positives and intentional deviations (e.g., function length for readability) are acceptable when explained
4444

4545
**GENERATED CODE** — Never modify generated files directly:
46-
- `steel-registry/src/generated/` → modify `steel-registry/build/build.rs`
47-
- `steel-core/src/behavior/generated/` → modify `steel-core/build/items.rs` or `steel-core/build/blocks.rs`
48-
- When some data is missing from the extracted json files ALWAYS present the user with what data is required and they can provide you with a path of where the extractor code is.
46+
- `steel-registry/src/generated/` → modify `steel-registry/build/`
47+
- `steel-core/src/behavior/generated/` → modify `steel-core/build/`
48+
- `steel-worldgen/src/generated/` → modify `steel-worldgen/build/`
49+
- `steel-utils/src/generated/` → modify `steel-utils/build/`
50+
- Block/item behavior registration is generated from `#[block_behavior]` / `#[item_behavior]`; add annotated structs under `steel-core/src/behavior/`, not manual generated registration.
51+
- If extracted JSON data is missing, tell the user exactly what data is required; they can provide the extractor path.
4952

5053
## Build Commands
5154

@@ -54,17 +57,18 @@ cargo build # Build
5457
cargo run # Run
5558
cargo check # Fast compile check
5659
cargo test # Tests
57-
cargo clippy --fix --allow-dirty # Lint
60+
cargo clippy -r --all-targets --all-features # CI lint
5861
cargo check -p steel-core # Fast game/worldgen check
5962
```
6063

6164
Uses **nightly Rust**.
65+
Tooling: `ast-grep` is available for structural code search/rewrites.
6266

6367
## Architecture
6468

6569
Steel = Minecraft 26.1 server in Rust.
6670

67-
**Crates:** `steel` (thin wrapper) -> `steel-login` (initial connection) → `steel-core` (game logic) → `steel-protocol` (packets) → `steel-macros` (derives) → `steel-registry` (generated data) → `steel-utils` (common) → `steel-crypto` (encryption)
71+
**Crates:** `steel` (thin wrapper) -> `steel-login` (initial connection) → `steel-core` (game logic) → `steel-worldgen` (worldgen) → `steel-protocol` (packets) → `steel-macros` (derives) → `steel-registry` (generated data) → `steel-utils`/`steel-math` (common) → `steel-crypto` (encryption)
6872

6973
## Packets
7074
Serverbound = `ReadFrom`, Clientbound = `WriteTo`.
@@ -97,14 +101,15 @@ pub struct CAnimate {
97101
| Game logic | `steel-core/src/` |
98102
| Player | `steel-core/src/player/` (`networking.rs` = packet handlers) |
99103
| World | `steel-core/src/world/` |
100-
| Worldgen | `steel-core/src/worldgen/` |
104+
| Worldgen orchestration | `steel-core/src/worldgen/` |
105+
| Worldgen algorithms/data | `steel-worldgen/src/` |
101106
| Chunks | `steel-core/src/chunk/` |
102107
| Block/item behaviors | `steel-core/src/behavior/` |
103108
| Block entities | `steel-core/src/block_entity/` |
104109
| Entities | `steel-core/src/entity/` |
105110
| Inventory / menus | `steel-core/src/inventory/` |
106111
| Packets | `steel-protocol/src/packets/game/` |
107-
| Codegen build scripts | `steel-core/build/`, `steel-registry/build/` |
112+
| Codegen build scripts | `steel-core/build/`, `steel-registry/build/`, `steel-worldgen/build/`, `steel-utils/build/` |
108113

109114
**Vanilla** (`minecraft-src/minecraft/`):
110115
| Area | Path |

Cargo.lock

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ members = [
1515
]
1616

1717
[workspace.package]
18-
version = "0.8.0+mc26.1"
18+
version = "0.9.0+mc26.1"
1919
edition = "2024"
2020
authors = ["Alve Jeansson"]
2121
license = "AGPL-3.0-or-later"

package-content/config.schema.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@
4646
"description": "Whether to enable encryption for client-server communication",
4747
"default": true
4848
},
49+
"allow_flight": {
50+
"type": "boolean",
51+
"description": "Whether the server allows unauthorised client flight",
52+
"default": false
53+
},
4954
"motd": {
5055
"type": "string",
5156
"description": "Message of the day displayed in server lists",

package-content/config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ simulation_distance = 10
1313
online_mode = true
1414
# Whether to enable encryption for client-server communication
1515
encryption = true
16+
# Whether the server allows unauthorized client flight
17+
allow_flight = false
1618
# Message of the day displayed in server lists
1719
motd = "A Steel Server"
1820
# Whether to use a custom favicon for the server

steel-core/build/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ pub(crate) fn generate_arg(
246246
let const_ident = to_block_ident(name);
247247
// vanilla_blocks statics are owned `Block` values; constructors
248248
// expect `BlockRef = &'static Block`, so auto-borrow here.
249-
if module == "vanilla_blocks" {
249+
if module == "vanilla_blocks" || module == "sound_events" {
250250
quote! { &#module_ident::#const_ident }
251251
} else {
252252
quote! { #module_ident::#const_ident }

0 commit comments

Comments
 (0)